coreos-home-server/service/nginx/systemd/nginx-serve-volume@.service
Alex Palaistras f877a72e83 Flatten directory structures
This commit contains a fairly large diff for a fairly small change:
moving the `config/common` directory to `host/base` to better reflect
its intended use, and promoting `config/service` to the root directory.

These changes unlock some improvements in `coreos-home-server-update`
processes, which will (assuming `/etc/coreos-home-server/base` exists)
keep host-wide systemd services in sync in addition to service-specific
ones.

Changes have been make to the `Makefile` and a few other places where
`config/common` was referenced, but most of this work is renames that
are not intended to break compatibility with new or running servers.
2022-01-15 11:43:33 +00:00

26 lines
963 B
Desktop File

[Unit]
Description=NGINX Web Service for Volume %I
Wants=nginx.service
After=nginx.service
[Service]
Type=notify
NotifyAccess=all
SyslogIdentifier=%N
Restart=on-failure
Environment=PODMAN_SYSTEMD_UNIT=%n
Environment=SERVER_NAME=%p-%i SERVER_ROOT=/srv
Environment=NGINX_CONF=%E/coreos-home-server/nginx/service/%p.conf.template
ExecStartPre=/bin/podman create --replace --name $SERVER_NAME --net internal --sdnotify=conmon \
--volume %i:/srv:z,ro \
localhost/nginx:latest
ExecStartPre=/bin/sh -c "envsubst '$SERVER_NAME $SERVER_ROOT' < ${NGINX_CONF} > /tmp/%i.conf"
ExecStartPre=/bin/sh -c 'podman cp /tmp/%i.conf ${SERVER_NAME}:/etc/nginx/conf.d/%i.conf && rm -f /tmp/%i.conf'
ExecStart=/bin/podman start --attach $SERVER_NAME
ExecStop=/bin/podman stop --ignore --time 10 $SERVER_NAME
ExecStopPost=/bin/podman rm --ignore --force $SERVER_NAME
[Install]
Alias=%i.service
WantedBy=multi-user.target