backup: fix location of backup directory

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-12-06 17:59:50 +01:00
parent d257729557
commit dd12ecd90a
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
2 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,7 @@ postgres_ha_databases: []
# pass: 'dbpass' # pass: 'dbpass'
# Backups # Backups
postgres_ha_backup_service_name: 'dump-{{ postgres_ha_service_name }}-db' postgres_ha_backup_service_name: 'dump-{{ postgres_ha_service_name }}'
postgres_ha_backup_frequency: daily postgres_ha_backup_frequency: daily
postgres_ha_backup_timeout: 600 postgres_ha_backup_timeout: 600
postgres_ha_backup_user: 'root' postgres_ha_backup_user: 'root'

View File

@ -3,7 +3,7 @@
include_role: name=systemd-timer include_role: name=systemd-timer
vars: vars:
systemd_timer_name: '{{ postgres_ha_backup_service_name }}' systemd_timer_name: '{{ postgres_ha_backup_service_name }}'
systemd_timer_description: 'Dump Telemetry PostgreSQL database.' systemd_timer_description: 'Dump High-Availability PostgreSQL database.'
systemd_timer_user: '{{ postgres_ha_backup_user }}' systemd_timer_user: '{{ postgres_ha_backup_user }}'
systemd_timer_frequency: '{{ postgres_ha_backup_frequency }}' systemd_timer_frequency: '{{ postgres_ha_backup_frequency }}'
systemd_timer_timeout_sec: '{{ postgres_ha_backup_timeout }}' systemd_timer_timeout_sec: '{{ postgres_ha_backup_timeout }}'
@ -11,7 +11,7 @@
systemd_timer_start_on_creation: false systemd_timer_start_on_creation: false
systemd_timer_script_content: | systemd_timer_script_content: |
#!/usr/bin/env bash #!/usr/bin/env bash
BKP_DIR="{{ postgres_ha_cont_data_vol }}/backup/{{ postgres_ha_db_name }}" BKP_DIR="{{ postgres_ha_cont_backup_vol }}"
rm -vfr "${BKP_DIR}" rm -vfr "${BKP_DIR}"
/usr/bin/docker exec -i {{ postgres_ha_cont_name }} \ /usr/bin/docker exec -i {{ postgres_ha_cont_name }} \
pg_dump -F directory -f "/backup/{{ postgres_ha_db_name }}" \ pg_dump -F directory -f "/backup/{{ postgres_ha_db_name }}" \