This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
/
Vagrantfile
129 lines (111 loc) · 4.37 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
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
# rubocop:disable Metrics/BlockLength
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
# Useful when something bad happens
# vb.gui = true
end
config.vm.define :registry do |node|
node.vm.box = "flavio/opensuse13-2"
node.vm.box_check_update = true
node.vm.hostname = "registry.test.lan"
node.vm.network :private_network, ip: "192.168.1.2", virtualbox__intnet: true
node.vm.network :forwarded_port, host: 44_242, guest: 80
node.vm.provision(
"shell",
path: "examples/development/vagrant/setup_private_network",
args: "192.168.1.2"
)
node.vm.provision "shell", path: "examples/development/vagrant/provision_registry"
node.vm.provision "shell", inline: "echo 192.168.1.2 registry.test.lan >> /etc/hosts"
node.vm.provision "shell", inline: "echo 192.168.1.3 portus.test.lan >> /etc/hosts"
node.vm.provision "shell", inline: <<~CERTIFICATES
mkdir -p /etc/registry
cp /vagrant/examples/development/vagrant/conf/ca_bundle/server.crt /etc/registry/portus.crt
cp /vagrant/examples/development/vagrant/conf/registry-config.yml /etc/registry/config.yml
systemctl enable registry
systemctl restart registry
CERTIFICATES
end
config.vm.define :portus do |node|
node.vm.box = "flavio/opensuse13-2"
node.vm.box_check_update = true
node.vm.hostname = "portus.test.lan"
node.vm.network :private_network, ip: "192.168.1.3", virtualbox__intnet: true
node.vm.network "forwarded_port", guest: 80, host: 5000
node.vm.provision(
"shell",
path: "examples/development/vagrant/setup_private_network",
args: "192.168.1.3"
)
node.vm.provision "shell", inline: "echo 192.168.1.2 registry.test.lan >> /etc/hosts"
node.vm.provision "shell", inline: "echo 192.168.1.3 portus.test.lan >> /etc/hosts"
node.vm.provision "shell", inline: <<~PROVISION
zypper -n in tcpdump
zypper -n in apache2-devel \
gcc \
gcc-c++ \
git-core \
libcurl-devel \
libmysqlclient-devel \
libopenssl-devel \
libstdc++-devel \
libxml2-devel \
libxslt-devel \
make \
mariadb \
nodejs \
patch \
ruby2.1-devel \
rubygem-bundler \
zlib-devel
zypper ar -f http://download.opensuse.org/repositories/devel:/openQA/openSUSE_13.2/ phantomjs
zypper --gpg-auto-import-keys ref
zypper -n in phantomjs
systemctl enable mysql
systemctl start mysql
cd /vagrant
bundle config build.nokogiri --use-system-libraries
bundle install --retry=3
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
sudo gem install passenger -v 5.0.7
passenger-install-apache2-module.ruby2.1 -a
cp /vagrant/examples/development/vagrant/conf/portus/sysconfig_apache2 /etc/sysconfig/apache2
cp /vagrant/examples/development/vagrant/conf/portus/httpd.conf.local /etc/apache2/httpd.conf.local
cp /vagrant/examples/development/vagrant/conf/portus/portus.test.lan.conf /etc/apache2/vhosts.d/
PROVISION
node.vm.provision "shell", inline: <<~APACHE
cd /vagrant
sudo npm install webpack yarn n -g
sudo n latest
# Change path so that latest node binary can be used
PATH=/usr/local/bin:$PATH
yarn install
# run webpack locally on the portus web VM
webpack --watch --config config/webpack.js &
systemctl enable apache2
systemctl start apache2
APACHE
end
config.vm.define :client do |node|
node.vm.box = "flavio/opensuse13-2"
node.vm.box_check_update = true
node.vm.hostname = "client.test.lan"
node.vm.network :private_network, ip: "192.168.1.4", virtualbox__intnet: true
node.vm.provision(
"shell",
path: "examples/development/vagrant/setup_private_network",
args: "192.168.1.4"
)
node.vm.provision "shell", path: "examples/development/vagrant/provision_client"
node.vm.provision "shell", inline: "echo 192.168.1.2 registry.test.lan >> /etc/hosts"
node.vm.provision "shell", inline: "echo 192.168.1.3 portus.test.lan >> /etc/hosts"
end
end
# rubocop:enable Metrics/BlockLength