Skip to content
Snippets Groups Projects
Commit da6efe34 authored by jurgenhaas's avatar jurgenhaas
Browse files

Add daily db backup

parent f2776c25
No related branches found
Tags v2.5.4
No related merge requests found
......@@ -32,3 +32,14 @@
src: vhost.conf
dest: /etc/apache2/sites-available/{{ item.id }}.conf
with_items: '{{ keycloak_settings }}'
- name: Setup crontab for backups
cron:
name: Backup Keycloak DB {{ item.id }}
hour: 3
minute: 35
job: docker exec -it keycloak_postgres_1 /usr/lib/postgresql/11/bin/pg_dump --file=/tmp/backups/dump_$(date +"%m_%d_%Y").sql --username=keycloak > /dev/null 2>&1
disabled: '{{ crons_disabled|default(false) }}'
with_items: '{{ keycloak_settings }}'
tags:
- cron
......@@ -9,6 +9,7 @@ services:
image: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
- /var/backups/keycloak/{{ item.id }}:/tmp/backups
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment