Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ RUN apk add postgresql-client
RUN apk add dcron

COPY pgsqlbackup.sh /usr/local/bin/pgsqlbackup.sh
COPY drop_old_dumps.sh /usr/local/bin/drop_old_dumps.sh

ENV DB_NAME="b2share"
ENV DB_HOST="postgres"
ENV DB_PORT="5432"
ENV NUMBER_OF_DUMPS="30"

# Create cron job
COPY crontab /etc/cron.d/pgsqlbackup-cron
Expand Down
1 change: 1 addition & 0 deletions backup/crontab
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
0 1 * * * /bin/sh /usr/local/bin/pgsqlbackup.sh 2>&1
0 2 * * * /bin/sh /usr/local/bin/drop_old_dumps.sh 2>&1
6 changes: 6 additions & 0 deletions backup/drop_old_dumps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Drop old database dumps.

/usr/bin/find /usr/local/share/pgsql_dumps -type f -mtime +${NUMBER_OF_DUMPS} -delete

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ services:
# environment:
# - "PGPASSWORD=${B2SHARE_POSTGRESQL_PASSWORD}"
# - "POSTGRES_USER=${B2SHARE_POSTGRESQL_USER}"
# - "NUMBER_OF_DUMPS=30"
# volumes:
# - "${B2SHARE_DATADIR}/db_dump:/usr/local/share/pgsql_dumps"