Commit 745fd716 authored by nimrod's avatar nimrod
Browse files

Matrix: Add backups.

- Mark the Synapse data volume for snapshot by `dvb` (it just a bunch of
  files anyway).
- Do weekly backups of the database.
parent 0098b2c5
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
*
!backup
!crontab
+13 −0
Original line number Diff line number Diff line

# hadolint ignore=DL3006
FROM registry.shore.co.il/cron as supersonic
# hadolint ignore=DL3002
USER root
# hadolint ignore=DL3018
RUN apk add --update --no-cache \
    docker-cli \
    findutils \
    ;
COPY --chown=root:root backup /usr/local/bin/
COPY --chown=root:root restore /usr/local/bin/
VOLUME /var/backups
+5 −0
Original line number Diff line number Diff line
# crond

Runs background jobs for the Matrix server. The jobs are:

- Postgres DB backup.
+7 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eu

now="$(date --utc -Iseconds)"
dest="/var/backups/${now}.sql.zstd"
mkdir --parents "$(dirname "$dest")"
docker exec matrix-postgres-1 backup > "$dest"
+2 −0
Original line number Diff line number Diff line
@weekly backup || wget --spider https://notify.shore.co.il/send?message=Matrix%20DB%20backup%20failed.
@daily find /var/backups -atime +18 -delete
Loading