diff --git a/requirements.txt b/requirements.txt index 4c50e6c..3bbd513 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,8 @@ passlib paramiko APScheduler requests -gunicorn +#gunicorn flask_wtf gevent #croniter +waitress \ No newline at end of file diff --git a/routeros_backup.service b/routeros_backup.service index 9b07e3c..943914f 100644 --- a/routeros_backup.service +++ b/routeros_backup.service @@ -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 diff --git a/run_waitress.py b/run_waitress.py index b520293..e49a628 100644 --- a/run_waitress.py +++ b/run_waitress.py @@ -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)