mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-09-19 20:51:19 +02:00
Create an image for db backups
This commit is contained in:
parent
901a42d1b4
commit
dfbc32617b
5 changed files with 29 additions and 1 deletions
10
.github/workflows/sb-server.yml
vendored
10
.github/workflows/sb-server.yml
vendored
|
@ -20,6 +20,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: "rsync-host"
|
name: "rsync-host"
|
||||||
username: "ajayyy"
|
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:
|
secrets:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
Loading…
Reference in a new issue