Adds gunicorn to run main app

This commit is contained in:
Alan Anselmo 2024-02-07 11:14:12 -03:00
parent f7e0a357ea
commit b91eae630c
4 changed files with 32 additions and 2 deletions

1
.gitignore vendored
View file

@ -39,6 +39,7 @@ var/www/templates/header.html
var/www/submitted var/www/submitted
var/www/server.crt var/www/server.crt
var/www/server.key var/www/server.key
var/www/gunicorn.conf.py
# Local config # Local config
configs/keys configs/keys

View file

@ -40,7 +40,7 @@ ail_logs_syslog_level =
##### Notifications ###### ##### Notifications ######
[Notifications] [Notifications]
ail_domain = https://localhost:7000 ail_domain = http://localhost:7000
sender = sender@example.com sender = sender@example.com
sender_host = smtp.example.com sender_host = smtp.example.com
sender_port = 1337 sender_port = 1337
@ -57,7 +57,7 @@ sender_user =
#Proxying requests to the app #Proxying requests to the app
baseUrl = / baseUrl = /
#Host to bind to #Host to bind to
host = 127.0.0.1 host = 0.0.0.0
#Flask server port #Flask server port
port = 7000 port = 7000
#Number of logs to display in the dashboard #Number of logs to display in the dashboard

27
configs/gunicorn.conf.py Normal file
View file

@ -0,0 +1,27 @@
import os
import sys
sys.path.append('./modules/')
sys.path.append(os.environ['AIL_BIN'])
from lib.ConfigLoader import ConfigLoader
config_loader = ConfigLoader()
try:
host = config_loader.get_config_str("Flask", "host")
except Exception:
host = '0.0.0.0'
try:
port = config_loader.get_config_int("Flask", "port")
except Exception:
port = 7000
bind = f"{host}:{port}"
workers = 2
worker_class = 'sync'
timeout = 180
loglevel = 'info'
limit_request_line = 0

View file

@ -85,6 +85,8 @@ https://github.com/saffsd/langid.py/archive/master.zip
requests requests
# WSGI server to run Flask app
gunicorn==20.1.0
##### Old packages ##### Old packages
# texttable # texttable