-
Notifications
You must be signed in to change notification settings - Fork 4
Docker Compose Configuration Enhancements #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d simplify service definitions by removing Traefik-related settings.
…, update PostgreSQL settings, and improve health checks and environment variable management for backend services in docker compose
…y_worker and celery_beat services, and streamline environment variable management for backend services.
WalkthroughConsolidated local deployment: updated .env template, removed multiple compose override files (dev/override/traefik), and expanded Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant DC as Docker Compose
participant DB as postgres-db
participant RD as redis
participant MQ as rabbitmq
participant AD as adminer
participant PS as prestart
participant BE as backend
participant CW as celery_worker
participant CF as celery_flower
Dev->>DC: docker compose up (--profile prestart?)
DC->>DB: start postgres-db (env_file, volume, healthcheck)
DC->>RD: start redis (env_file, optional password, healthcheck)
DC->>MQ: start rabbitmq (env_file, management port, healthcheck)
DC->>AD: start adminer
alt prestart profile used
DC->>PS: run prestart (migrations & seed)
PS->>DB: apply migrations / seed
end
note right of DB: healthchecks ensure readiness
DC->>BE: start backend when DB/RD/MQ healthy
DC->>CW: start celery_worker when DB/RD/MQ healthy
DC->>CF: start celery_flower when backend ready
BE->>DB: connect via POSTGRES_SERVER
BE->>RD: connect via REDIS_HOST
BE->>MQ: connect via RABBITMQ_HOST
CW->>DB: connect
CW->>RD: connect
CW->>MQ: connect
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docker-compose.yml (1)
88-91
:depends_on
schema violation stops Compose from parsing.
Therestart: true
entry isn’t part of the Compose spec fordepends_on
, so the CLI rejects the file before deployment. Drop that key so the service graph can be evaluated.depends_on: db: condition: service_healthy - restart: true
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.env.example
(2 hunks)docker-compose.dev.yml
(0 hunks)docker-compose.override.yml
(0 hunks)docker-compose.traefik.yml
(0 hunks)docker-compose.yml
(2 hunks)
💤 Files with no reviewable changes (3)
- docker-compose.override.yml
- docker-compose.traefik.yml
- docker-compose.dev.yml
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
.env.example
[warning] 53-53: [UnorderedKey] The RABBITMQ_PASSWORD key should go before the RABBITMQ_PORT key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: checks (3.11.7, 6)
…ce and remove unused celery_beat service.
…name, and database settings in .env.example; enhance README with service dependency warnings and startup options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.env.example
(3 hunks)README.md
(1 hunks)docker-compose.yml
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- README.md
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
.env.example
[warning] 17-17: [QuoteCharacter] The value has quote characters (', ")
(QuoteCharacter)
[warning] 29-29: [UnorderedKey] The POSTGRES_DB key should go before the POSTGRES_PORT key
(UnorderedKey)
[warning] 82-82: [QuoteCharacter] The value has quote characters (', ")
(QuoteCharacter)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: checks (3.11.7, 6)
- EMAIL_TEST_USER=${EMAIL_TEST_USER} | ||
- AWS_S3_BUCKET_PREFIX=${AWS_S3_BUCKET_PREFIX} | ||
POSTGRES_SERVER: db | ||
profiles: ["prestart"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just clarifying question why we need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build: | ||
context: ./backend | ||
ports: | ||
- "8000:80" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 8000:80
and not 8000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map port 8000 on my local machine (host) to port 80 inside the container. ( container start app at port 80)
|
||
|
||
celery_worker: | ||
image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG:-latest}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also be built like backend from source, not from image
one other simplification can be done; realised this while deploying to ECS - we probably don't need two Dockerfiles like there are right now; the same Dockerfile can be used to build both backend and celery-worker containers, jus the RUN/CMD needs to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docker-compose.yml (1)
84-91
: Remove unsupportedrestart
key fromdepends_on
.
restart: true
isn’t a valid property inside thedepends_on
block, sodocker compose config
fails with “Additional property restart is not allowed.” Drop that line to keep the config schema‑compliant.depends_on: db: condition: service_healthy - restart: true
🧹 Nitpick comments (1)
README.md (1)
47-50
: Fix the “Boostrap” typo.Rename the section header to “Bootstrap & development mode” to avoid the misspelling.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md
(1 hunks)backend/Dockerfile
(2 hunks)backend/Dockerfile.celery
(0 hunks)docker-compose.yml
(2 hunks)
💤 Files with no reviewable changes (1)
- backend/Dockerfile.celery
✅ Files skipped from review due to trivial changes (1)
- backend/Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docker-compose.yml (1)
88-91
: Invalid key under depends_on; compose will fail to parse.
restart: true
is not allowed insidedepends_on
. Remove it (and optionally set a service-level restart policy if desired).depends_on: db: condition: service_healthy - restart: true
🧹 Nitpick comments (5)
backend/Dockerfile (1)
52-56
: Remove commented-out CMD examples to avoid drift/confusion.Compose overrides the command per service; keeping example CMDs here can mislead. Prefer documenting in README or compose.
-# command for Celery worker -# CMD ["uv", "run", "celery", "-A", "app.celery.celery_app", "worker", "--loglevel=info"] - -# command for Celery Flower -# CMD ["uv", "run", "celery", "-A", "app.celery.celery_app", "flower", "--port=5555"]docker-compose.yml (4)
144-147
: Avoid unnecessary coupling on backend health; depend on actual infra.Celery services only need DB/Redis/RabbitMQ. Depending on backend health can block workers unnecessarily.
-celery_worker: - depends_on: - backend: - condition: service_healthy +celery_worker: + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + rabbitmq: + condition: service_healthy @@ -celery_flower: - depends_on: - backend: - condition: service_healthy +celery_flower: + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + rabbitmq: + condition: service_healthyAlso applies to: 161-164
23-24
: Bind dev ports to localhost to avoid exposing services on all interfaces.Reduces accidental exposure on shared networks.
- - "5432:5432" + - "127.0.0.1:5432:5432" @@ - - "6379:6379" + - "127.0.0.1:6379:6379" @@ - - "5672:5672" - - "15672:15672" + - "127.0.0.1:5672:5672" + - "127.0.0.1:15672:15672" @@ - - "8080:8080" + - "127.0.0.1:8080:8080" @@ - - "8000:80" + - "127.0.0.1:8000:80" @@ - - "5555:5555" + - "127.0.0.1:5555:5555"Also applies to: 41-41, 62-63, 80-80, 117-118, 167-167
83-85
: Normalize TAG default expansion for consistency.Use the same
${TAG:-latest}
form everywhere (treats empty as unset too).- image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}" + image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG:-latest}"
75-80
: Consider waiting for DB health before starting Adminer.Not strictly required, but avoids transient errors on first load.
depends_on: - - db + db: + condition: service_healthy
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md
(1 hunks)backend/Dockerfile
(2 hunks)backend/Dockerfile.celery
(0 hunks)docker-compose.yml
(2 hunks)
💤 Files with no reviewable changes (1)
- backend/Dockerfile.celery
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: checks (3.11.7, 6)
🔇 Additional comments (2)
backend/Dockerfile (1)
1-1
: Good clarification.Single Dockerfile approach is clear and aligns with compose usage.
README.md (1)
66-78
: Confirm Compose Watch availability across dev environments.“docker compose watch” requires a recent Docker Desktop/Compose version. Please confirm team machines meet this requirement or add a brief note with minimum versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: checks (3.11.7, 6)
Summary
Target issue is #386
This PR significantly enhances the Docker Compose configuration to provide a complete containerized development environment with improved service orchestration, dependency management.
New Services Added
Infrastructure Improvements
Configuration Cleanup
Summary by CodeRabbit
New Features
Refactor
Chores
Documentation