Skip to content

Rework the compose file for Coolify with external Postgres and Redis - #5

Merged
hamza-lem merged 3 commits into
upshift-mainfrom
feat/coolify-compose
Oct 8, 2026
Merged

hamza-lem merged 3 commits into
upshift-mainfrom
feat/coolify-compose

Conversation

@hamza-lem

Copy link
Copy Markdown
Collaborator

What

upshift/docker/docker-compose.yml now follows the Coolify setup used for Twenty:

  • Postgres and Redis are existing servers given by variables (PG_DATABASE_HOST/PORT, POSTGRES_DB, REDIS_HOST/PORT/USER/PASSWORD) instead of a hard-coded IP.
  • Coolify generates the app secret (SERVICE_BASE64_32_SECRET becomes APP_SECRET) and routes the domain to the upshift service (SERVICE_URL_UPSHIFT_3000).
  • A Traefik CORS middleware, upshift-cors, takes its origin regex from TRAEFIK_CORS_ORIGIN_REGEX and is attached with coolify.traefik.middlewares, so no generated router name is needed.
  • Required values use ${VAR:?}, so Coolify blocks the deployment until they are set. Optional ones have defaults, because Twenty fails validation on some empty values (an empty FRONTEND_URL for example).
  • Variables Twenty no longer reads are gone: ENABLE_DB_MIGRATIONS, CACHE_STORAGE_TYPE, MESSAGE_QUEUE_TYPE, POSTGRES_ADMIN_PASSWORD, EMAIL_SYSTEM_ADDRESS, IS_SIGN_UP_DISABLED, DEBUG_MODE, API_RATE_LIMITING_TTL/LIMIT.

The new docker-compose.local.yml adds Postgres, Redis and the published port. .env.example lists it in COMPOSE_FILE, so cp .env.example .env && docker compose up -d still starts a complete stack, and the release smoke test uses it too.

Coolify setup

  • Untick Escape special characters in labels? on the resource. While it is ticked, Coolify passes ${TRAEFIK_CORS_ORIGIN_REGEX:?} to Traefik literally.
  • Mark TRAEFIK_CORS_ORIGIN_REGEX as Literal: it contains $.
  • Replace the generated SERVICE_USER_POSTGRES / SERVICE_PASSWORD_POSTGRES with the external database's credentials.

upshift/README.md has a new "Deploying with Coolify" section with the full variable table, including how to move an existing Twenty resource (keep its SERVICE_BASE64_32_SECRET, set POSTGRES_DB to its database).

Checked

  • docker compose config with the .env.example values, with Coolify-style values (external hosts, multi-workspace, S3, regex unquoted), and with no values (fails on the first required variable).
  • The smoke step's script, extracted from the workflow and run locally: the override reaches both upshift and worker, Postgres and Redis come from the overlay, port 3000 is published.
  • A real boot with the local overlay: server and worker healthy, migrations and cron registration done. It used twentycrm/twenty:v2.45.6, because pulling ghcr.io/exceev-technology/upshift without credentials returned unauthorized; Coolify servers need registry credentials unless the package is public.

Note

Since the cookie-session migration, Twenty answers CORS itself for the origins in AUTH_COOKIE_ALLOWED_ORIGINS and returns 403 to cookie-authenticated POSTs from any other origin. A new workspace subdomain still has to be added to that list; the Traefik regex alone does not let it in.

The server and worker now read Postgres and Redis from variables, use
Coolify's generated secret and routing variables, and attach a Traefik
CORS middleware whose origin regex comes from TRAEFIK_CORS_ORIGIN_REGEX.
docker-compose.local.yml adds Postgres, Redis and the published port for
hosts without Coolify and for the release smoke test.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb308cd21b

ℹ️ 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".

Comment thread upshift/docker/docker-compose.yml Outdated
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T10:04:42.252457Z 4dfc7e3 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5648a0485

ℹ️ 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".

Comment thread .github/workflows/upshift-release.yaml Outdated
Comment thread upshift/README.md Outdated
@hamza-lem
hamza-lem merged commit 659693e into upshift-main Oct 8, 2026
3 checks passed
@hamza-lem
hamza-lem deleted the feat/coolify-compose branch October 8, 2026 10:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dfc7e3d74

ℹ️ 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".

healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
test: ['CMD-SHELL', "pgrep -f 'worker:prod' > /dev/null || exit 1"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid matching the healthcheck shell itself

Whenever this CMD-SHELL probe runs, its own shell command line contains the literal worker:prod; BusyBox documents pgrep -f as matching the entire command line, so the probe matches its parent shell and succeeds regardless of whether the worker process exists. This makes Docker/Coolify report the worker as healthy even when it never started or has stopped while the container remains running; use a pattern absent from the probe command or check the actual worker PID.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant