feat: add Coolify self-hosting guide and configuration#1613
Open
Babs90000 wants to merge 1 commit into
Open
Conversation
Reviewer's GuideAdds a new Coolify-based self-hosting deployment guide and configuration for AppFlowy Cloud, including Docker Compose, Nginx proxy routing (with a specific fix for /api/user/verify), and environment templates, and links it from the main deployment documentation. Sequence diagram for /api/user/verify magic-link verification routing (sequence)sequenceDiagram
actor User
participant Browser
participant Traefik
participant NginxProxy as Nginx_proxy
participant AppFlowyCloud as appflowy_cloud
User->>Browser: Click magic link from email
Browser->>Traefik: GET https://appflowy.domain/api/user/verify/{token}
Traefik->>NginxProxy: Forward request (HTTP)
Note over NginxProxy: Location match: /api/user/verify/(.+) before /api/
NginxProxy->>AppFlowyCloud: GET /api/user/verify/{token}
AppFlowyCloud-->>NginxProxy: 302 redirect or 200 JSON
NginxProxy-->>Traefik: Response
Traefik-->>Browser: Response
Browser-->>User: Session established in AppFlowy UI
Flow diagram for Coolify-based AppFlowy Cloud deployment steps (flow)flowchart TD
A[Start] --> B[Prepare Supabase auth DB<br>CREATE DATABASE appflowy_gotrue<br>GRANT on schemas to supabase_auth_admin]
B --> C[Prepare AppFlowy DB<br>CREATE DATABASE appflowy_cloud<br>CREATE USER appflowy_user<br>CREATE EXTENSION vector]
C --> D[Copy .env.example to .env<br>Fill environment variables]
D --> E[Create Docker Compose service in Coolify]
E --> F[Upload docker-compose.yml and nginx-proxy.conf<br>To service directory]
F --> G[Set env vars in Coolify UI]
G --> H[Deploy service stack]
H --> I[Verify deployment<br>curl /api/server-info/auth-providers<br>Expect HTTP 200]
I --> J[AppFlowy Cloud ready on Coolify]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The docker-compose.yml is tightly bound to a specific Coolify instance (hard-coded domains like
*.kdevs.io, resource UUIDs, external network names, and service IDs); consider replacing these with generic placeholders or environment-based variables so others can reuse the file without editing dozens of values. - In nginx-proxy.conf you proxy to
http://gotrue:8081, but there is noupstream gotrueblock defined like you did forcloudandweb, which will cause nginx startup failures; add an upstream for the gotrue service. - There is a lot of duplicated configuration in docker-compose.yml (e.g., AF_* environment variables repeated across services and duplicate
traefik.enablelabels ongotrue); you could simplify by relying more on the shared.envfile and removing redundant labels/vars to make the compose file easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The docker-compose.yml is tightly bound to a specific Coolify instance (hard-coded domains like `*.kdevs.io`, resource UUIDs, external network names, and service IDs); consider replacing these with generic placeholders or environment-based variables so others can reuse the file without editing dozens of values.
- In nginx-proxy.conf you proxy to `http://gotrue:8081`, but there is no `upstream gotrue` block defined like you did for `cloud` and `web`, which will cause nginx startup failures; add an upstream for the gotrue service.
- There is a lot of duplicated configuration in docker-compose.yml (e.g., AF_* environment variables repeated across services and duplicate `traefik.enable` labels on `gotrue`); you could simplify by relying more on the shared `.env` file and removing redundant labels/vars to make the compose file easier to maintain.
## Individual Comments
### Comment 1
<location path="deploy/coolify/docker-compose.yml" line_range="50" />
<code_context>
+ GOTRUE_JWT_SECRET: '${AF_JWT_SECRET}'
+ GOTRUE_JWT_EXP: '7200'
+ GOTRUE_DB_DRIVER: postgres
+ DATABASE_URL: 'postgres://supabase_auth_admin:${SUPABASE_AUTH_PASSWORD}@supabase-db-sk44w4s8sgsk4k4s040c4ooc:5432/appflowy_gotrue'
+ GOTRUE_SMTP_HOST: '${AF_SMTP_HOST}'
+ GOTRUE_SMTP_PORT: '${AF_SMTP_PORT}'
</code_context>
<issue_to_address>
**question (bug_risk):** Clarify and align the Postgres host with the networks/services defined in this compose file.
The `DATABASE_URL` host (`supabase-db-sk44w4s8sgsk4k4s040c4ooc`) doesn’t match any service or network alias in this compose file. If it’s an external container on a shared Docker network, please use and document a stable, reproducible hostname (e.g., `supabase-db` or a DNS name) instead of an environment‑specific identifier.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
f698ee7 to
1221f9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a dedicated deployment guide and the necessary configuration files to run AppFlowy Cloud on Coolify.
Coolify is an open-source, self-hosted Heroku/Netlify alternative that is becoming very popular. This addition makes AppFlowy Cloud much more accessible for users who want an easy deployment experience on their own servers.
Changes
deploy/coolify/to keep the root clean. This folder contains:README.md: A complete step-by-step guide in both English and French.docker-compose.yml: Optimized configuration for Coolify services.nginx-proxy.conf: Routing configuration, including the critical fix for/api/user/verify..env.example: Template for required environment variables.doc/DEPLOYMENT.mdto link to this new community guide.Why this is useful
Coolify users often struggle with the specific Nginx routing requirements for AppFlowy's auth flow. This pre-configured setup solves those issues out-of-the-box.
Verification
Tested and verified on Coolify v4.0.0-beta.463.
Summary by Sourcery
Add a self-hosted AppFlowy Cloud deployment setup for Coolify and link it from the main deployment documentation.
New Features:
Documentation: