[codex] add celery worker and beat to local compose#41
Conversation
📝 WalkthroughWalkthroughThis pull request adds Celery as an alternative task backend to the system. Environment variables configure Celery's broker, result storage, and task limits; the startup script conditionally launches Django Q based on the selected backend; and Docker Compose services are added to run Celery worker and beat scheduler containers. ChangesTask Backend Introduction with Celery Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/docker-compose/docker-compose.yml`:
- Around line 75-82: The compose setup lets celery and celerybeat depend on
datamingle with condition service_started which is too weak because datamingle
runs migrations at startup; add a proper readiness mechanism by either (A)
adding a healthcheck to the datamingle service that verifies migrations
completed and the app is responsive (e.g., hitting a /health or checking DB
schema) and change celery/celerybeat to depend_on datamingle: condition:
service_healthy, or (B) create a dedicated one-shot migration service (e.g.,
datamingle-migrate) that runs migrations and exits, make celery and celerybeat
depend_on that service with condition: service_completed_successfully, and
remove the service_started dependency; update service names datamingle, celery,
celerybeat, and datamingle-migrate accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a2d1538e-0d69-4fe0-8e8e-49c065268165
📒 Files selected for processing (5)
src/docker-compose/.envsrc/docker-compose/.env.local-armsrc/docker-compose/docker-compose.local-arm.ymlsrc/docker-compose/docker-compose.ymlsrc/docker/startup.sh
| depends_on: | ||
| redis: | ||
| condition: service_healthy | ||
| mysql: | ||
| condition: service_healthy | ||
| datamingle: | ||
| condition: service_started | ||
| volumes: |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Inspect migration flag and dependency conditions in compose:"
rg -n -C2 'RUN_MIGRATIONS_ON_START|depends_on:|condition: service_(started|healthy)|healthcheck:' src/docker-compose/docker-compose.ymlRepository: jruszo/Datamingle
Length of output: 1521
service_started is too weak for Celery startup ordering — workers can start before migrations complete.
celery and celerybeat wait only for datamingle to start (Lines 80–81, 104–105), not to finish migrations. Since datamingle runs migrations at startup (Line 66) but has no healthcheck, workers can begin executing tasks against an incomplete database schema, causing early boot failures.
Add a healthcheck to datamingle that waits for migrations and app readiness, or introduce a dedicated one-shot migration service that both celery and celerybeat depend on with condition: service_completed_successfully.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/docker-compose/docker-compose.yml` around lines 75 - 82, The compose
setup lets celery and celerybeat depend on datamingle with condition
service_started which is too weak because datamingle runs migrations at startup;
add a proper readiness mechanism by either (A) adding a healthcheck to the
datamingle service that verifies migrations completed and the app is responsive
(e.g., hitting a /health or checking DB schema) and change celery/celerybeat to
depend_on datamingle: condition: service_healthy, or (B) create a dedicated
one-shot migration service (e.g., datamingle-migrate) that runs migrations and
exits, make celery and celerybeat depend_on that service with condition:
service_completed_successfully, and remove the service_started dependency;
update service names datamingle, celery, celerybeat, and datamingle-migrate
accordingly.
What changed
celeryandcelerybeatservices to the local compose stacks.TASK_BACKEND=celerywith Redis broker/result settings.Why
Validation
docker-compose -f src/docker-compose/docker-compose.local-arm.yml configdocker-compose -f src/docker-compose/docker-compose.yml configdatamingle-app,datamingle-celery, anddatamingle-celerybeatwere running.Summary by CodeRabbit
Release Notes
New Features
Chores