[openstreetmap/openstreetmap-website] Use a healthcheck to ensure the docker db container is active (PR #6626)

Andy Allan notifications at github.com
Wed Dec 17 15:51:11 UTC 2025


This is an extracted and reworked part of #6588

>From the github actions runs, you can see the difference - when the db container is being started, the web container waits until the db is `healthy`

before:

```
 Container openstreetmap-website-db-1  Creating
 Container openstreetmap-website-db-1  Created
 Container openstreetmap-website-web-1  Creating
 Container openstreetmap-website-web-1  Created
 Container openstreetmap-website-db-1  Starting
 Container openstreetmap-website-db-1  Started
 Container openstreetmap-website-web-1  Starting
 Container openstreetmap-website-web-1  Started
```

after:

```
 Container openstreetmap-website-db-1  Creating
 Container openstreetmap-website-db-1  Created
 Container openstreetmap-website-web-1  Creating
 Container openstreetmap-website-web-1  Created
 Container openstreetmap-website-db-1  Starting
 Container openstreetmap-website-db-1  Started
 Container openstreetmap-website-db-1  Waiting
 Container openstreetmap-website-db-1  Healthy
 Container openstreetmap-website-web-1  Starting
 Container openstreetmap-website-web-1  Started
```

It's unclear if the lack of healthcheck was a genuine problem, but I think this PR implements a reasonable thing to do. Compared to the original PR, the `pg_isready` command is simplified since the additional options are unnecessary and it outputs useful exit-codes without any additional handling.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6626

-- Commit Summary --

  * Use a healthcheck to ensure the docker db container is active

-- File Changes --

    M docker-compose.yml (8)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6626.patch
https://github.com/openstreetmap/openstreetmap-website/pull/6626.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6626
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6626 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251217/bc65ba16/attachment-0001.htm>


More information about the rails-dev mailing list