mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 12:37:00 +03:00
Create an image for db backups
This commit is contained in:
10
.github/workflows/sb-server.yml
vendored
10
.github/workflows/sb-server.yml
vendored
@@ -20,6 +20,14 @@ jobs:
|
||||
with:
|
||||
name: "rsync-host"
|
||||
username: "ajayyy"
|
||||
folder: "./rsync"
|
||||
folder: "./containers/rsync"
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
backup-db:
|
||||
uses: ./.github/workflows/docker-build.yml
|
||||
with:
|
||||
name: "db-backup"
|
||||
username: "ajayyy"
|
||||
folder: "./containers/backup-db"
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
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
|
||||
Reference in New Issue
Block a user