vagrant FEATURE release version of Ubuntu vagrant image
Contains Netopeer2GUI installed from packages - no source compilation
or running Angular server. libyang and libnetconf2 are installed from
binary packages, Netopeer2GUI backend and frontend are doployed as
Apache2 WSGI script. This is how it is supposed to be deployed in a
production way.
diff --git a/vagrant/Ubuntu-release/Vagrantfile b/vagrant/Ubuntu-release/Vagrantfile
new file mode 100644
index 0000000..613c51f
--- /dev/null
+++ b/vagrant/Ubuntu-release/Vagrantfile
@@ -0,0 +1,60 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+$init = <<SCRIPT
+sh -c "echo 'deb http://download.opensuse.org/repositories/home:/liberouter/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/home:liberouter.list"
+wget -nv https://download.opensuse.org/repositories/home:liberouter/xUbuntu_16.04/Release.key -O Release.key
+sudo apt-key add - < Release.key
+apt-get update -y
+apt-get upgrade -y
+apt-get install -y python3-pip python3-flask
+apt-get install -y virtualenv
+apt-get install -y apache2 libapache2-mod-wsgi-py3
+SCRIPT
+
+$libyang = <<SCRIPT
+apt-get install -y libyang-experimental python3-yang-experimental
+SCRIPT
+
+$libnetconf2 = <<SCRIPT
+apt-get install -y libnetconf2-experimental python3-netconf2-experimental
+SCRIPT
+
+$setup = <<SCRIPT
+wget https://github.com/CESNET/Netopeer2GUI/releases/download/0.1/ncgui.tgz
+tar -xzf ncgui.tgz
+cp /home/vagrant/shared/ncgui.conf /etc/apache2/sites-available/
+a2enmod rewrite
+a2dissite 000-default.conf
+a2ensite ncgui.conf
+ln -s /home/vagrant/ncgui /var/www/html/ncgui
+cd /var/www/html/ncgui/backend
+/home/vagrant/shared/setvenv.sh
+cp /home/vagrant/shared/lgui-config.ini /var/www/html/ncgui/backend/config.ini
+cp /home/vagrant/shared/netopeer-config.ini /var/www/html/ncgui/backend/liberouterapi/modules/netopeer/config.ini
+service apache2 restart
+SCRIPT
+
+Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
+Vagrant.configure("2") do |config|
+ config.vm.provider :virtualbox do |vb|
+ vb.customize ["modifyvm", :id, "--memory", "1024"]
+ vb.customize ["modifyvm", :id, "--cpus", "2"]
+ vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
+ vb.customize ["modifyvm", :id, "--audio", "none"]
+ vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
+ end
+
+ config.vm.define "Netopeer2GUI" do |gui|
+ gui.vm.synced_folder ".", "/home/vagrant/shared", create: true
+ gui.vm.box = "ubuntu/xenial64"
+ gui.vm.network "forwarded_port", host: "8080", guest: "80", auto_correct: true
+ gui.vm.network "forwarded_port", host: "8443", guest: "443", auto_correct: true
+ gui.ssh.shell = "sh"
+
+ gui.vm.provision :shell, inline: $init
+ gui.vm.provision :shell, inline: $libyang
+ gui.vm.provision :shell, inline: $libnetconf2
+ gui.vm.provision :shell, inline: $setup
+ end
+end
diff --git a/vagrant/Ubuntu-release/lgui-config.ini b/vagrant/Ubuntu-release/lgui-config.ini
new file mode 100644
index 0000000..780d58c
--- /dev/null
+++ b/vagrant/Ubuntu-release/lgui-config.ini
@@ -0,0 +1,67 @@
+[api]
+; Enable debugging mode
+; This sets logging to debug (most verbose) and enables Flask's debugging mode
+; DEFAULT: false
+debug = true
+
+; Specify host on which to run
+; Use only in combination with running API directly as a package. Otherwise this setting is ignored.
+; DEFAULT: localhost
+;host =
+
+; Specify port on which to run
+; Use only in combination with running API directly as a package. Otherwise this setting is ignored.
+; DEFAULT: 5555
+port = 5555
+threaded = true
+
+version = 1.0
+modules = /modules
+ssl = false
+
+; Authorization Providers
+; By default the only authorization provider is the database (defined below)
+; Liberouter GUI can utilize other providers using Linux PAM (pluggable authentication modules). If
+; you desire such feature just uncomment following line
+; DEFAULT: false
+;pam = true
+
+; Enable Cross-Origin Resource Sharing
+; WARNING: This feature is not recommended due to its security concerns. Try to use proxying in the
+; first place.
+; DEFAULT: false
+;cors = true
+
+; Session Timeout (seconds)
+; States how long a session will be valid in seconds
+; DEFAULT: 900
+;session_timeout = 900
+
+; Max User Session
+; Limit number of sessions created by a single unique user
+; DEFAULT: 10
+;session_max_per_user = 10
+
+[database]
+; possible values: sqlite, mysql, mongodb
+; sqlite: file must be specified, the server and port are ignored
+; mysql: server, port and database must be specified, user and password
+; are for authentication to the db
+; mongodb: server, port and database must be set
+provider = sqlite
+users = users
+configuration = configuration
+
+[mongodb]
+server = localhost
+port = 27017
+;user =
+;password =
+database = liberouter
+
+[sqlite]
+file = ncgui-users.sq3
+
+[ssl]
+;key =
+;certificate =
diff --git a/vagrant/Ubuntu-release/ncgui.conf b/vagrant/Ubuntu-release/ncgui.conf
new file mode 100644
index 0000000..10c499c
--- /dev/null
+++ b/vagrant/Ubuntu-release/ncgui.conf
@@ -0,0 +1,24 @@
+<VirtualHost *:80>
+ ServerAdmin webmaster@localhost
+ DocumentRoot /var/www/html/ncgui
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ WSGIDaemonProcess libapi threads=5 user=vagrant group=vagrant
+ WSGIScriptAlias "/libapi" "/var/www/html/ncgui/backend/wsgi.py"
+ WSGIPassAuthorization on
+
+ <directory "/var/www/html/ncgui">
+ AllowOverride All
+ </directory>
+
+ <directory "/var/www/html/ncgui/backend">
+ WSGIProcessGroup libapi
+ WSGIApplicationGroup %{GLOBAL}
+ WSGIScriptReloading On
+
+ AllowOverride All
+ Require all granted
+ </directory>
+</VirtualHost>
diff --git a/vagrant/Ubuntu-release/netopeer-config.ini b/vagrant/Ubuntu-release/netopeer-config.ini
new file mode 100644
index 0000000..c3ba0ae
--- /dev/null
+++ b/vagrant/Ubuntu-release/netopeer-config.ini
@@ -0,0 +1,2 @@
+[netopeer]
+usersdata_path=/var/www/html/ncgui/data
diff --git a/vagrant/Ubuntu-release/setvenv.sh b/vagrant/Ubuntu-release/setvenv.sh
new file mode 100755
index 0000000..7d1fe11
--- /dev/null
+++ b/vagrant/Ubuntu-release/setvenv.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+virtualenv venv --system-site-packages -p python3
+source venv/bin/activate
+pip3 install --upgrade pip
+pip3 install -r requirements.txt
+deactivate
+