[codex] Use managed Redis and Postgres in Coolify compose#279
[codex] Use managed Redis and Postgres in Coolify compose#279michaelmwu wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThis PR refactors the deployment architecture to separate the base application stack from local development infrastructure. Postgres credentials are now safely URL-encoded to prevent special characters from breaking connection strings. The compose files are split: ChangesCompose Architecture and Credential Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates deployment configuration so production Coolify uses managed Redis/Postgres URLs while local development keeps Docker-managed Redis/Postgres through the local Compose wrapper.
Changes:
- Removes Redis/Postgres containers from base
compose.yamland requires managedREDIS_URL/POSTGRES_URL. - Moves local Redis/Postgres services into
compose.local.yaml. - Updates local scripts and documentation for generated, URL-encoded Postgres DSNs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
compose.yaml |
Converts the base app stack to require external Redis/Postgres URLs. |
compose.local.yaml |
Adds local Redis/Postgres services and local app overrides. |
scripts/docker-compose.sh |
Generates local Compose service URLs for Redis/Postgres. |
scripts/dev.sh |
Generates host-run service URLs with encoded Postgres credentials. |
README.md |
Documents managed production URLs and local Compose behavior. |
ENVIRONMENT.md |
Updates environment variable guidance for managed/local URLs. |
DEVELOPMENT.md |
Updates local development and Compose guidance. |
AGENTS.md |
Updates agent-facing Compose architecture notes. |
.env.example |
Adds guidance for URL-encoding Postgres credentials. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "$1" | ||
| } | ||
|
|
||
| POSTGRES_USER_ENC=$(url_quote "$POSTGRES_USER") | ||
| POSTGRES_PASSWORD_ENC=$(url_quote "$POSTGRES_PASSWORD") | ||
| POSTGRES_DB_ENC=$(url_quote "$POSTGRES_DB") |
| } | ||
|
|
||
| POSTGRES_USER_ENC=$(url_quote "$POSTGRES_USER") | ||
| POSTGRES_PASSWORD_ENC=$(url_quote "$POSTGRES_PASSWORD") |
| Use `.env.example` as source of truth. Key categories: | ||
|
|
||
| - Shared queue/runtime: `REDIS_URL`, `REDIS_QUEUE_NAME`, `POSTGRES_URL`, `JOB_MAX_ATTEMPTS`, `JOB_RETRY_BASE_SECONDS`, `JOB_RETRY_MAX_SECONDS`, `LOG_LEVEL`, webhook settings. Local defaults target host-run services; `docker-compose.yml` injects Docker-network URLs for containerized runs. | ||
| - Shared queue/runtime: `REDIS_URL`, `REDIS_QUEUE_NAME`, `POSTGRES_URL`, `JOB_MAX_ATTEMPTS`, `JOB_RETRY_BASE_SECONDS`, `JOB_RETRY_MAX_SECONDS`, `LOG_LEVEL`, webhook settings. Local defaults target host-run services; `compose.local.yaml` injects Docker-network Redis/Postgres URLs for local containerized runs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe48ae77bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| REDIS_URL: redis://redis:6379/0 | ||
| POSTGRES_USER: ${POSTGRES_USER:-postgres} | ||
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} | ||
| POSTGRES_DB: ${POSTGRES_DB:-workflows} |
There was a problem hiding this comment.
Override POSTGRES_URL in the local overlay
When compose.local.yaml is loaded directly with compose.yaml (for example by tools using the overlay rather than scripts/docker-compose.sh), Compose merges the environment maps, so the base POSTGRES_URL entry remains. With the .env.example default copied to .env, the web and worker containers keep postgresql://...@127.0.0.1:5432/... and fail to connect to the local postgres service even though this overlay starts and waits for it; the wrapper masks this by exporting a Docker-network URL, but the overlay itself should also override POSTGRES_URL like it does for Redis.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/docker-compose.sh (1)
25-25: ⚡ Quick winRemove unused individual Postgres credential variables from compose.local.yaml.
The application only uses
POSTGRES_URL(referenced inapps/worker/src/five08/worker/migrations/env.py), not the individualPOSTGRES_USER,POSTGRES_PASSWORD, andPOSTGRES_DBvariables. Remove these fromcompose.local.yamlto eliminate configuration clutter and avoid maintenance issues from accidental divergence between the URL-encoded and raw credential forms.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/docker-compose.sh` at line 25, The compose file sets POSTGRES_URL and also exports individual credential vars (POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB / their _ENC variants) which are unused; remove the individual Postgres credential variables from compose.local.yaml so only POSTGRES_URL remains, and verify that the application (see env.py usage of POSTGRES_URL) still works with the URL-only config and no references to POSTGRES_USER/POSTGRES_PASSWORD/POSTGRES_DB remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/docker-compose.sh`:
- Line 25: The compose file sets POSTGRES_URL and also exports individual
credential vars (POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB / their _ENC
variants) which are unused; remove the individual Postgres credential variables
from compose.local.yaml so only POSTGRES_URL remains, and verify that the
application (see env.py usage of POSTGRES_URL) still works with the URL-only
config and no references to POSTGRES_USER/POSTGRES_PASSWORD/POSTGRES_DB remain.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5153ff47-536d-4ad8-a67e-0d21d6d34937
📒 Files selected for processing (9)
.env.exampleAGENTS.mdDEVELOPMENT.mdENVIRONMENT.mdREADME.mdcompose.local.yamlcompose.yamlscripts/dev.shscripts/docker-compose.sh
Description
Moves Redis and Postgres out of the canonical Coolify
compose.yamlso production deploys use managedREDIS_URLandPOSTGRES_URLruntime variables. Expandscompose.local.yamland the local Compose wrapper to keep Docker-managed Redis/Postgres for local development, including URL-encoded generated Postgres connection strings.Related Issue
N/A
How Has This Been Tested?
Validated the local Compose wrapper, base Coolify compose config with managed Redis/Postgres URLs and no
.env, required-variable failure without those URLs, reserved-character Postgres password encoding, andgit diff --check.Summary by CodeRabbit
Documentation
Chores