umorpha-boxes/modules/base-uwsgi.sh

29 lines
734 B
Bash

#!/hint/bash -euE
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
packages+=(uwsgi)
post_install+=(20:uwsgi:post_install)
uwsgi:post_install() {
local arg_mountpoint=$1
install -Dm644 /dev/stdin "$arg_mountpoint/etc/systemd/system/uwsgi@.service.d/socket.conf" <<-EOF
# Avoid accidentally starting the service without the socket
[Unit]
Requires=uwsgi@%i.socket
After=uwsgi@%i.socket
EOF
install -Dm644 /dev/stdin "$arg_mountpoint/etc/systemd/system/uwsgi@.socket.d/owner.conf" <<-EOF
[Socket]
SocketUser=http
SocketGroup=http
SocketMode=0600
EOF
# Put this in the module for things that run in uWSGI:
#
# systemctl --root="$arg_mountpoint" enable uwsgi@THING.socket
}