Skip to content

Commit 499cbe9

Browse files
committed
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.
1 parent 4a4c9ed commit 499cbe9

File tree

5 files changed

+160
-0
lines changed

5 files changed

+160
-0
lines changed

vagrant/Ubuntu-release/Vagrantfile

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
$init = <<SCRIPT
5+
sh -c "echo 'deb http://download.opensuse.org/repositories/home:/liberouter/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/home:liberouter.list"
6+
wget -nv https://download.opensuse.org/repositories/home:liberouter/xUbuntu_16.04/Release.key -O Release.key
7+
sudo apt-key add - < Release.key
8+
apt-get update -y
9+
apt-get upgrade -y
10+
apt-get install -y python3-pip python3-flask
11+
apt-get install -y virtualenv
12+
apt-get install -y apache2 libapache2-mod-wsgi-py3
13+
SCRIPT
14+
15+
$libyang = <<SCRIPT
16+
apt-get install -y libyang-experimental python3-yang-experimental
17+
SCRIPT
18+
19+
$libnetconf2 = <<SCRIPT
20+
apt-get install -y libnetconf2-experimental python3-netconf2-experimental
21+
SCRIPT
22+
23+
$setup = <<SCRIPT
24+
wget https://github.com/CESNET/Netopeer2GUI/releases/download/0.1/ncgui.tgz
25+
tar -xzf ncgui.tgz
26+
cp /home/vagrant/shared/ncgui.conf /etc/apache2/sites-available/
27+
a2enmod rewrite
28+
a2dissite 000-default.conf
29+
a2ensite ncgui.conf
30+
ln -s /home/vagrant/ncgui /var/www/html/ncgui
31+
cd /var/www/html/ncgui/backend
32+
/home/vagrant/shared/setvenv.sh
33+
cp /home/vagrant/shared/lgui-config.ini /var/www/html/ncgui/backend/config.ini
34+
cp /home/vagrant/shared/netopeer-config.ini /var/www/html/ncgui/backend/liberouterapi/modules/netopeer/config.ini
35+
service apache2 restart
36+
SCRIPT
37+
38+
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
39+
Vagrant.configure("2") do |config|
40+
config.vm.provider :virtualbox do |vb|
41+
vb.customize ["modifyvm", :id, "--memory", "1024"]
42+
vb.customize ["modifyvm", :id, "--cpus", "2"]
43+
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
44+
vb.customize ["modifyvm", :id, "--audio", "none"]
45+
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
46+
end
47+
48+
config.vm.define "Netopeer2GUI" do |gui|
49+
gui.vm.synced_folder ".", "/home/vagrant/shared", create: true
50+
gui.vm.box = "ubuntu/xenial64"
51+
gui.vm.network "forwarded_port", host: "8080", guest: "80", auto_correct: true
52+
gui.vm.network "forwarded_port", host: "8443", guest: "443", auto_correct: true
53+
gui.ssh.shell = "sh"
54+
55+
gui.vm.provision :shell, inline: $init
56+
gui.vm.provision :shell, inline: $libyang
57+
gui.vm.provision :shell, inline: $libnetconf2
58+
gui.vm.provision :shell, inline: $setup
59+
end
60+
end
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[api]
2+
; Enable debugging mode
3+
; This sets logging to debug (most verbose) and enables Flask's debugging mode
4+
; DEFAULT: false
5+
debug = true
6+
7+
; Specify host on which to run
8+
; Use only in combination with running API directly as a package. Otherwise this setting is ignored.
9+
; DEFAULT: localhost
10+
;host =
11+
12+
; Specify port on which to run
13+
; Use only in combination with running API directly as a package. Otherwise this setting is ignored.
14+
; DEFAULT: 5555
15+
port = 5555
16+
threaded = true
17+
18+
version = 1.0
19+
modules = /modules
20+
ssl = false
21+
22+
; Authorization Providers
23+
; By default the only authorization provider is the database (defined below)
24+
; Liberouter GUI can utilize other providers using Linux PAM (pluggable authentication modules). If
25+
; you desire such feature just uncomment following line
26+
; DEFAULT: false
27+
;pam = true
28+
29+
; Enable Cross-Origin Resource Sharing
30+
; WARNING: This feature is not recommended due to its security concerns. Try to use proxying in the
31+
; first place.
32+
; DEFAULT: false
33+
;cors = true
34+
35+
; Session Timeout (seconds)
36+
; States how long a session will be valid in seconds
37+
; DEFAULT: 900
38+
;session_timeout = 900
39+
40+
; Max User Session
41+
; Limit number of sessions created by a single unique user
42+
; DEFAULT: 10
43+
;session_max_per_user = 10
44+
45+
[database]
46+
; possible values: sqlite, mysql, mongodb
47+
; sqlite: file must be specified, the server and port are ignored
48+
; mysql: server, port and database must be specified, user and password
49+
; are for authentication to the db
50+
; mongodb: server, port and database must be set
51+
provider = sqlite
52+
users = users
53+
configuration = configuration
54+
55+
[mongodb]
56+
server = localhost
57+
port = 27017
58+
;user =
59+
;password =
60+
database = liberouter
61+
62+
[sqlite]
63+
file = ncgui-users.sq3
64+
65+
[ssl]
66+
;key =
67+
;certificate =

vagrant/Ubuntu-release/ncgui.conf

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<VirtualHost *:80>
2+
ServerAdmin webmaster@localhost
3+
DocumentRoot /var/www/html/ncgui
4+
5+
ErrorLog ${APACHE_LOG_DIR}/error.log
6+
CustomLog ${APACHE_LOG_DIR}/access.log combined
7+
8+
WSGIDaemonProcess libapi threads=5 user=vagrant group=vagrant
9+
WSGIScriptAlias "/libapi" "/var/www/html/ncgui/backend/wsgi.py"
10+
WSGIPassAuthorization on
11+
12+
<directory "/var/www/html/ncgui">
13+
AllowOverride All
14+
</directory>
15+
16+
<directory "/var/www/html/ncgui/backend">
17+
WSGIProcessGroup libapi
18+
WSGIApplicationGroup %{GLOBAL}
19+
WSGIScriptReloading On
20+
21+
AllowOverride All
22+
Require all granted
23+
</directory>
24+
</VirtualHost>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[netopeer]
2+
usersdata_path=/var/www/html/ncgui/data

vagrant/Ubuntu-release/setvenv.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
virtualenv venv --system-site-packages -p python3
3+
source venv/bin/activate
4+
pip3 install --upgrade pip
5+
pip3 install -r requirements.txt
6+
deactivate
7+

0 commit comments

Comments
 (0)