fix systemd autostart of uwsgi

This commit is contained in:
deflax 2018-03-11 02:39:02 +02:00
parent 8c6656191d
commit 5c10cdaa08
4 changed files with 16 additions and 34 deletions

View file

@ -2,7 +2,6 @@
Python RESTful API for managing a grid of vm slaves
##Installation instructions:
```
1. virtualenv -p python3 appserver
2. source appserver/bin/activate
3. cd appserver
@ -12,20 +11,17 @@ Python RESTful API for managing a grid of vm slaves
7. create nginx vhost and configuration file via the provided template files:
- config.ini.dist
- nginx_example_vhost.txt
8. cp proxmaster.service /etc/systemd/system/proxmaster.service ; systemctl enable proxmaster.service
8. make sure this iptables rule is included:
##Security
1. make sure this iptables rule is included:
iptables -A tcp_inbound -p TCP --match multiport --dports 7000:9999 -j ACCEPT #vnc range
9. apt install letsencrypt
10. generate letsencrypt cert using letsencrypt tool and add
2. apt install letsencrypt
3. generate letsencrypt cert using letsencrypt tool and add
00 00 1 * * root /etc/init.d/nginx stop && letsencrypt renew && /etc/init.d/nginx start
to /etc/crontab
11. chmod 705 /etc/letsencrypt/archive ; chmod 705 /etc/letsencrypt/live
4. chmod 705 /etc/letsencrypt/archive ; chmod 705 /etc/letsencrypt/live
start:
1. crontab -e
2. @ reboot /usr/bin/screen -dmS proxmaster /home/master/proxmaster/start.sh
```
##Proxmox slave install instructions:
1. Datacenter -> Permissions -> Add -> User Permission
2. Path: / User: masteradmin@pve / Role: Administrator

View file

@ -1,9 +1,17 @@
[uwsgi]
home = /home/master/appserver
chdir = /home/master/appserver/proxmaster
uid = master
gid = master
socket = 127.0.0.1:5117
workers = 3
workers = 20
processes = 10
master = true
[general]
logfile = log/proxmaster.log
log-maxsize = 100000
adminuser = masteradmin@pve
apipass = sakdlsadas
vmid_min = 1000

View file

@ -6,9 +6,7 @@ After=network-online.target
[Service]
User=master
Type=forking
ExecStart=/home/master/proxmaster/start.sh
#ExecStop=
ExecStart=/home/master/appserver/bin/uwsgi --logdate --ini /home/master/appserver/proxmaster/config.ini
TimeoutSec=30
Restart=on-failure
RestartSec=30

View file

@ -1,20 +0,0 @@
#!/bin/bash
# Log rotation
DIR=${HOME}/proxmaster
LOG_FILE="${DIR}/log/proxmaster.log"
mkdir -p $DIR/log
TIME=`date -u +%s`
if [ -e $LOG_FILE ] ; then
mv ${LOG_FILE} ${LOG_FILE}.${TIME} && touch ${LOG_FILE}
else
touch ${LOG_FILE}
fi
cd $DIR
#startuwsgi instance
uwsgi --logdate --daemonize log/uwsgi.log --ini config.ini