-
Notifications
You must be signed in to change notification settings - Fork 23
/
Vagrantfile
98 lines (78 loc) · 2.62 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
89
90
91
92
93
94
95
96
97
98
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
BRANCH = ENV['BRANCH'] || 'master'
ANDINO_VERSION = ENV['ANDINO_VERSION'] || 'latest'
INSTALL_DEPENDENCIES = true
INSTALL_APP = true
UPDATE_APP = false
COMPOSE_VERSION = "1.21.0"
VERSION_MATRIX = {
"min" => {
"docker.io" => "1.13.1-0ubuntu1~16.04.2",
"docker-ce" => "17.06.2~ce-0~ubuntu",
},
"max" => {
"docker.io" => "1.13.1-0ubuntu1~16.04.2",
"docker-ce": "17.12.0~ce-0~ubuntu",
}
}
VERSION = "min"
DOCKER_PKG = "docker-ce"
DOCKER_VERSION = VERSION_MATRIX[VERSION][DOCKER_PKG]
IP = "192.168.23.10"
CACHE_IP = "192.168.23.11"
$script_install = <<SCRIPT
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install -y #{DOCKER_PKG}=#{DOCKER_VERSION}
sudo su -c "curl -L https://github.com/docker/compose/releases/download/#{COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
sudo chmod +x /usr/local/bin/docker-compose
SCRIPT
$script = <<SCRIPT
sudo -E python ./install.py --error_email admin@example.com \
--site_host #{IP} \
--database_user db_user \
--database_password db_pass \
--datastore_user data_db_user \
--datastore_password data_db_pass \
--branch #{BRANCH} \
--andino_version #{ANDINO_VERSION} \
--nginx-extended-cache \
--nginx-cache-max-size 2g \
--nginx-cache-inactive 120m \
--timezone America/Argentina/Cordoba
SCRIPT
$update = <<SCRIPT
sudo -E python ./update.py --branch #{BRANCH} --andino_version #{ANDINO_VERSION}
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.define "cache" do |cache|
cache.vm.network "private_network", ip: CACHE_IP
end
config.vm.define "andino" do |web|
web.vm.network "private_network", ip: IP
config.vm.provision "file", source: "install/install.py", destination: "install.py"
config.vm.provision "file", source: "install/update.py", destination: "update.py"
if INSTALL_DEPENDENCIES
config.vm.provision "shell", inline: $script_install
end
if INSTALL_APP
config.vm.provision "shell", inline: $script
end
if UPDATE_APP
config.vm.provision "shell", inline: $update
end
end
end