coreos-home-server/config/service/nginx/systemd/nginx-serve-static@.service
Alex Palaistras 176f65f998 nginx: Fix issues, consolidate naming
Naming for services has been consolidated to `nginx-proxy` and
`nginx-serve`, and issues with resolving underlying containers in the
case of restarts have been fixed by way of resolver configuration.
2021-07-24 14:52:27 +01:00

23 lines
932 B
Desktop File

[Unit]
Description=NGINX static web service for %I
Wants=container-build@%i.service nginx.service nginx-proxy-http@%i.service
After=container-build@%i.service nginx.service
Before=nginx-proxy-http@%i.service
[Service]
Restart=always
Environment=SERVER_NAME=%i SERVICE_DATA_DIRECTORY=/data
Environment=NGINX_CONF=/etc/container-service/nginx/service/%p.conf.template
ExecStartPre=/bin/podman create --replace --pull never --name %i --net internal \
--volume %i:${SERVICE_DATA_DIRECTORY}:z,ro \
localhost/%i:latest
ExecStartPre=/bin/sh -c "envsubst '$SERVER_NAME' < ${NGINX_CONF} > /tmp/%i.conf"
ExecStartPre=/bin/sh -c 'podman cp /tmp/%i.conf %i:/etc/nginx/conf.d/%i.conf && rm -f /tmp/%i.conf'
ExecStart=/bin/podman start --attach %i
ExecStop=/bin/podman stop --time 10 %i
ExecStopPost=/bin/podman rm --force %i
[Install]
Alias=%i.service
WantedBy=multi-user.target