coreos-home-server/service/nginx/systemd/nginx-serve-php@.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

33 lines
1.5 KiB
Desktop File

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