-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
153 lines (127 loc) · 5.03 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
STATIC_IP_TEMPLATE = "172.32.129.10%d"
Vagrant.configure("2") do |config|
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.vm.define 'gluu-main' do |config|
# config.vm.box = 'fgrehm/trusty64-lxc'
# config.vm.box = 'developerinlondon/ubuntu_lxc_xenial_x64'
config.vm.box = 'generic/ubuntu1604'
config.vm.network "private_network", ip: STATIC_IP_TEMPLATE % 2
config.vm.hostname = 'gluu-main'
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get -y install python apt-transport-https
SHELL
config.vm.provider "libvirt" do |v|
v.cpus = 2
v.memory = 2048
v.driver = "qemu"
end
config.vm.provider "virtualbox" do |v|
v.cpus = 2
v.memory = 2048
end
end
config.vm.define 'gluu-consumer' do |config|
# config.vm.box = 'fgrehm/trusty64-lxc'
# config.vm.box = 'developerinlondon/ubuntu_lxc_xenial_x64'
config.vm.box = 'generic/ubuntu1604'
config.vm.network "private_network", ip: STATIC_IP_TEMPLATE % 3
config.vm.hostname = 'gluu-consumer'
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get -y install python apt-transport-https
SHELL
config.vm.provider "libvirt" do |v|
v.cpus = 2
v.memory = 2048
v.driver = "qemu"
end
config.vm.provider "virtualbox" do |v|
v.cpus = 2
v.memory = 2048
end
end
config.vm.define 'gluu-nginx' do |config|
# config.vm.box = 'fgrehm/trusty64-lxc'
# config.vm.box = 'developerinlondon/ubuntu_lxc_xenial_x64'
config.vm.box = 'generic/ubuntu1604'
config.vm.network "private_network", ip: STATIC_IP_TEMPLATE % 1
config.vm.hostname = 'gluu-nginx'
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get -y install python apt-transport-https nginx
mkdir -p /etc/gluu
if [ ! -f "/etc/gluu/gluu-nginx.key" ]; then
echo "[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=CA
ST=Quebec
L=Montreal
O=Test
emailAddress=gluu@test
CN = gluu-nginx
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = gluu-nginx" > /etc/gluu/config.txt
openssl genrsa -out /etc/gluu/gluu-nginx.key 2048
openssl req -new -out /etc/gluu/gluu-nginx.csr -key /etc/gluu/gluu-nginx.key -config /etc/gluu/config.txt
openssl x509 -req -days 3650 -in /etc/gluu/gluu-nginx.csr -signkey /etc/gluu/gluu-nginx.key -out /etc/gluu/gluu-nginx.crt -extfile /etc/gluu/config.txt
fi
echo "
upstream gluu_oxtrust {
ip_hash;
server gluu-main:443;
}
upstream gluu_oxauth {
ip_hash;
server gluu-consumer:443;
}
server {
listen 80;
listen [::]:80;
server_name gluu-nginx;
return 301 https://gluu-nginx$request_uri;
}
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name gluu-nginx;
ssl on;
ssl_certificate /etc/gluu/gluu-nginx.crt;
ssl_certificate_key /etc/gluu/gluu-nginx.key;
location ~ ^(/)$ {
proxy_pass https://gluu_oxtrust;
}
location /identity/ {
proxy_pass https://gluu_oxtrust;
}
location /oxauth/ {
proxy_pass https://gluu_oxauth;
}
location /.well-known/ {
proxy_pass https://gluu_oxauth;
}
}" > /etc/nginx/sites-available/gluu-load-balancer
rm -f /etc/nginx/sites-enabled/gluu-load-balancer
ln -s /etc/nginx/sites-available/gluu-load-balancer /etc/nginx/sites-enabled/gluu-load-balancer
service nginx restart
SHELL
config.vm.provider "libvirt" do |v|
v.memory = 512
v.driver = "qemu"
end
config.vm.provider "virtualbox" do |v|
v.memory = 512
end
end
end