fix systemd autostart of uwsgi
This commit is contained in:
parent
8c6656191d
commit
5c10cdaa08
16
README.md
16
README.md
|
@ -2,7 +2,6 @@
|
||||||
Python RESTful API for managing a grid of vm slaves
|
Python RESTful API for managing a grid of vm slaves
|
||||||
|
|
||||||
##Installation instructions:
|
##Installation instructions:
|
||||||
```
|
|
||||||
1. virtualenv -p python3 appserver
|
1. virtualenv -p python3 appserver
|
||||||
2. source appserver/bin/activate
|
2. source appserver/bin/activate
|
||||||
3. cd appserver
|
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:
|
7. create nginx vhost and configuration file via the provided template files:
|
||||||
- config.ini.dist
|
- config.ini.dist
|
||||||
- nginx_example_vhost.txt
|
- 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
|
iptables -A tcp_inbound -p TCP --match multiport --dports 7000:9999 -j ACCEPT #vnc range
|
||||||
9. apt install letsencrypt
|
2. apt install letsencrypt
|
||||||
10. generate letsencrypt cert using letsencrypt tool and add
|
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
|
00 00 1 * * root /etc/init.d/nginx stop && letsencrypt renew && /etc/init.d/nginx start
|
||||||
to /etc/crontab
|
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:
|
##Proxmox slave install instructions:
|
||||||
1. Datacenter -> Permissions -> Add -> User Permission
|
1. Datacenter -> Permissions -> Add -> User Permission
|
||||||
2. Path: / User: masteradmin@pve / Role: Administrator
|
2. Path: / User: masteradmin@pve / Role: Administrator
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
|
home = /home/master/appserver
|
||||||
|
chdir = /home/master/appserver/proxmaster
|
||||||
|
uid = master
|
||||||
|
gid = master
|
||||||
socket = 127.0.0.1:5117
|
socket = 127.0.0.1:5117
|
||||||
workers = 3
|
workers = 20
|
||||||
|
processes = 10
|
||||||
|
master = true
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
logfile = log/proxmaster.log
|
logfile = log/proxmaster.log
|
||||||
|
log-maxsize = 100000
|
||||||
|
|
||||||
adminuser = masteradmin@pve
|
adminuser = masteradmin@pve
|
||||||
apipass = sakdlsadas
|
apipass = sakdlsadas
|
||||||
vmid_min = 1000
|
vmid_min = 1000
|
||||||
|
|
|
@ -6,9 +6,7 @@ After=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=master
|
User=master
|
||||||
Type=forking
|
ExecStart=/home/master/appserver/bin/uwsgi --logdate --ini /home/master/appserver/proxmaster/config.ini
|
||||||
ExecStart=/home/master/proxmaster/start.sh
|
|
||||||
#ExecStop=
|
|
||||||
TimeoutSec=30
|
TimeoutSec=30
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
|
20
start.sh
20
start.sh
|
@ -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
|
|
Loading…
Reference in a new issue