Adds database backup crontab

This commit is contained in:
Mouse Reeve 2020-10-28 13:55:08 -07:00
parent bdde69473a
commit 6826386ea3
3 changed files with 13 additions and 0 deletions

View file

@ -8,3 +8,12 @@ COPY requirements.txt /app/
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
COPY ./bookwyrm /app COPY ./bookwyrm /app
COPY ./celerywyrm /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

1
db-backups-cron Normal file
View file

@ -0,0 +1 @@
0 0 * * * /app/db_bashup.sh

3
db_backup.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
filename=backup__$(date +%F)
pg_dump -U fedireads | gzip > $filename.gz