This repository has been archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
88 lines (73 loc) · 3.24 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Use one of the following LEMP configurations for your app or start from scratch.
# Scratch: "scratch"
# Drupal (8): "drupal"
# Laravel/Lumen (5.2): "laravel"
# Magento (1.9.1): "magento"
# Symfony (2.8): "symfony"
# TYPO3 (7.6): "typo3"
# WordPress (4.3): "wordpress"
app = "scratch"
# Define subfolder within your project for using as webserver root. Show manual of your application for more details.
docroot = "src"
Vagrant.configure(2) do |config|
# See Vagrant documentation for more information.
config.vm.box = "debian/jessie64"
config.vm.network "private_network", ip: "192.168.13.37"
config.vm.hostname = "servivum.dev"
if OS.windows?
config.vm.synced_folder ".", "/vagrant", type: "smb", mount_options: ["mfsymlinks,dir_mode=0755,file_mode=0755"]
elsif OS.mac?
config.vm.synced_folder ".", "/vagrant", type: "nfs"
end
# Fix "stdin: is not a tty" message
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
# Installing and configuring LEMP stack and utilities
config.vm.provision :shell, path: "vagrant/10_base.sh", args: [app, docroot]
# Configuring the LEMP stack for selected application
config.vm.provision :shell, path: "vagrant/20_drupal.sh", args: [app, docroot]
config.vm.provision :shell, path: "vagrant/20_laravel.sh", args: [app, docroot]
config.vm.provision :shell, path: "vagrant/20_magento.sh", args: [app, docroot]
config.vm.provision :shell, path: "vagrant/20_symfony.sh", args: [app, docroot]
config.vm.provision :shell, path: "vagrant/20_typo3.sh", args: [app, docroot]
config.vm.provision :shell, path: "vagrant/20_wordpress.sh", args: [app, docroot]
# Custom tasks from inline Shell commands
config.vm.provision "shell", inline: <<-SHELL
# Put your Shell commands here ...
echo "Running inline custom tasks ..."
SHELL
# Custom tasks from external file. Recommended for many commands.
config.vm.provision :shell, path: "vagrant/30_custom.sh", args: [app, docroot]
# Restart relevant services on each boot up
config.vm.provision "shell", inline: "service nginx restart", run: "always"
config.vm.provision "shell", inline: "service php5-fpm restart", run: "always"
config.vm.provision "shell", inline: "service mysql restart", run: "always"
# Show IP address and hostname
config.vm.provision "shell", inline: "
echo \" \"
echo \"--- PUT THIS LINE IN YOUR HOST FILE ---\"
echo \" \"
echo `/sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` `hostname -f`
echo \" \"
echo \"---------------------------------------\"
echo \" \"
", run: "always"
# Introduction message
config.vm.post_up_message = "Servivum look-alike environment is up and running! See https://github.com/Servivum/vagrant-box of project for more details."
end
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.unix?
!OS.windows?
end
def OS.linux?
OS.unix? and not OS.mac?
end
end