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 paramiko
APScheduler APScheduler
requests requests
gunicorn #gunicorn
flask_wtf flask_wtf
gevent gevent
#croniter #croniter
waitress

View File

@ -1,18 +1,14 @@
[Unit] [Unit]
Description=RouterOS Backup Application Description=RouterOS Backup Waitress Service
After=network.target After=network.target
[Service] [Service]
#User=www-data # Zmień na odpowiedniego użytkownika User=routeros
#Group=www-data Group=routeros
WorkingDirectory=/opt/routeros_backup WorkingDirectory=/opt/routeros_backup
Environment="PATH=/opt/hosts_app/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ExecStart=/opt/routeros_backup/venv/bin/python3 run_waitress.py
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
Restart=always Restart=always
RestartSec=5 Environment=PYTHONUNBUFFERED=1
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -4,7 +4,6 @@ import atexit
with app.app_context(): with app.app_context():
reschedule_jobs() reschedule_jobs()
scheduler.start()
atexit.register(lambda: scheduler.shutdown()) 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)