fix: update depends_on to use Compose v2 condition clauses
What does this MR do?
Fix the documented "down and re-up" webservice startup flakiness by updating depends_on to use Compose v2 condition clauses, matching the CNG upstream pattern.
Problem
The README documents a known workaround:
You likely will have to
downand re-upto get thewebservicecontainer to start properly.
This happens because docker-compose.yml uses bare service names in depends_on without health conditions. Webservice starts before postgres is healthy and before migrations complete. The internal wait-for-deps script has a 60-second timeout, but if migrations take longer, webservice fails.
The CNG upstream docker-compose.yml has already been updated to use Compose v2 long-form depends_on with condition: service_healthy and condition: service_completed_successfully. This MR brings dsop-scripts in line with that pattern.
Changes
-
Remove
version: "3": Compose v2 does not require a version field, and thecondition:syntax is a v2 feature. -
Add healthchecks to postgres and redis, matching the CNG upstream pattern (
pg_isreadyfor postgres,redis-cli pingfor redis). -
Update all
depends_onblocks to use conditions:
| Service | Waits for |
|---|---|
| migrations | postgres: healthy, redis: healthy |
| webservice | postgres: healthy, redis: healthy, migrations: completed |
| workhorse | webservice: healthy, redis: healthy |
| sidekiq | postgres: healthy, redis: healthy, migrations: completed |
| pages | webservice: healthy |
| registry_migrations | postgres: healthy |
| registry | registry_migrations: completed |
| kas | redis: healthy |
- Add KAS websocket secret volume mount, prerequisite from the companion CNG MR.
Notes
-
Compose v2 required. The
condition:syntax requires Docker Compose v2 (thedocker composeplugin, v2.17+). Legacydocker-composev1 does not support conditions. -
Webservice healthcheck is defined in the CNG image (HEALTHCHECK instruction), not in the compose file.
condition: service_healthyresolves via the image-level healthcheck. - Depends on CNG MR for the KAS websocket secret file. Merge CNG first.
- README update: The "down and re-up" workaround can be removed once this MR is merged. Happy to include that here or as a follow-up.
Related issues
Test plan
Tested 3 times from clean state (docker compose down -v) on CentOS Stream 10 (GCP, Docker CE 29.3.1, Compose v5.1.1) with CNG images v18.10.0:
| Run | Result | Duration | Webservice first-try? |
|---|---|---|---|
| 1 | PASSED | 218s | Yes |
| 2 | PASSED | 216s | Yes |
| 3 | All containers healthy | ~210s | Yes |
Webservice started successfully on the first docker compose up every time. No "down and re-up" needed.
AI-Generated Content Disclosure: This MR contains code generated with assistance from GitLab Duo and OpenCode. The output has been reviewed for correctness, tested, and validated against project requirements per GitLab's AI contribution guidelines.