mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 13:40:45 +00:00
Alex Palaistras
79231c37f1
Defaults for Podman that were previous applied as command-line arguments to all `podman run` or `podman create` invocations are now specified in a dedicated configuration file. Services are also better identified against their name rather than the generic `podman` ID derived from the `ExecStart` invocations.
25 lines
959 B
Desktop File
25 lines
959 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]
|
|
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 create --replace --name %i --sdnotify=conmon --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 --ignore --time 10 %i
|
|
ExecStopPost=/bin/podman rm --ignore --force %i
|
|
|
|
[Install]
|
|
Alias=%i.service
|
|
WantedBy=multi-user.target
|