You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
54 lines
1.6 KiB
[Unit]
|
|
Description=PostgreSQL Database Server - Backup
|
|
Documentation=https://hub.docker.com/_/postgres/
|
|
After=network.target postgresql-server.service var-lib-virtiofs-data.mount
|
|
Requires=postgresql-server.service var-lib-virtiofs-data.mount
|
|
|
|
# Start/stop this unit when the target is started/stopped
|
|
PartOf=postgresql.target
|
|
|
|
[Container]
|
|
ContainerName=postgresql-backup-job
|
|
Image=docker.io/library/postgres:${PG_MAJOR}-alpine
|
|
|
|
# Network configuration
|
|
Network=host
|
|
|
|
# Those environment variables will be injected by podman into the container
|
|
EnvironmentFile=/etc/quadlets/postgresql/config.env
|
|
|
|
# Use a custom backup script
|
|
Entrypoint=/usr/local/bin/backup.sh
|
|
|
|
# No need for root privileges
|
|
User=postgres
|
|
Group=postgres
|
|
|
|
# UID/GID mapping to map the postgres (70) user inside the container to arbitrary user 10004 / group 10000 on the host
|
|
UIDMap=0:1000000:70
|
|
UIDMap=70:10004:1
|
|
UIDMap=71:1000071:65465
|
|
GIDMap=0:1000000:70
|
|
GIDMap=70:10000:1
|
|
GIDMap=71:1000071:65465
|
|
|
|
# Avoid issues with built-in volumes being created by root
|
|
PodmanArgs=--image-volume=ignore
|
|
|
|
# Volume mounts
|
|
Volume=/var/lib/quadlets/postgresql:/var/lib/postgresql:z
|
|
Volume=/var/lib/virtiofs/data/postgresql/backup:/var/lib/postgresql/backup:z
|
|
Volume=/etc/quadlets/postgresql/backup.sh:/usr/local/bin/backup.sh:z,ro
|
|
|
|
# Share /run/postgresql/ between containers in the pod for the Unix socket
|
|
Volume=/run/quadlets/postgresql:/var/run/postgresql:z
|
|
|
|
[Service]
|
|
Restart=no
|
|
TimeoutStartSec=600
|
|
|
|
# These environment variables are sourced to be used by systemd in the Exec* commands
|
|
EnvironmentFile=/etc/quadlets/postgresql/config.env
|
|
|
|
# This container is a job - run once to completion
|
|
Type=oneshot
|
|
|