-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
197 lines (170 loc) · 8.97 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Vagrant.configure("2") do |config|
config.vm.define "builder" do |node|
node.vm.provider "virtualbox" do |v|
# TODO: better detect from host system
# - half RAM
# - all CPUs
# "safe" defaults for any modern developer's system
v.memory = ENV.fetch('VM_MEMORY', 4096)
v.cpus = ENV.fetch('VM_CPUS', 4)
v.gui = true
end
node.vm.box = "bento/ubuntu-18.04"
# gdbserver
node.vm.network "forwarded_port", guest: 2000, host: 2000, host_ip: "127.0.0.1"
# mainnet
node.vm.network "forwarded_port", guest: 9797, host: 9797, host_ip: "0.0.0.0"
# mainnet RPC
node.vm.network "forwarded_port", guest: 9796, host: 9796, host_ip: "127.0.0.1", guest_ip: "127.0.0.1"
# testnet
node.vm.network "forwarded_port", guest: 19797, host: 19797, host_ip: "0.0.0.0"
# testnet RPC
node.vm.network "forwarded_port", guest: 19796, host: 19796, host_ip: "127.0.0.1", guest_ip: "127.0.0.1"
node.vm.provision 'libdb4', type: "shell", inline:\
"add-apt-repository ppa:bitcoin/bitcoin;"\
"apt-get update;"\
"apt-get install -y libdb4.8-dev libdb4.8++-dev"
node.vm.provision 'cid', type: "shell", inline:\
"apt-get install -y python3-pip;"\
"/usr/bin/pip3 install -U futoin-cid"
node.vm.provision 'git', type: "shell", inline:\
"apt-get install -y --no-install-recommends git;"\
"sudo -H -u vagrant git config --global user.name '#{`git config --global user.name`}';"\
"sudo -H -u vagrant git config --global user.email '#{`git config --global user.email`}'"
node.vm.provision 'xorg', type: "shell", inline:\
"echo 'nodm nodm/enabled boolean true' | debconf-set-selections;"\
"apt-get install -y --no-install-recommends xorg fluxbox nodm;"
node.vm.provision 'debugger', type: "shell", inline:\
"apt-get install -y gdb gdbserver valgrind;"\
"/usr/bin/pip3 install gdbgui"
node.vm.provision 'bashrc', type: "shell", inline:\
"ensure_bashrc() { grep -q \"$@\" /home/vagrant/.bashrc || (echo \"$@\" >> /home/vagrant/.bashrc )};"\
"ensure_bashrc 'cd /vagrant';"\
"ensure_bashrc 'export DISPLAY=\":0\"';"\
"ensure_bashrc 'export GDBSERVER_COMM=0.0.0.0:2000';"\
"ensure_bashrc 'export GDBGUI_HOST=0.0.0.0';"\
"ensure_bashrc 'export GDBGUI_PORT=2000';"
node.vm.synced_folder(".", "/vagrant",
type: 'virtualbox',
owner: 'vagrant', group: 'vagrant',
create: true
)
VM_ENERGICORE_DATA = ENV.fetch('VM_ENERGICORE_DATA', '../energicore_vagrant_data')
FileUtils.mkdir_p VM_ENERGICORE_DATA
#node.vm.synced_folder(VM_ENERGICORE_DATA, "/home/vagrant/.energicore",
# type: 'virtualbox',
# owner: 'vagrant', group: 'vagrant',
# create: true
#)
end
# Extra APT boxes
#---
({
'debian9' => {
'box' => 'debian/stretch64',
'aptscript' => \
"sed -i -e 's,main$,main non-free contrib,g' /etc/apt/sources.list; "\
"echo 'deb http://deb.debian.org/debian stretch-backports main contrib non-free' > /etc/apt/sources.list.d/backports.list;"\
"apt-get update;"\
"apt-get install -y virtualbox-guest-x11;",
'db4script' => \
"cd /tmp;"\
"wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8_4.8.30-xenial4_amd64.deb;"\
"wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8++_4.8.30-xenial4_amd64.deb;"\
"wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8-dev_4.8.30-xenial4_amd64.deb;"\
"wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8++-dev_4.8.30-xenial4_amd64.deb;"\
"dpkg -i libdb4.8_4.8.30-xenial4_amd64.deb libdb4.8++_4.8.30-xenial4_amd64.deb;"\
"dpkg -i libdb4.8-dev_4.8.30-xenial4_amd64.deb libdb4.8++-dev_4.8.30-xenial4_amd64.deb",
},
}).each { |name, info|
config.vm.define "builder_#{name}" do |node|
node.vm.provider "virtualbox" do |v|
# TODO: better detect from host system
# - half RAM
# - all CPUs
# "safe" defaults for any modern developer's system
v.memory = ENV.fetch('VM_MEMORY', 4096)
v.cpus = ENV.fetch('VM_CPUS', 4)
v.gui = true
end
node.vm.box = info['box']
node.vm.provision 'libdb4', type: "shell", inline: info['db4script']
node.vm.provision 'apt', type: "shell", inline: info['aptscript']
node.vm.provision 'cid', type: "shell", inline:\
"apt-get install -y python3-pip;"\
"/usr/bin/pip3 install -U futoin-cid"
node.vm.provision 'git', type: "shell", inline:\
"apt-get install -y --no-install-recommends git;"\
"sudo -H -u vagrant git config --global user.name '#{`git config --global user.name`}';"\
"sudo -H -u vagrant git config --global user.email '#{`git config --global user.email`}'"
node.vm.provision 'xorg', type: "shell", inline:\
"echo 'nodm nodm/enabled boolean true' | debconf-set-selections;"\
"apt-get install -y --no-install-recommends xorg fluxbox nodm;"
node.vm.provision 'debugger', type: "shell", inline:\
"apt-get install -y gdb gdbserver valgrind;"\
"/usr/bin/pip3 install gdbgui"
node.vm.provision 'bashrc', type: "shell", inline:\
"ensure_bashrc() { grep -q \"$@\" /home/vagrant/.bashrc || (echo \"$@\" >> /home/vagrant/.bashrc )};"\
"ensure_bashrc 'cd /vagrant';"\
"ensure_bashrc 'export DISPLAY=\":0\"';"\
"ensure_bashrc 'export GDBSERVER_COMM=0.0.0.0:2000';"\
"ensure_bashrc 'export GDBGUI_HOST=0.0.0.0';"\
"ensure_bashrc 'export GDBGUI_PORT=2000';"
node.vm.synced_folder(".", "/vagrant",
type: 'virtualbox',
owner: 'vagrant', group: 'vagrant',
create: true
)
end
}
# Extra RPM boxes
#---
({
'centos7' => {
'box' => 'bento/centos-7',
'yumscript' => \
"yum -y install epel-release;",
'db4script' => "",
},
}).each { |name, info|
config.vm.define "builder_#{name}" do |node|
node.vm.provider "virtualbox" do |v|
# TODO: better detect from host system
# - half RAM
# - all CPUs
# "safe" defaults for any modern developer's system
v.memory = ENV.fetch('VM_MEMORY', 4096)
v.cpus = ENV.fetch('VM_CPUS', 4)
v.gui = true
end
node.vm.box = info['box']
node.vm.provision 'libdb4', type: "shell", inline: info['db4script']
node.vm.provision 'yum', type: "shell", inline: info['yumscript']
node.vm.provision 'cid', type: "shell", inline:\
"yum -y install python-pip;"\
"pip install -U futoin-cid"
node.vm.provision 'git', type: "shell", inline:\
"cid tool install git;"\
"sudo -H -u vagrant git config --global user.name '#{`git config --global user.name`}';"\
"sudo -H -u vagrant git config --global user.email '#{`git config --global user.email`}'"
#node.vm.provision 'xorg', type: "shell", inline:\
# "echo 'nodm nodm/enabled boolean true' | debconf-set-selections;"\
# "apt-get install -y --no-install-recommends xorg fluxbox nodm;"
#node.vm.provision 'debugger', type: "shell", inline:\
# "apt-get install -y gdb gdbserver valgrind;"\
# "/usr/bin/pip3 install gdbgui"
node.vm.provision 'bashrc', type: "shell", inline:\
"ensure_bashrc() { grep -q \"$@\" /home/vagrant/.bashrc || (echo \"$@\" >> /home/vagrant/.bashrc )};"\
"ensure_bashrc 'cd /vagrant';"\
"ensure_bashrc 'export DISPLAY=\":0\"';"\
"ensure_bashrc 'export GDBSERVER_COMM=0.0.0.0:2000';"\
"ensure_bashrc 'export GDBGUI_HOST=0.0.0.0';"\
"ensure_bashrc 'export GDBGUI_PORT=2000';"
node.vm.synced_folder(".", "/vagrant",
type: 'virtualbox',
owner: 'vagrant', group: 'vagrant',
create: true
)
end
}
end