Make Postgres wait timeout configurable#323
Conversation
… var Replace hard-coded wait-for-it timeouts with a configurable WAIT_POSTGRES_TIMEOUT environment variable (default: 180s) across all docker-compose files. This allows users on slower hardware to adjust the timeout without modifying the compose files.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated docker-compose configuration files to replace hardcoded Postgres readiness timeout values with parameterized environment variables. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request replaces the hardcoded 60-second timeout for PostgreSQL availability with a configurable WAIT_POSTGRES_TIMEOUT environment variable, defaulting to 180 seconds, across development and production Docker Compose files. The reviewer suggests documenting this new variable in example.env to maintain consistency with project standards. Additionally, there is a concern regarding a potential timeout conflict with the web service's 300-second wait period if the new Postgres timeout is configured too high.
| command: > | ||
| bash -c " | ||
| wait-for-it -s postgres.local:5432 -t 60 && | ||
| wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} && |
There was a problem hiding this comment.
The new WAIT_POSTGRES_TIMEOUT environment variable should be added to example.env with its default value (180). This ensures the configuration option is discoverable for users and documented in the standard environment template, following the repository's convention for key variables.
References
- Key environment variables should be documented in example.env. (link)
| command: > | ||
| bash -c " | ||
| wait-for-it -s postgres.local:5432 -t 60 && | ||
| wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} && |
There was a problem hiding this comment.
There is a potential timeout dependency issue. The web service (line 48) has a hardcoded 300-second timeout waiting for this init service. If WAIT_POSTGRES_TIMEOUT is set to a value close to or greater than 300, the web service will likely time out before init can complete its own wait for Postgres and subsequent migrations. It is recommended to also make the web service's wait timeout configurable or ensure it is always greater than the Postgres timeout to avoid race conditions during slow startups.
Summary
wait-for-ittimeouts with configurableWAIT_POSTGRES_TIMEOUTenvironment variable across all docker-compose files.envSee also openradx/radis#212
Test plan
docker compose configcorrectly interpolates the default (180s) whenWAIT_POSTGRES_TIMEOUTis unsetWAIT_POSTGRES_TIMEOUT=300in.envoverrides allwait-for-itcallsSummary by CodeRabbit