diff --git a/Dockerfile b/Dockerfile index f03d84dd..93113262 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,3 +8,12 @@ COPY requirements.txt /app/ RUN pip install -r requirements.txt COPY ./bookwyrm /app COPY ./celerywyrm /app + +# crontab +COPY ./db_backup.sh /app +RUN apt-get update && apt-get -y install cron +COPY db-backups-cron /etc/cron.d/db-backups-cron +RUN chmod 0644 /etc/cron.d/db-backups-cron +RUN crontab /etc/cron.d/db-backups-cron +RUN touch /var/log/cron.log +CMD cron && tail -f /var/log/cron.log diff --git a/db-backups-cron b/db-backups-cron new file mode 100644 index 00000000..d42df0e2 --- /dev/null +++ b/db-backups-cron @@ -0,0 +1 @@ +0 0 * * * /app/db_bashup.sh diff --git a/db_backup.sh b/db_backup.sh new file mode 100644 index 00000000..bff79f9a --- /dev/null +++ b/db_backup.sh @@ -0,0 +1,3 @@ +#!/bin/bash +filename=backup__$(date +%F) +pg_dump -U fedireads | gzip > $filename.gz