fix cron on start, move from nicorn to waitress

This commit is contained in:
Mateusz Gruszczyński 2025-02-24 08:42:51 +01:00
parent 0689e887ea
commit 972e7c61cd
3 changed files with 8 additions and 12 deletions

View File

@ -4,7 +4,8 @@ passlib
paramiko
APScheduler
requests
gunicorn
#gunicorn
flask_wtf
gevent
#croniter
waitress

View File

@ -1,18 +1,14 @@
[Unit]
Description=RouterOS Backup Application
Description=RouterOS Backup Waitress Service
After=network.target
[Service]
#User=www-data # Zmień na odpowiedniego użytkownika
#Group=www-data
User=routeros
Group=routeros
WorkingDirectory=/opt/routeros_backup
Environment="PATH=/opt/hosts_app/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Environment="FLASK_APP=app.py"
Environment="FLASK_ENV=production"
ExecStart=/opt/routeros_backup/venv/bin/gunicorn -c /opt/routeros_backup/gunicorn_config.py --worker-class gevent --keep-alive 10 app:app
ExecStart=/opt/routeros_backup/venv/bin/python3 run_waitress.py
Restart=always
RestartSec=5
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target

View File

@ -4,7 +4,6 @@ import atexit
with app.app_context():
reschedule_jobs()
scheduler.start()
atexit.register(lambda: scheduler.shutdown())
serve(app, host='0.0.0.0', port=5581)
serve(app, host='0.0.0.0', port=5581, ident='', threads=4)