From b271454e8d9c963dfbdd3268c793ef46428ae55c Mon Sep 17 00:00:00 2001 From: Chris Vogel Date: Sat, 27 Apr 2024 13:36:14 +0200 Subject: [PATCH] extend logging * make systemd.service log a timestamp that can be read by fail2ban * add dependency on moreutils to manifest.toml (needed in systemd.service) --- conf/systemd.service | 2 +- manifest.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index c5318c2..96467e7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/__APP__ Environment="VENV_DIR=__INSTALL_DIR__/venv/" -ExecStart=__INSTALL_DIR__/venv/bin/uvicorn --host 127.0.0.1 --port __PORT__ --reload flohmarkt.web:start +ExecStart=/bin/bash -c "/opt/flohmarkt/venv/bin/uvicorn --host 127.0.0.1 --port 8000 --reload flohmarkt.web:start 2>&1 | /usr/bin/ts '%%Y-%%m-%%d %%H:%%M:%%S'" StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/manifest.toml b/manifest.toml index 62f6ec1..592c9b2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -156,7 +156,8 @@ ram.runtime = "100M" [resources.apt] # python dependencies shall be installed in a venv using pip. - packages = "python3-pip python3-full curl apt-transport-https gnupg" + # moreutils is needed for `ts` used in systemd.service + packages = "python3-pip python3-full curl apt-transport-https gnupg moreutils" # repo for couchdb - doesn't work, yet # extras.couchdb.repo = "deb https://apache.jfrog.io/artifactory/couchdb-deb/ __YNH_DEBIAN_VERSION__ main" # extras.couchdb.key = "https://couchdb.apache.org/repo/keys.asc"