Backups → Restoring in a container: the worker keeps running through a restore, and the scheduler stays stopped after it #541
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#541
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908dand the wiki at de1f52467, following the container restore recipe againstdocker/compose.yml.Checked again on 2026-10-01 against
mainat0a5cad587: still present.The container recipe for a restore stops
postuloandscheduler, but notworker, so a background worker can go on reading and writing the database thatrestoreis overwriting. The closingup -dnames no profile, so Compose starts only the web service: a scheduler or worker that was running before the restore is left stopped, and stays stopped across reboots.postulo.wiki/Backups-and-your-data.md:195-202(the "In a container" block);docker/compose.yml:45-46(scheduler,profiles: ["scheduler"]) anddocker/compose.yml:88-89(worker,profiles: ["worker"]).docker/compose.yml:43and:87tell them to (--profile scheduler up -d,--profile worker up -d).docker compose -f docker/compose.yml stop postulo scheduler. The worker (manage.py work, a pass every few seconds) is not named and keeps its connection to/app/data/postulo.sqlite3.restoreoverwrites the database through SQLite's backup API while the worker is using it. The page's own rule, at line 164-167, is that "nothing else may be using it while the command runs". If the worker's WAL files happen to be present,restorerefuses and the page's next suggestion is--force.docker compose -f docker/compose.yml up -dstarts only services without a profile.schedulerandworkerwere stopped by hand, sorestart: unless-stoppeddoes not bring them back after a reboot either.POSTULO_BACKGROUND_WORK=true, queued work piles up with nobody emptying it — the "button that does nothing"docker/compose.yml:86warns about.docker compose -f docker/compose.yml --profile scheduler --profile worker stop. After it, start the same set the operator runs, for exampledocker compose -f docker/compose.yml --profile scheduler --profile worker up -d, with a sentence saying to drop the profiles they do not use (the worker must only run together withPOSTULO_BACKGROUND_WORK=true); or recommendCOMPOSE_PROFILESin.envso that plainup -dandstopcover them. Add the worker to the sentence at line 166 ("a web worker or the scheduler"), and give the PostgreSQL stack (docker/compose.postgres.yml, scheduler profile only) the same treatment.Related to #234 (closed), which added this recipe to give a container a safe restore.
Done when
Backups-and-your-data.mdstops every servicedocker/compose.ymldefines,workerincluded, beforerun ... restore, and its closing command starts the scheduler and worker again for an operator who runs them.--profile scheduler --profile worker,docker compose -f docker/compose.yml psshows all three services running after the restore, and none of them was up whilerestoreran.