Skip to content

separate backup container from db node#3829

Open
ilkka-ollakka wants to merge 5 commits intobookwyrm-social:backups-mainfrom
ilkka-ollakka:tweak/backup-container
Open

separate backup container from db node#3829
ilkka-ollakka wants to merge 5 commits intobookwyrm-social:backups-mainfrom
ilkka-ollakka:tweak/backup-container

Conversation

@ilkka-ollakka
Copy link
Contributor

Description

Create postgres-container as purely to run cron and take backups. Envs are defined in https://www.postgresql.org/docs/17/libpq-envars.html for pg_dump.

  • Related Issue #
  • Closes #

What type of Pull Request is this?

  • Bug Fix
  • Enhancement
  • Plumbing / Internals / Dependencies
  • Refactor

Does this PR change settings or dependencies, or break something?

  • This PR changes or adds default settings, configuration, or .env values
  • This PR changes or adds dependencies
  • This PR introduces other breaking changes

Details of breaking or configuration changes (if any of above checked)

Documentation

  • New or amended documentation will be required if this PR is merged
  • I have created a matching pull request in the Documentation repository
  • I intend to create a matching pull request in the Documentation repository after this PR is merged

Tests

  • My changes do not need new tests
  • All tests I have added are passing
  • I have written tests but need help to make them pass
  • I have not written tests and need help to write them

@mouse-reeve
Copy link
Member

The backup script is working when I run it manually, but it seems like the cron job isn't being installed?

@ilkka-ollakka
Copy link
Contributor Author

ilkka-ollakka commented Feb 6, 2026

The backup script is working when I run it manually, but it seems like the cron job isn't being installed?

it is running as server-level crontab from /etc/cron.d/cronfile. When I changed the interval of executions/added faster interval task there jobs were executed. But I'll recheck that I didn't miss something

It doesn't log to /var/log/cron.log but to docker compose logs as the outputs are piped to stdout of cron-process.

@mouse-reeve
Copy link
Member

I wonder if I'm missing something in how I'm testing this. My process has been:

  1. Set DEBUG=false in .env
  2. Open postgres-docker/cronfile and change the cron schedule to * * * * *
  3. Run docker compose up --build to start the app
  4. From the db-backup-job container shell, run ls backups/

I'm seeing bookwyrm-db-backup-job-1 | cron -f -L 7 once in the docker logs on startup, and no files created in the backups/ directory

@ilkka-ollakka
Copy link
Contributor Author

That flow seems same what I use. I'll recheck if there is something that I overlooked.

@ilkka-ollakka
Copy link
Contributor Author

I added timestamps on log-lines, but for me I first see that cron-line and after next full minute I noticed log-lines for backup being done.

for example:

db-backup-job-1   | [2026-02-09T20:48:01+00:00]backup: Database not specified, defaulting to bookwyrm
db-backup-job-1   | [2026-02-09T20:48:01+00:00]backup: Database user not specified, defaulting to bookwyrm
db-backup-job-1   | 0 files deleted
db-backup-job-1   | [2026-02-09T20:48:01+00:00]backup: completed backup of bookwyrm to /backups/backup_bookwyrm_2026-02-09.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments