- Added role to setup https://github.com/prodrigestivill/docker-postgres-backup-local container to backup all postgres databases
This commit is contained in:
@ -0,0 +1,12 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
POSTGRES_USER={{ matrix_postgres_connection_username }}
|
||||
POSTGRES_PASSWORD={{ matrix_postgres_connection_password }}
|
||||
POSTGRES_HOST={{ matrix_postgres_connection_hostname }}
|
||||
POSTGRES_DB={{ matrix_postgres_backup_db_list }}
|
||||
POSTGRES_EXTRA_OPTS={{ matrix_postgres_backup_extra_opts }}
|
||||
SCHEDULE={{ matrix_postgres_backup_schedule }}
|
||||
BACKUP_KEEP_DAYS={{ matrix_postgres_backup_keep_days }}
|
||||
BACKUP_KEEP_WEEKS={{ matrix_postgres_backup_keep_weeks }}
|
||||
BACKUP_KEEP_MONTHS={{ matrix_postgres_backup_keep_months }}
|
||||
HEALTHCHECK_PORT={{ matrix_postgres_backup_healthcheck_port }}
|
||||
POSTGRES_PORT={{ matrix_postgres_connection_port }}
|
@ -0,0 +1,31 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Automatic Backup of Matrix Postgres server
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} stop matrix-postgres-backup
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-postgres-backup 2>/dev/null'
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-postgres-backup \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_docker_network }} \
|
||||
--env-file={{ matrix_postgres_backup_path }}/env-postgres-backup \
|
||||
--mount type=bind,src={{ matrix_postgres_backup_path }},dst=/backups \
|
||||
{{ matrix_postgres_backup_docker_image_to_use }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_docker }} stop matrix-postgres-backup
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-postgres-backup 2>/dev/null'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-postgres-backup
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user