Skip to content

Commit 60d9c31

Browse files
committed
vagrant CHANGE reflect changes for deployment in vagrant image
Due to recent changes connected with socket.io, it is necessary to modify deployment - backend must run as a separate server instead of Apache's WSGI module.
1 parent 39cce67 commit 60d9c31

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

vagrant/Ubuntu-release/Vagrantfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ apt-get install -y libnetconf2-experimental python3-netconf2-experimental
2121
SCRIPT
2222

2323
$setup = <<SCRIPT
24-
wget https://github.com/CESNET/Netopeer2GUI/releases/download/0.1/ncgui.tgz
24+
wget https://github.com/CESNET/Netopeer2GUI/releases/download/0.2/ncgui.tgz
2525
tar -xzf ncgui.tgz
2626
cp /home/vagrant/shared/ncgui.conf /etc/apache2/sites-available/
2727
a2enmod rewrite
28+
a2enmod proxy_http
2829
a2dissite 000-default.conf
2930
a2ensite ncgui.conf
3031
ln -s /home/vagrant/ncgui /var/www/html/ncgui
32+
mkdir /var/www/html/ncgui/data
3133
cd /var/www/html/ncgui/backend
3234
/home/vagrant/shared/setvenv.sh
3335
cp /home/vagrant/shared/lgui-config.ini /var/www/html/ncgui/backend/config.ini
3436
cp /home/vagrant/shared/netopeer-config.ini /var/www/html/ncgui/backend/liberouterapi/modules/netopeer/config.ini
37+
cp /home/vagrant/shared/run.sh /var/www/html/ncgui/backend/run.sh
38+
cp /home/vagrant/shared/ncgui.service /etc/systemd/system/ncgui.service
39+
systemctl enable ncgui.service
40+
service ncgui start
3541
service apache2 restart
3642
SCRIPT
3743

vagrant/Ubuntu-release/lgui-config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ port = 27017
6060
database = liberouter
6161

6262
[sqlite]
63-
file = ncgui-users.sq3
63+
file = /var/www/html/ncgui/data/ncgui-users.sq3
6464

6565
[ssl]
6666
;key =

vagrant/Ubuntu-release/ncgui.conf

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@
55
ErrorLog ${APACHE_LOG_DIR}/error.log
66
CustomLog ${APACHE_LOG_DIR}/access.log combined
77

8-
WSGIDaemonProcess libapi threads=5 user=vagrant group=vagrant
9-
WSGIScriptAlias "/libapi" "/var/www/html/ncgui/backend/wsgi.py"
10-
WSGIPassAuthorization on
8+
RewriteEngine on
9+
RewriteRule ^/libapi(.*) http://[::1]:5555$1 [P]
10+
11+
RewriteCond %{QUERY_STRING} transport=polling [NC]
12+
RewriteRule /(.*) http://[::1]:5555/$1 [P]
13+
14+
RewriteCond %{HTTP:Upgrade} websocket [NC]
15+
RewriteRule /(.*) ws://[::1]:5555/$1 [P]
1116

1217
<directory "/var/www/html/ncgui">
1318
AllowOverride All
14-
</directory>
19+
Options -Indexes
1520

16-
<directory "/var/www/html/ncgui/backend">
17-
WSGIProcessGroup libapi
18-
WSGIApplicationGroup %{GLOBAL}
19-
WSGIScriptReloading On
20-
21-
AllowOverride All
22-
Require all granted
21+
RewriteCond %{REQUEST_FILENAME} -f [OR]
22+
RewriteCond %{REQUEST_FILENAME} -l [OR]
23+
RewriteCond %{REQUEST_FILENAME} -d
24+
RewriteRule ^.*$ - [L]
25+
RewriteRule ^.* /index.html [L]
2326
</directory>
2427
</VirtualHost>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Netopeer2GUI backend
3+
4+
[Service]
5+
Type=oneshot
6+
ExecStart=/var/www/html/ncgui/backend/run.sh
7+
RemainAfterExit=true
8+
StandardOutput=syslog
9+
StandardError=syslog
10+
11+
[Install]
12+
WantedBy=multi-user.target

vagrant/Ubuntu-release/run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
source /var/www/html/ncgui/backend/venv/bin/activate
3+
python3 /var/www/html/ncgui/backend/ &
4+
deactivate
5+

0 commit comments

Comments
 (0)