-
Notifications
You must be signed in to change notification settings - Fork 5
Add EC2 deployment configuration for Celery workers and Flower, and update Docker Compose for Flower service #388
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -74,7 +74,18 @@ CELERY_ENABLE_UTC=true | |||||||||||||||||
# India Standard Time (UTC+05:30) | ||||||||||||||||||
CELERY_TIMEZONE=Asia/Kolkata | ||||||||||||||||||
|
||||||||||||||||||
# Flower Configuration (Celery Monitoring) | ||||||||||||||||||
FLOWER_PORT=5555 | ||||||||||||||||||
FLOWER_BASIC_AUTH=admin:changethis | ||||||||||||||||||
FLOWER_URL_PREFIX= | ||||||||||||||||||
FLOWER_MAX_TASKS=10000 | ||||||||||||||||||
|
||||||||||||||||||
# Callback Timeouts (in seconds) | ||||||||||||||||||
CALLBACK_CONNECT_TIMEOUT = 3 | ||||||||||||||||||
CALLBACK_READ_TIMEOUT = 10 | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
# EC2 Deployment Configuration for Celery Workers | ||||||||||||||||||
EC2_HOST=production-celery-host.example.com | ||||||||||||||||||
EC2_USER=ubuntu | ||||||||||||||||||
EC2_KEY=production-ec2-key | ||||||||||||||||||
Comment on lines
+88
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t suggest storing SSH private keys in env files. EC2_KEY in an env example nudges insecure practices. Use GitHub Actions secrets or SSM Parameter Store; keep only host/user hints in .env.example. -# EC2 Deployment Configuration for Celery Workers
-EC2_HOST=production-celery-host.example.com
-EC2_USER=ubuntu
-EC2_KEY=production-ec2-key
+# EC2 Deployment Configuration (reference only; use GitHub Secrets/SSM in CI)
+EC2_HOST=production-celery-host.example.com
+EC2_USER=ubuntu
+# EC2_KEY is intentionally not listed; store as a secret (not in .env files). 📝 Committable suggestion
Suggested change
🧰 Tools🪛 dotenv-linter (3.3.0)[warning] 91-91: [UnorderedKey] The EC2_KEY key should go before the EC2_USER key (UnorderedKey) 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -92,6 +92,31 @@ services: | |||||||||||||
- backend | ||||||||||||||
command: ["uv", "run", "celery", "-A", "app.celery.celery_app", "worker", "--loglevel=info", "--concurrency=2"] | ||||||||||||||
|
||||||||||||||
flower: | ||||||||||||||
build: | ||||||||||||||
context: ./backend | ||||||||||||||
dockerfile: Dockerfile.celery | ||||||||||||||
environment: | ||||||||||||||
- ENVIRONMENT=development | ||||||||||||||
- REDIS_HOST=redis | ||||||||||||||
- RABBITMQ_HOST=rabbitmq | ||||||||||||||
- RABBITMQ_USER=guest | ||||||||||||||
- RABBITMQ_PASSWORD=guest | ||||||||||||||
env_file: | ||||||||||||||
- ./.env | ||||||||||||||
ports: | ||||||||||||||
- "5555:5555" | ||||||||||||||
volumes: | ||||||||||||||
- ./backend:/app # Mount for live code changes | ||||||||||||||
- /app/.venv # Exclude .venv from volume mount | ||||||||||||||
networks: | ||||||||||||||
- app-network | ||||||||||||||
depends_on: | ||||||||||||||
- redis | ||||||||||||||
- rabbitmq | ||||||||||||||
- celery-worker | ||||||||||||||
command: ["uv", "run", "celery", "-A", "app.celery.celery_app", "flower", "--port=5555"] | ||||||||||||||
|
||||||||||||||
Comment on lines
+118
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Secure Flower: enforce auth and use env-driven flags (switch to shell form). Flower is exposed on 0.0.0.0:5555 without basic auth or URL prefix; env vars in .env.example are not consumed by Flower unless passed as CLI flags. Also, array-form command won’t reliably expand env vars. Use shell-form, add auth, and honor FLOWER_*. Apply this diff: - command: ["uv", "run", "celery", "-A", "app.celery.celery_app", "flower", "--port=5555"]
+ command: uv run celery -A app.celery.celery_app flower \
+ --port=${FLOWER_PORT:-5555} \
+ --basic_auth="${FLOWER_BASIC_AUTH:-}" \
+ --url_prefix="${FLOWER_URL_PREFIX:-}" \
+ --max_tasks=${FLOWER_MAX_TASKS:-10000} 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||
networks: | ||||||||||||||
app-network: | ||||||||||||||
driver: bridge | ||||||||||||||
|
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.
Flower defaults: warn and align with CLI usage.
Good to document, but note Flower won’t auto-read these names; they must be passed via CLI flags (addressed in workflows/compose). Also, don’t ship weak defaults.
Apply this diff to discourage weak creds:
📝 Committable suggestion
🧰 Tools
🪛 dotenv-linter (3.3.0)
[warning] 79-79: [UnorderedKey] The FLOWER_BASIC_AUTH key should go before the FLOWER_PORT key
(UnorderedKey)
[warning] 81-81: [UnorderedKey] The FLOWER_MAX_TASKS key should go before the FLOWER_PORT key
(UnorderedKey)
🤖 Prompt for AI Agents