Browse Source

add update

main
Nicolas Massé 1 week ago
parent
commit
e4242e3ca7
  1. 3
      nginx/nginx-init.container
  2. 4
      nginx/nginx-server.container
  3. 43
      nginx/nginx-update.container
  4. 4
      nginx/nginx.target

3
nginx/nginx-init.container

@ -4,8 +4,9 @@ Documentation=https://hub.docker.com/r/alpine/git
After=network-online.target
Before=nginx-server.service
# Only start if the service has NOT been configured
# Only start if the service has been configured
ConditionPathExists=/etc/quadlets/nginx/config.env
# And if the git repo has NOT been cloned yet
ConditionPathExists=!/var/lib/quadlets/nginx/.git
# Start/stop this unit when the target is started/stopped

4
nginx/nginx-server.container

@ -1,8 +1,8 @@
[Unit]
Description=Nginx HTTP Server
Documentation=https://hub.docker.com/_/nginx
After=network.target nginx-init.service
Requires=nginx-init.service
After=network.target nginx-init.service nginx-update.service
Requires=nginx-init.service nginx-update.service
Before=nginx.target
# Only start if Nginx has been configured

43
nginx/nginx-update.container

@ -0,0 +1,43 @@
[Unit]
Description=Update Nginx root directory from a Git repository
Documentation=https://hub.docker.com/r/alpine/git
After=network-online.target
Before=nginx-server.service
# Only start if the service has been configured
ConditionPathExists=/etc/quadlets/nginx/config.env
# And if the git repo has already been cloned
ConditionPathExists=/var/lib/quadlets/nginx/.git
# Start/stop this unit when the target is started/stopped
PartOf=nginx.target
[Container]
ContainerName=nginx-update-job
Image=docker.io/alpine/git:latest
# Network configuration
Network=host
# Those environment variables will be injected by podman into the container
EnvironmentFile=/etc/quadlets/nginx/config.env
# Clone the website repository
Exec=pull
WorkingDir=/var/git
# Volume mounts
Volume=/var/lib/quadlets/nginx:/var/git:z
[Service]
Restart=no
TimeoutStartSec=30
# These environment variables are sourced to be used by systemd in the Exec* commands
EnvironmentFile=/etc/quadlets/nginx/config.env
# This container is a job - run once to completion
Type=oneshot
[Install]
WantedBy=nginx.target

4
nginx/nginx.target

@ -1,8 +1,8 @@
[Unit]
Description=Nginx Service Target
Documentation=man:systemd.target(5)
Wants=nginx-server.service nginx-init.service
After=nginx-server.service nginx-init.service
Wants=nginx-server.service nginx-init.service nginx-update.service
After=nginx-server.service nginx-init.service nginx-update.service
# Allow isolation - can stop/start this target independently
AllowIsolate=yes
# Only start if Nginx has been configured

Loading…
Cancel
Save