diff --git a/webapp/ftth-ipe-map.service b/webapp/ftth-ipe-map.service new file mode 100644 index 0000000..a18f5ea --- /dev/null +++ b/webapp/ftth-ipe-map.service @@ -0,0 +1,29 @@ +[Unit] +After=network.target + +[Install] +WantedBy=default.target + +[Service] +Environment="PORT=6665" +# /etc/ftth-ipe-map/conf.ini +ConfigurationDirectory=ftth-ipe-map +WorkingDirectory=/srv/www/ftth-ipe-map/webapp/ +ExecStart=/srv/www/ftth-ipe-map/webapp/startGunicornService +User=ftth-ipe-map +Group=ftth-ipe-map +Restart=on-failure +RestartSec=30 + +# Sandboxing +#ProtectSystem=strict +#ProtectHome=tmpfs +PrivateTmp=true +PrivateDevices=true +ProtectClock=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectKernelLogs=true +ProtectControlGroups=true +RestrictAddressFamilies=AF_INET +RestrictRealtime=true \ No newline at end of file diff --git a/webapp/main.py b/webapp/main.py index 85123cb..71462fb 100644 --- a/webapp/main.py +++ b/webapp/main.py @@ -9,7 +9,7 @@ class Config(TypedDict): dbPath: str def parseConfig() -> Config: - cfg_path = os.environ.get("CONFIG", "/etc/ipe-ftth-elig/conf.ini") + cfg_path = os.environ.get("CONFIG", "/etc/ftth-ipe-map/conf.ini") cfg = configparser.ConfigParser() with open(cfg_path, "r") as f: cfg.read_file(f) diff --git a/webapp/startGunicornService b/webapp/startGunicornService new file mode 100755 index 0000000..f898f36 --- /dev/null +++ b/webapp/startGunicornService @@ -0,0 +1,7 @@ +#!/bin/bash + +set -euo pipefail + +export PATH="/usr/bin/:/bin/:/srv/www/Axione-FTTH-Test/.poetry/bin/" +poetry install +poetry run gunicorn -b "localhost:${PORT}" --timeout 120 'main:app' \ No newline at end of file