[GH-ISSUE #197] [Docker] include checks in the app and worker image to delay initial startup until db is ready #157

Closed
opened 2026-02-25 21:31:19 +03:00 by kerem · 1 comment
Owner

Originally created by @maspiter on GitHub (Oct 27, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/197

Originally assigned to: @ciur on GitHub.

I'm trying to build a custom docker image with app, worker and general configuration files.

I noticed that running the app for the first time generates errors in the worker and app containers because db is not ready yet.

Stopping and restarting the app makes it work but not without errors

Expected
Scripts that check for readyness of the db container before completing initial setup.

Actual
Errors in the app and worker application (is host db ready and accepting connections on 5432)

Info:

  • OS: QNAP
  • Browser Firefox
  • Database PostgreSQL
  • Papermerge Version built from the 1.4 subdir
Originally created by @maspiter on GitHub (Oct 27, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/197 Originally assigned to: @ciur on GitHub. I'm trying to build a custom docker image with app, worker and general configuration files. I noticed that running the app for the first time generates errors in the worker and app containers because db is not ready yet. Stopping and restarting the app makes it work but not without errors **Expected** Scripts that check for readyness of the db container before completing initial setup. **Actual** Errors in the app and worker application (is host db ready and accepting connections on 5432) **Info:** - OS: QNAP - Browser Firefox - Database PostgreSQL - Papermerge Version built from the 1.4 subdir
kerem 2026-02-25 21:31:19 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@maspiter commented on GitHub (Oct 28, 2020):

Ok, so I built a custom image with the wait-for-it.sh script in the config directory and then use the following command in my docker compose file:

command: ["/opt/app/wait-for-it.sh", "-s", "-t", "60", "db:5432", "--", "/opt/app/startup.sh"]

This starts the containers as it should on first boot. Other boots are much quicker but this to ensure the DB is ready before starting the other containers.

Would it be possible to include this script by default in the docker config files?

<!-- gh-comment-id:718264546 --> @maspiter commented on GitHub (Oct 28, 2020): Ok, so I built a custom image with the [wait-for-it.sh script](https://github.com/vishnubob/wait-for-it) in the config directory and then use the following command in my docker compose file: command: ["/opt/app/wait-for-it.sh", "-s", "-t", "60", "db:5432", "--", "/opt/app/startup.sh"] This starts the containers as it should on first boot. Other boots are much quicker but this to ensure the DB is ready before starting the other containers. Would it be possible to include this script by default in the docker config files?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#157
No description provided.