Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
- ${REMOTE_DEBUGGING_PORT:-5678}:5678
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Key environment variables should be documented in example.env. (link)

./manage.py migrate &&
./manage.py create_superuser &&
./manage.py create_example_users &&
Expand All @@ -53,7 +53,7 @@ services:
image: adit_dev-default_worker:latest
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&
./manage.py bg_worker -l debug -q default --autoreload
"

Expand All @@ -62,7 +62,7 @@ services:
image: adit_dev-dicom_worker:latest
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&
./manage.py bg_worker -l debug -q dicom --autoreload
"

Expand Down
6 changes: 3 additions & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
hostname: init.local
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

./manage.py migrate &&
./manage.py collectstatic --no-input &&
./manage.py create_superuser &&
Expand Down Expand Up @@ -61,7 +61,7 @@ services:
<<: *default-app
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&
./manage.py bg_worker -q default
"
deploy:
Expand All @@ -71,7 +71,7 @@ services:
<<: *default-app
command: >
bash -c "
wait-for-it -s postgres.local:5432 -t 60 &&
wait-for-it -s postgres.local:5432 -t ${WAIT_POSTGRES_TIMEOUT:-180} &&
./manage.py bg_worker -q dicom
"
deploy:
Expand Down
Loading