adds resticprofile backup service to compose.yml

This commit is contained in:
2025-06-05 21:02:50 +01:00
parent d404a0097f
commit 062195867a
48 changed files with 132 additions and 38 deletions

2
resticprofile/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.env
password.txt

16
resticprofile/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM docker.io/creativeprojects/resticprofile:latest
ENV TZ=UTC
RUN set -eux && \
apk update && \
apk add sqlite && \
mkdir -p /app/var/backups
WORKDIR /etc/resticprofile
COPY . .
RUN chmod +x db_dump.sh entrypoint.sh && \
resticprofile schedule --all
ENTRYPOINT ["/etc/resticprofile/entrypoint.sh"]
CMD ["crond", "-f", "-l", "2"]

15
resticprofile/db_dump.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
sql_dump_script = ".output
.dump
.exit"
cd /app/var
for db in *.db
do
basename=$(echo "$db" | sed "s/\.db$//" | sed "s/\s/_/g")
timestamp=$(date +%Y-%m-%dT%H-%M-%S.%N)
echo "$sql_dump_script" \
| sqlite3 "$db" \
> "backups/${basename}_dump_${timestamp}.sql"
done

View File

@@ -0,0 +1,6 @@
#!/bin/sh
env >> /etc/environment
echo "$@"
exec "$@"

View File

@@ -0,0 +1,46 @@
#:schema https://creativeprojects.github.io/resticprofile/jsonschema/config-1.json
version = "1"
[global]
initialize = true
log = "/var/log/resticprofile.log"
scheduler = "crond"
[default]
description = "Back up database to BackBlazeB2 S3 Bucket"
env-file = ".env"
password-file = "password.txt"
repository = "s3:s3.eu-central-003.backblazeb2.com/joeac-net-backup/repo"
verbose = 2
[default.backup]
check-after = true
check-before = true
run-before = ". /scripts/db_dump.sh"
schedule = "*-*-* 03:30:00"
schedule-after-network-online = true
schedule-lock-wait = "2h"
schedule-log = "/var/log/resticprofile-schedule-backup.log"
schedule-permission = "system"
schedule-priority = "background"
source = [
"/app/var/backups",
]
[default.forget]
keep-last = 2
keep-monthly = 2
schedule = "*-*-* 03:45:00"
schedule-after-network-online = true
schedule-lock-wait = "2h"
schedule-log = "/var/log/resticprofile-schedule-forget.log"
schedule-permission = "system"
schedule-priority = "background"
[default.prune]
schedule = "*-*-* 04:00:00"
schedule-after-network-online = true
schedule-lock-wait = "2h"
schedule-log = "/var/log/resticprofile-schedule-prune.log"
schedule-permission = "system"
schedule-priority = "background"