Prepare deployment: Build basic deb packages

This commit is contained in:
aldrin 2021-04-16 09:23:01 +02:00
parent 87d72be3fa
commit dde639f3d1
17 changed files with 280 additions and 0 deletions

37
debian/system-files/userausfall.ini vendored Normal file
View file

@ -0,0 +1,37 @@
[uwsgi]
# basic uwsgi configuration
plugin = python3
plugin = router_redirect
master = True
workers = 4
threads = 2
vacuum = True
# python app configuration
chdir = /var/lib/userausfall
pythonpath = /etc/userausfall
touch-reload = /etc/userausfall/settings.py
for-readline = /etc/default/userausfall
env = %(_)
endfor =
module = userausfall.wsgi:application
# runtime configuration
uid = _userausfall
# socket configuration
chown-socket = www-data:www-data
chmod-socket = 640
# maintenance mode
touch-reload = /etc/userausfall/maintenance_mode
if-exists = /etc/userausfall/maintenance_mode
route = .* break:503
endif =
# Logging will catch a lot of OSErrors if clients prematurely close
# connections before a response was sent. This is not something we want
# to know about.
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true

20
debian/system-files/userausfallctl vendored Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
set -eu
EXEC_USER=_userausfall
. /etc/default/userausfall
export PYTHONPATH
export DJANGO_SETTINGS_MODULE
export USERAUSFALL_DATA_DIR
if [ "$(id -nu)" = "$EXEC_USER" ]; then
exec python3 -m django "$@"
elif [ "$(id -u)" = 0 ]; then
exec su -s "$0" "$EXEC_USER" -- "$@"
else
echo "please run $(basename "$0") as root or '$EXEC_USER'" >&2
exit 1
fi