blob: 42685bf4d2d545b0471a36b64d798a8399a684cf [file] [log] [blame]
Radek Krejci2d038092017-11-09 11:08:51 +01001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4$tools = <<SCRIPT
Radek Krejcid7cbe222018-03-08 16:13:13 +01005zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/utilities/openSUSE_Leap_42.3/utilities.repo
6zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_42.3/devel:languages:nodejs.repo
Radek Krejci2d038092017-11-09 11:08:51 +01007zypper refresh
8zypper update -y
9zypper install -y llvm-clang git cmake
10zypper install -y pcre-devel python3-devel swig
Radek Krejcid7cbe222018-03-08 16:13:13 +010011zypper install -y openssl libopenssl-devel libssh-devel
Radek Krejci2d038092017-11-09 11:08:51 +010012zypper install -y libffi-devel npm8 python3-pip python3-Flask
13zypper install -y protobuf-c libev-devel
14SCRIPT
15
16$libyang = <<SCRIPT
17rm -rf libyang
18git clone -b devel https://github.com/CESNET/libyang.git
19cd libyang; mkdir build; cd build
Radek Krejcid837d8c2018-03-28 13:33:58 +020020CC=clang cmake -DGEN_LANGUAGE_BINDINGS=ON .. && make && make install
Radek Krejci2d038092017-11-09 11:08:51 +010021cd ../..
22ldconfig
23SCRIPT
24
25$libnetconf2 = <<SCRIPT
26rm -rf libnetconf2
27git clone -b devel https://github.com/CESNET/libnetconf2.git
28cd libnetconf2; mkdir build; cd build
Radek Krejcid837d8c2018-03-28 13:33:58 +020029CC=clang cmake -DENABLE_PYTHON=ON .. && make && make install
Radek Krejci2d038092017-11-09 11:08:51 +010030cd ../..
31ldconfig
32SCRIPT
33
34$redblack = <<SCRIPT
35rm -rf libredblack
36git clone https://github.com/sysrepo/libredblack.git
37cd libredblack; ./configure && make && make install
38cd ..
39ldconfig
40SCRIPT
41
42$sysrepo = <<SCRIPT
43rm -rf sysrepo
44git clone -b devel https://github.com/sysrepo/sysrepo.git
45cd sysrepo; mkdir build; cd build
Radek Krejcid837d8c2018-03-28 13:33:58 +020046CC=clang cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install
Radek Krejci2d038092017-11-09 11:08:51 +010047cd ../..
48ldconfig
49SCRIPT
50
51$netopeer = <<SCRIPT
52rm -rf Netopeer2
53git clone -b devel-server https://github.com/CESNET/Netopeer2.git
54cd Netopeer2/keystored; mkdir build; cd build
55cmake .. && make && make install
56cd ../../server; mkdir build; cd build
Radek Krejcid837d8c2018-03-28 13:33:58 +020057CC=clang cmake .. && make && make install
Radek Krejci2d038092017-11-09 11:08:51 +010058cd ../../..
Radek Krejcibeacbad2017-11-09 16:39:09 +010059chown -R vagrant:vagrant ./sysrepo/build/repository
Radek Krejci2d038092017-11-09 11:08:51 +010060SCRIPT
61
62$liberoutergui = <<SCRIPT
63rm -rf liberouter-gui
Radek Krejci2bd53d92018-01-05 13:27:53 +010064git clone -b devel https://github.com/CESNET/liberouter-gui.git
Radek Krejci2d038092017-11-09 11:08:51 +010065ln -s /home/vagrant/Netopeer2GUI liberouter-gui/modules/netopeer
66cd liberouter-gui
Radek Krejcie5dd4d02018-01-05 13:22:43 +010067cp -f modules/netopeer/app.config.json modules/
Radek Krejci2d038092017-11-09 11:08:51 +010068python3 ./bootstrap.py
Radek Krejci194f7252018-02-14 08:30:44 +010069pip3 install --upgrade pip
Radek Krejci2d038092017-11-09 11:08:51 +010070pip3 install -r backend/requirements.txt
71cd frontend
72npm install --unsafe-perm -g @angular/cli
73npm install --unsafe-perm
74cd ../..
75SCRIPT
76
77$backend = <<SCRIPT
78cd liberouter-gui
79python3 backend > backend.log 2>&1 &
80cd ..
81SCRIPT
82
83$frontend = <<SCRIPT
84cd liberouter-gui/frontend
Radek Krejci2b1d9c32018-02-08 16:35:59 +010085/usr/local/bin/ng serve --preserve-symlinks --host 0.0.0.0 --proxy proxy.json > ../frontend.log 2>&1 &
Radek Krejci2d038092017-11-09 11:08:51 +010086cd ../..
87SCRIPT
88
89$netconf = <<SCRIPT
Radek Krejciac633062017-11-09 14:31:21 +010090/usr/local/bin/sysrepod -d > sysrepod.log 2>&1 &
91/home/vagrant/sysrepo/build/examples/application_example turing-machine > turing-machine.log 2>&1 &
92/usr/local/bin/netopeer2-server -d > netopeer2.log 2>&1 &
Radek Krejci2d038092017-11-09 11:08:51 +010093SCRIPT
94
Radek Krejcicc0db762018-06-13 11:22:57 +020095# uncomment the following line for vagrant < 2.0.0
96# Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
Radek Krejci2d038092017-11-09 11:08:51 +010097Vagrant.configure("2") do |config|
98 config.vm.provider :virtualbox do |vb|
Radek Krejci4ac72392018-02-09 16:03:57 +010099 vb.customize ["modifyvm", :id, "--memory", "2048"]
100 vb.customize ["modifyvm", :id, "--cpus", "2"]
Radek Krejci2d038092017-11-09 11:08:51 +0100101 vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
102 vb.customize ["modifyvm", :id, "--audio", "none"]
103 vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
104 end
105
106 config.vm.define "Netopeer2GUI" do |gui|
107 gui.vm.synced_folder "../../", "/home/vagrant/Netopeer2GUI", create: true
Radek Krejcid7cbe222018-03-08 16:13:13 +0100108 gui.vm.box = "opensuse/openSUSE-42.3-x86_64"
Radek Krejci2d038092017-11-09 11:08:51 +0100109 gui.vm.network "forwarded_port", host: "4200", guest: "4200", auto_correct: true
Radek Krejcie95c3502018-01-11 11:31:36 +0100110 gui.vm.network "forwarded_port", host: "8830", host_ip: "127.0.0.1", guest: "830", auto_correct: true
Radek Krejci2d038092017-11-09 11:08:51 +0100111 gui.ssh.shell = "sh"
112
113 gui.vm.provision :shell, inline: $tools
114 gui.vm.provision :shell, inline: $libyang
115 gui.vm.provision :shell, inline: $libnetconf2
116 gui.vm.provision :shell, inline: $redblack
117 gui.vm.provision :shell, inline: $sysrepo
118 gui.vm.provision :shell, inline: $netopeer
119 gui.vm.provision :shell, inline: $liberoutergui
120 gui.vm.provision :shell, inline: $netconf, run: "always"
121 gui.vm.provision :shell, inline: $backend, run: "always"
122 gui.vm.provision :shell, inline: $frontend, run: "always"
123 end
124end