Skip to content

Instantly share code, notes, and snippets.

@flyingwebie
Created October 1, 2025 16:47
Show Gist options
  • Save flyingwebie/a47cddf7b8209d1429dff425464fa2d0 to your computer and use it in GitHub Desktop.
Save flyingwebie/a47cddf7b8209d1429dff425464fa2d0 to your computer and use it in GitHub Desktop.
Flagsmith on Coolify - Docker Compose

Flagsmith Docker Compose for Coolify

A production-ready Docker Compose configuration for deploying Flagsmith (feature flag management platform) on Coolify with automatic SSL, database, and email support.

Features

✅ Automatic password generation for PostgreSQL and Django
✅ GitHub OAuth integration
✅ Email notifications via SMTP (Resend)
✅ Task processor for background jobs
✅ Automatic domain and SSL certificate management
✅ Postgres data persistence

Quick Start

  1. Upload this docker-compose.yml to Coolify as a new Service Stack

  2. Configure Environment Variables in Coolify UI:

    • GITHUB_CLIENT_ID - Your GitHub OAuth Client ID
    • GITHUB_CLIENT_SECRET - Your GitHub OAuth Client Secret (mark as secret)
    • EMAIL_HOST - SMTP host (e.g., smtp.resend.com)
    • SENDER_EMAIL - Email address for sending emails
    • EMAIL_HOST_USER - SMTP username
    • EMAIL_HOST_PASSWORD - SMTP password (mark as secret)
    • EMAIL_PORT - Optional, defaults to 587
    • EMAIL_USE_TLS - Optional, defaults to true
  3. 🚨 IMPORTANT: Configure Domain for Flagsmith Service

    • Click on the "Flagsmith" service in your Service Stack
    • In the "Domains" field, either:
      • Click "Generate Domain" to auto-generate a random subdomain
      • Or manually enter your domain: https://your-subdomain.yourdomain.com
    • Click "Save"
    • This step is REQUIRED for Coolify to generate COOLIFY_FQDN and expose the service publicly
  4. Deploy and wait for all services to start

What Gets Auto-Generated

Coolify automatically generates and manages:

  • SERVICE_PASSWORD_POSTGRES - Secure 64-character PostgreSQL password
  • SERVICE_PASSWORD_DJANGO - Secure 64-character Django secret key
  • COOLIFY_FQDN - Your generated domain (after you configure it in step 3)

Services Included

  • postgres - PostgreSQL 15.5 database with persistent storage
  • flagsmith - Main Flagsmith application (publicly exposed)
  • flagsmith-task-processor - Background task processor

Important Notes

⚠️ You MUST configure a domain for the Flagsmith service through Coolify's UI, otherwise it won't be publicly accessible and COOLIFY_FQDN won't be generated.

🔒 All sensitive variables are automatically encrypted by Coolify when marked as secrets.

📝 After deployment, update DJANGO_ALLOWED_HOSTS in production to your specific domain instead of '*'.

Accessing Flagsmith

After deployment and domain configuration, access Flagsmith at the generated URL shown in your Coolify Service Stack.

Documentation

volumes:
pgdata: null
services:
postgres:
image: 'postgres:15.5-alpine'
environment:
POSTGRES_PASSWORD: '${SERVICE_PASSWORD_POSTGRES}'
POSTGRES_DB: flagsmith
volumes:
- 'pgdata:/var/lib/postgresql/data'
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -d flagsmith -U postgres'
interval: 2s
timeout: 2s
retries: 20
start_period: 20s
flagsmith:
image: 'docker.flagsmith.com/flagsmith/flagsmith:latest'
environment:
DATABASE_URL: 'postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/flagsmith'
USE_POSTGRES_FOR_ANALYTICS: 'true'
ENVIRONMENT: production
DJANGO_ALLOWED_HOSTS: '*'
FLAGSMITH_DOMAIN: '${COOLIFY_FQDN}'
DJANGO_SECRET_KEY: '${SERVICE_PASSWORD_DJANGO}'
TASK_RUN_METHOD: TASK_PROCESSOR
PROMETHEUS_ENABLED: 'true'
GITHUB_CLIENT_ID: '${GITHUB_CLIENT_ID}'
GITHUB_CLIENT_SECRET: '${GITHUB_CLIENT_SECRET}'
EMAIL_HOST: '${EMAIL_HOST}'
SENDER_EMAIL: '${SENDER_EMAIL}'
EMAIL_HOST_USER: '${EMAIL_HOST_USER}'
EMAIL_HOST_PASSWORD: '${EMAIL_HOST_PASSWORD}'
EMAIL_PORT: '${EMAIL_PORT:-587}'
EMAIL_USE_TLS: '${EMAIL_USE_TLS:-true}'
expose:
- 8000
depends_on:
postgres:
condition: service_healthy
labels:
- coolify.enabled=true
- coolify.port=8000
- coolify.name=flagsmith
flagsmith-task-processor:
image: 'docker.flagsmith.com/flagsmith/flagsmith:latest'
environment:
DATABASE_URL: 'postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/flagsmith'
USE_POSTGRES_FOR_ANALYTICS: 'true'
DJANGO_ALLOWED_HOSTS: '*'
PROMETHEUS_ENABLED: 'true'
expose:
- 8000
depends_on:
- flagsmith
command: run-task-processor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment