Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | $tools = <<SCRIPT |
Radek Krejci | d7cbe22 | 2018-03-08 16:13:13 +0100 | [diff] [blame] | 5 | zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/utilities/openSUSE_Leap_42.3/utilities.repo |
| 6 | zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_42.3/devel:languages:nodejs.repo |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 7 | zypper refresh |
| 8 | zypper update -y |
| 9 | zypper install -y llvm-clang git cmake |
| 10 | zypper install -y pcre-devel python3-devel swig |
Radek Krejci | d7cbe22 | 2018-03-08 16:13:13 +0100 | [diff] [blame] | 11 | zypper install -y openssl libopenssl-devel libssh-devel |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 12 | zypper install -y libffi-devel npm8 python3-pip python3-Flask |
| 13 | zypper install -y protobuf-c libev-devel |
| 14 | SCRIPT |
| 15 | |
| 16 | $libyang = <<SCRIPT |
| 17 | rm -rf libyang |
| 18 | git clone -b devel https://github.com/CESNET/libyang.git |
| 19 | cd libyang; mkdir build; cd build |
Radek Krejci | d837d8c | 2018-03-28 13:33:58 +0200 | [diff] [blame] | 20 | CC=clang cmake -DGEN_LANGUAGE_BINDINGS=ON .. && make && make install |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 21 | cd ../.. |
| 22 | ldconfig |
| 23 | SCRIPT |
| 24 | |
| 25 | $libnetconf2 = <<SCRIPT |
| 26 | rm -rf libnetconf2 |
| 27 | git clone -b devel https://github.com/CESNET/libnetconf2.git |
| 28 | cd libnetconf2; mkdir build; cd build |
Radek Krejci | d837d8c | 2018-03-28 13:33:58 +0200 | [diff] [blame] | 29 | CC=clang cmake -DENABLE_PYTHON=ON .. && make && make install |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 30 | cd ../.. |
| 31 | ldconfig |
| 32 | SCRIPT |
| 33 | |
| 34 | $redblack = <<SCRIPT |
| 35 | rm -rf libredblack |
| 36 | git clone https://github.com/sysrepo/libredblack.git |
| 37 | cd libredblack; ./configure && make && make install |
| 38 | cd .. |
| 39 | ldconfig |
| 40 | SCRIPT |
| 41 | |
| 42 | $sysrepo = <<SCRIPT |
| 43 | rm -rf sysrepo |
| 44 | git clone -b devel https://github.com/sysrepo/sysrepo.git |
| 45 | cd sysrepo; mkdir build; cd build |
Radek Krejci | d837d8c | 2018-03-28 13:33:58 +0200 | [diff] [blame] | 46 | CC=clang cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 47 | cd ../.. |
| 48 | ldconfig |
| 49 | SCRIPT |
| 50 | |
| 51 | $netopeer = <<SCRIPT |
| 52 | rm -rf Netopeer2 |
| 53 | git clone -b devel-server https://github.com/CESNET/Netopeer2.git |
| 54 | cd Netopeer2/keystored; mkdir build; cd build |
| 55 | cmake .. && make && make install |
| 56 | cd ../../server; mkdir build; cd build |
Radek Krejci | d837d8c | 2018-03-28 13:33:58 +0200 | [diff] [blame] | 57 | CC=clang cmake .. && make && make install |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 58 | cd ../../.. |
Radek Krejci | beacbad | 2017-11-09 16:39:09 +0100 | [diff] [blame] | 59 | chown -R vagrant:vagrant ./sysrepo/build/repository |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 60 | SCRIPT |
| 61 | |
| 62 | $liberoutergui = <<SCRIPT |
| 63 | rm -rf liberouter-gui |
Radek Krejci | 2bd53d9 | 2018-01-05 13:27:53 +0100 | [diff] [blame] | 64 | git clone -b devel https://github.com/CESNET/liberouter-gui.git |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 65 | ln -s /home/vagrant/Netopeer2GUI liberouter-gui/modules/netopeer |
| 66 | cd liberouter-gui |
Radek Krejci | e5dd4d0 | 2018-01-05 13:22:43 +0100 | [diff] [blame] | 67 | cp -f modules/netopeer/app.config.json modules/ |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 68 | python3 ./bootstrap.py |
Radek Krejci | 194f725 | 2018-02-14 08:30:44 +0100 | [diff] [blame] | 69 | pip3 install --upgrade pip |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 70 | pip3 install -r backend/requirements.txt |
| 71 | cd frontend |
| 72 | npm install --unsafe-perm -g @angular/cli |
| 73 | npm install --unsafe-perm |
| 74 | cd ../.. |
| 75 | SCRIPT |
| 76 | |
| 77 | $backend = <<SCRIPT |
| 78 | cd liberouter-gui |
| 79 | python3 backend > backend.log 2>&1 & |
| 80 | cd .. |
| 81 | SCRIPT |
| 82 | |
| 83 | $frontend = <<SCRIPT |
| 84 | cd liberouter-gui/frontend |
Radek Krejci | 2b1d9c3 | 2018-02-08 16:35:59 +0100 | [diff] [blame] | 85 | /usr/local/bin/ng serve --preserve-symlinks --host 0.0.0.0 --proxy proxy.json > ../frontend.log 2>&1 & |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 86 | cd ../.. |
| 87 | SCRIPT |
| 88 | |
| 89 | $netconf = <<SCRIPT |
Radek Krejci | ac63306 | 2017-11-09 14:31:21 +0100 | [diff] [blame] | 90 | /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 Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 93 | SCRIPT |
| 94 | |
Radek Krejci | cc0db76 | 2018-06-13 11:22:57 +0200 | [diff] [blame^] | 95 | # uncomment the following line for vagrant < 2.0.0 |
| 96 | # Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com') |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 97 | Vagrant.configure("2") do |config| |
| 98 | config.vm.provider :virtualbox do |vb| |
Radek Krejci | 4ac7239 | 2018-02-09 16:03:57 +0100 | [diff] [blame] | 99 | vb.customize ["modifyvm", :id, "--memory", "2048"] |
| 100 | vb.customize ["modifyvm", :id, "--cpus", "2"] |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 101 | 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 Krejci | d7cbe22 | 2018-03-08 16:13:13 +0100 | [diff] [blame] | 108 | gui.vm.box = "opensuse/openSUSE-42.3-x86_64" |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 109 | gui.vm.network "forwarded_port", host: "4200", guest: "4200", auto_correct: true |
Radek Krejci | e95c350 | 2018-01-11 11:31:36 +0100 | [diff] [blame] | 110 | gui.vm.network "forwarded_port", host: "8830", host_ip: "127.0.0.1", guest: "830", auto_correct: true |
Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame] | 111 | 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 |
| 124 | end |