feat: schedule with busybox crond instead of supercronic
Same scheduler qbit-maid uses: entrypoint.sh writes the crontab and execs crond -f. Drops the supercronic package from the image. - crontab lives in /tmp/crontabs because the rootfs is read-only - MAILTO= keeps job output on crond's stdout/stderr (container log), which is what supercronic -passthrough-logs provided - busybox crond only loads crontab files owned by uid 0 and calls initgroups() per job, so the container needs root + CAP_SETGID; the entrypoint now fails fast (exit 78) when it is not root - no @reboot job: a container restart must not start a backup
This commit is contained in:
1 parent
313db934e4
commit
ce825c7526
3 files changed
+40
-8
No files matched your search
@@ -60,7 +60,7 @@ record nothing, which is why the query string is the only form used here.
|
||||
| `COLD_BACKUP` | `false` | stop Seafile around the run |
|
||||
| `SEAFILE_CONTAINER` | `seafile` | container to stop in cold mode |
|
||||
| `FAIL_ON_PARTIAL` | `false` | treat restic exit 3 as a failure |
|
||||
| `CRON` | `0 3 * * *` | supercronic schedule |
|
||||
| `CRON` | `0 3 * * *` | crond schedule (standard 5-field) |
|
||||
|
||||
`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` are read by restic itself for the
|
||||
`s3:` backend.
|
||||
@@ -76,6 +76,24 @@ mariadb -h <host> -u root -p < /restore/config/db/<stamp>/seafile-databases.sql
|
||||
The dump is written with `--add-drop-table`, so it can also be replayed over an
|
||||
existing database.
|
||||
|
||||
## Scheduling
|
||||
|
||||
The container runs busybox `crond` in the foreground (the same scheduler
|
||||
qbit-maid uses). `entrypoint.sh` writes `/tmp/crontabs/root` from `CRON` and
|
||||
execs `crond -f -c /tmp/crontabs`; the rootfs is read-only, so the crontab
|
||||
lives on the tmpfs. `MAILTO=` is set empty so job output stays on crond's own
|
||||
stdout/stderr, i.e. the container log.
|
||||
|
||||
Two consequences of busybox crond:
|
||||
|
||||
* it only loads crontab files owned by **uid 0**, so the container must run as
|
||||
root (`user: '0:0'` — which the Seafile block permissions require anyway);
|
||||
* before each job it calls `initgroups()`, so the container needs
|
||||
`CAP_SETGID` on top of `CAP_DAC_OVERRIDE`. Without it the job is forked and
|
||||
then dies with `crond: can't set groups: Operation not permitted`.
|
||||
|
||||
There is no `@reboot` job: a container restart does not start a backup.
|
||||
|
||||
## Build
|
||||
|
||||
```sh
|
||||
|
||||
Reference in new issue
Block a user