mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
Create an image for db backups
This commit is contained in:
13
containers/backup-db/Dockerfile
Normal file
13
containers/backup-db/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM alpine
|
||||
RUN apk add postgresql-client
|
||||
RUN apk add restic --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/
|
||||
|
||||
COPY ./backup.sh /usr/src/app/backup.sh
|
||||
RUN chmod +x /usr/src/app/backup.sh
|
||||
COPY ./backup.sh /usr/src/app/forget.sh
|
||||
RUN chmod +x /usr/src/app/forget.sh
|
||||
|
||||
RUN echo '30 * * * * /usr/src/app/backup.sh' >> /etc/crontabs/root
|
||||
RUN echo '10 0 * * 1 /usr/src/app/forget.sh' >> /etc/crontabs/root
|
||||
|
||||
CMD crond -l 2 -f
|
||||
6
containers/backup-db/backup.sh
Normal file
6
containers/backup-db/backup.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
mkdir ./dump
|
||||
|
||||
pg_dump -f ./dump/sponsorTimes.dump sponsorTimes
|
||||
pg_dump -f ./dump/privateDB.dump privateDB
|
||||
|
||||
restic backup ./dump
|
||||
1
containers/backup-db/forget.sh
Normal file
1
containers/backup-db/forget.sh
Normal file
@@ -0,0 +1 @@
|
||||
restic forget --prune --keep-last 48 --keep-daily 7 --keep-weekly 8
|
||||
6
containers/rsync/Dockerfile
Normal file
6
containers/rsync/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM ghcr.io/ajayyy/sb-server:latest
|
||||
EXPOSE 873/tcp
|
||||
RUN apk add rsync>3.2.4-r0
|
||||
RUN mkdir /usr/src/app/database-export
|
||||
|
||||
CMD rsync --no-detach --daemon & ./entrypoint.sh
|
||||
Reference in New Issue
Block a user