-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathVagrantfile
69 lines (65 loc) · 2.65 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
vagrant_root = File.dirname(__FILE__)
if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
# if windows ,using host vm
# if linux or macos using docker locally
force_host_vm = true
else
force_host_vm = true
end
DEFAULT_MYSQL_ROOT_PASSWORD='my-secret-pw-Oo'
ENV['VAGRANT_DEFAULT_PROVIDER'] = "docker"
Vagrant.configure("2") do |config|
config.vm.define "mysql" do |mysql|
mysql.vm.provider "docker" do |d|
d.image = "mysql:5.6"
d.name="mysql"
d.force_host_vm = force_host_vm
d.vagrant_vagrantfile="./virtual_env/Vagrantfile.host"
d.env={
'MYSQL_ROOT_PASSWORD' => DEFAULT_MYSQL_ROOT_PASSWORD
'MYSQL_DATABASE' => 'phpipam'
}
end
mysql.vm.synced_folder "./virtual_env/mysql", "/docker-entrypoint-initdb.d/", disabled: false
end
config.vm.define "phpipam" do |phpipam|
phpipam.vm.provider "docker" do |d|
d.image = "pierrecdn/phpipam"
d.name="phpipam"
d.force_host_vm = force_host_vm
d.vagrant_vagrantfile="./virtual_env/Vagrantfile.host"
d.link('mysql:mysql')
d.env={
'MYSQL_ENV_MYSQL_ROOT_PASSWORD: my-secret-pw-Oo' => DEFAULT_MYSQL_ROOT_PASSWORD
}
end
phpipam.vm.synced_folder ".", "/vagrant", disabled: true
end
config.vm.define "nginx" do |nginx|
nginx.vm.provider "docker" do |d|
d.image = "nginx:alpine"
d.name="nginx"
d.force_host_vm = force_host_vm
d.vagrant_vagrantfile="./virtual_env/Vagrantfile.host"
d.link('phpipam:phpipam')
# phpipam does not support nat well in virtualbox ,so we make the nat port number = nginx listtening port
# and in linux virtualbox can not listening a port < 1024 ,so we can not using 80,443 as NAT port
d.ports=['8080:8080','4433:4433']
end
nginx.vm.synced_folder ".", "/vagrant", disabled: true
nginx.vm.synced_folder "./virtual_env/nginx", "/etc/nginx/conf.d", disabled: false
# nginx.vm.synced_folder "nginx/log", "/var/log/nginx", disabled: false
nginx.vm.post_up_message="
========================================================================
config the phpipam env at : http://127.0.0.1:8080 and https://127.0.0.1:4433
the default mysql root pass is : #{DEFAULT_MYSQL_ROOT_PASSWORD}
========================================================================
"
end
end