Rewrite as an online restic backup
The 2023 prototype could not work against the current stack and, where it did run, reported success while doing nothing: it dumped from a stale IP (192.168.4.11) that is not even the Seafile database, joined a network the DB is not on, used a mistyped seahub.sh path, and discarded every exit code. Replace it with a single orchestrator that: * never stops Seafile - the DB dump uses --single-transaction and the block store is content-addressed and immutable, so restic can read it live; * reads the DB credentials from the Seafile conf/.env instead of duplicating them in the stack .env; * dumps with --quick --routines --events --triggers --add-drop-table (the old --skip-opt produced a dump with no DROP TABLE, i.e. unrestorable over an existing database) and passes the password via MYSQL_PWD; * puts the dump inside the restic snapshot, so a restore needs one source; * drops rclone entirely - it cannot write to the RustFS buckets (403 on every bucket) and `sync` is the wrong semantics for a backup; * checks every step, exits non-zero on failure, pings the Kuma push monitor with /start, /fail or the result, and sends a failure notification; * takes an exclusive lock, verifies the dump trailer and the snapshot, and only then prunes old dump directories; * keeps a second restic repository on a different physical disk; * runs as a non-root image with a read-only rootfs and no capabilities. Also: replace the dead Drone pipeline with a Gitea Actions build, drop the unused python-dotenv/requests dependencies, and fix the README.
This commit is contained in:
1 parent
ae8320118a
commit
dce11df819
10 files changed
+787
-293
No files matched your search
+25
-7
@@ -1,7 +1,25 @@
|
||||
FROM python:alpine3.18
|
||||
RUN apk add --no-cache mariadb-client rclone supercronic docker restic zip
|
||||
COPY . opt
|
||||
RUN chmod +x /opt/entrypoint.sh
|
||||
RUN chmod +x /opt/restic.sh
|
||||
RUN pip install requests python-dotenv
|
||||
CMD ["/opt/entrypoint.sh"]
|
||||
FROM python:3.13-alpine
|
||||
|
||||
# mariadb-client -> mariadb-dump
|
||||
# restic -> the backup engine
|
||||
# docker-cli -> only used when COLD_BACKUP=true (docker exec into seafile)
|
||||
# supercronic -> cron with passthrough logs
|
||||
RUN apk add --no-cache \
|
||||
mariadb-client \
|
||||
restic \
|
||||
docker-cli \
|
||||
supercronic \
|
||||
tzdata \
|
||||
&& adduser -u 99 -D -G users -h /config -s /sbin/nologin backup
|
||||
|
||||
COPY seafile-backup.py /usr/local/bin/seafile-backup
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod 0755 /usr/local/bin/seafile-backup /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENV HOME=/tmp \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
USER 99:100
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
Reference in new issue
Block a user