/
Vagrantfile
73 lines (56 loc) · 2.39 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "debian/stretch64"
# Enable NFS access to the disk
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/vagrant/theyworkforyou", :nfs => true
# NFS requires a host-only network
# This also allows you to test via other devices (e.g. mobiles) on the same
# network
config.vm.network :private_network, ip: "10.11.12.13"
# Give the VM a bit more power to speed things up
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
# Provision the vagrant box
config.vm.provision "shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
echo 'deb http://mirror.bytemark.co.uk/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
apt-get update
chown vagrant:vagrant /vagrant
cd /vagrant/theyworkforyou
# Install needed things
apt-get -qq -y install unzip fakeroot git >/dev/null
# mysql and xapian
bin/install-php7-xapian.sh
bin/install-mysql vagrant
# Install the packages from conf/packages
grep -vE "^#" conf/packages | xargs apt-get install -qq -y >/dev/null
# Install webserver
apt-get -qq -y install apache2 libapache2-mod-php >/dev/null
# apache config and modules
cp conf/httpd.vagrant /etc/apache2/sites-enabled/twfy.conf
a2enmod expires rewrite
/etc/init.d/apache2 reload
# NFS woes mean you have to do this - it can't compile FFI inside
mkdir /home/vagrant/bundle
chown vagrant:vagrant /home/vagrant/bundle
ln -sn /home/vagrant/bundle vendor/bundle
su vagrant -c 'bin/install-as-user vagrant 10.11.12.13 /vagrant yes'
su vagrant -c 'bin/deploy.bash'
echo "Your site should now be visible at http://10.11.12.13/"
SHELL
# It's likely the shared folder wasn't available when Apache started.
# So restart Apache again once the machine has started up.
config.vm.provision "shell", run: "always", inline: <<-SHELL
sudo apachectl restart
echo "Your site should now be visible at http://10.11.12.13/"
SHELL
end