From 5ca048afcf29dd0af74eba5aecf2da7e9cd5f329 Mon Sep 17 00:00:00 2001 From: Dries Augustyns Date: Tue, 12 May 2026 22:17:35 +0200 Subject: [PATCH] Update Plunk template to use next version (#622) * Update Plunk template to use next version * Add domain configuration to config.env * Remove NTFY from Plunk --- blueprints/plunk/docker-compose.yml | 186 ++++++++++++++++++++++------ blueprints/plunk/template.toml | 120 +++++++++++++++--- 2 files changed, 252 insertions(+), 54 deletions(-) diff --git a/blueprints/plunk/docker-compose.yml b/blueprints/plunk/docker-compose.yml index 914001cf..9991d855 100644 --- a/blueprints/plunk/docker-compose.yml +++ b/blueprints/plunk/docker-compose.yml @@ -1,58 +1,166 @@ -# IMPORTANT: Plunk requires HTTPS to work properly -# go to the "Domains" tab and enable HTTPS for your domain +# Plunk Self-Hosting Docker Compose for Dokploy +# This setup runs all Plunk services with nginx reverse proxy +# +# IMPORTANT: This template requires multiple subdomains: +# - api.yourdomain.com -> API Server +# - app.yourdomain.com -> Web Dashboard +# - www.yourdomain.com -> Landing Page +# - docs.yourdomain.com -> Documentation +# - minio.yourdomain.com -> Minio Console (optional) +# +# All domains will be automatically configured in Dokploy services: - plunk: - image: driaug/plunk - expose: - - "3000" - depends_on: - db: - condition: service_healthy - redis: - condition: service_started - environment: - REDIS_URL: ${REDIS_URL} - DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} - JWT_SECRET: ${JWT_SECRET} - AWS_REGION: ${AWS_REGION} - AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} - AWS_SES_CONFIGURATION_SET: ${AWS_SES_CONFIGURATION_SET} - APP_URI: ${APP_URI} - NEXT_PUBLIC_API_URI: ${APP_URI}/api - API_URI: ${APP_URI}/api - DISABLE_SIGNUPS: ${DISABLE_SIGNUPS} - entrypoint: ["/app/entry.sh"] - restart: unless-stopped + # ============================================ + # Infrastructure Services + # ============================================ - db: - image: postgres:alpine + postgres: + image: postgres:16-alpine + restart: unless-stopped environment: - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_DB: plunk + POSTGRES_USER: plunk + POSTGRES_PASSWORD: ${DB_PASSWORD} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] + test: ["CMD-SHELL", "pg_isready -U plunk"] interval: 10s + timeout: 5s retries: 5 - timeout: 10s - restart: unless-stopped - expose: - - 5432 redis: - image: redis:alpine + image: redis:7-alpine restart: unless-stopped - expose: - - 6379 + command: redis-server --appendonly yes volumes: - redis_data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + + minio: + image: minio/minio:latest + restart: unless-stopped + command: server /data --console-address ":9001" + environment: + MINIO_ROOT_USER: ${MINIO_ROOT_USER} + MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} + volumes: + - minio_data:/data + ports: + - 9000 + - 9001 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + # ============================================ + # Plunk Application + # ============================================ + + plunk: + image: ghcr.io/useplunk/plunk:latest + restart: unless-stopped + environment: + # Service mode - runs all services in one container + SERVICE: all + NODE_ENV: production + + # Database + DATABASE_URL: postgresql://plunk:${DB_PASSWORD}@postgres:5432/plunk + DIRECT_DATABASE_URL: postgresql://plunk:${DB_PASSWORD}@postgres:5432/plunk + + # Redis + REDIS_URL: ${REDIS_URL} + + # Security + JWT_SECRET: ${JWT_SECRET} + + # Nginx configuration + NGINX_PORT: ${NGINX_PORT} + + # Domain configuration (subdomain-based routing) + API_DOMAIN: ${API_DOMAIN} + DASHBOARD_DOMAIN: ${DASHBOARD_DOMAIN} + LANDING_DOMAIN: ${LANDING_DOMAIN} + WIKI_DOMAIN: ${WIKI_DOMAIN} + USE_HTTPS: ${USE_HTTPS} + + # AWS SES (for sending emails) - REQUIRED + AWS_SES_REGION: ${AWS_SES_REGION} + AWS_SES_ACCESS_KEY_ID: ${AWS_SES_ACCESS_KEY_ID} + AWS_SES_SECRET_ACCESS_KEY: ${AWS_SES_SECRET_ACCESS_KEY} + SES_CONFIGURATION_SET: ${SES_CONFIGURATION_SET} + SES_CONFIGURATION_SET_NO_TRACKING: ${SES_CONFIGURATION_SET_NO_TRACKING} + + # Optional: OAuth + GITHUB_OAUTH_CLIENT: ${GITHUB_OAUTH_CLIENT} + GITHUB_OAUTH_SECRET: ${GITHUB_OAUTH_SECRET} + GOOGLE_OAUTH_CLIENT: ${GOOGLE_OAUTH_CLIENT} + GOOGLE_OAUTH_SECRET: ${GOOGLE_OAUTH_SECRET} + + # Optional: Stripe + STRIPE_SK: ${STRIPE_SK} + STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET} + STRIPE_PRICE_ONBOARDING: ${STRIPE_PRICE_ONBOARDING} + STRIPE_PRICE_EMAIL_USAGE: ${STRIPE_PRICE_EMAIL_USAGE} + STRIPE_METER_EVENT_NAME: ${STRIPE_METER_EVENT_NAME} + + # S3-compatible storage (Minio) + S3_ENDPOINT: ${S3_ENDPOINT} + S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID} + S3_ACCESS_KEY_SECRET: ${S3_ACCESS_KEY_SECRET} + S3_BUCKET: ${S3_BUCKET} + S3_PUBLIC_URL: ${S3_PUBLIC_URL} + S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE} + + # SMTP Server (for sending emails via SMTP) + SMTP_DOMAIN: ${SMTP_DOMAIN} + PORT_SECURE: ${PORT_SECURE} + PORT_SUBMISSION: ${PORT_SUBMISSION} + + # Internal + PLUNK_API_KEY: ${PLUNK_API_KEY} + PLUNK_FROM_ADDRESS: ${PLUNK_FROM_ADDRESS} + + volumes: + # Mount Traefik certificates for SSL + - /etc/dokploy/traefik/dynamic/acme.json:/certs/acme.json:ro + + ports: + # Main nginx port (handles all subdomain routing) + - 80 + # SMTP ports (for email relay) + - 465 + - 587 + + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + minio: + condition: service_healthy + + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80/"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s volumes: postgres_data: driver: local redis_data: - driver: local \ No newline at end of file + driver: local + minio_data: + driver: local + plunk_data: + driver: local diff --git a/blueprints/plunk/template.toml b/blueprints/plunk/template.toml index 831f2c47..ce92c1fe 100644 --- a/blueprints/plunk/template.toml +++ b/blueprints/plunk/template.toml @@ -1,30 +1,120 @@ [variables] -main_domain = "${domain}" -postgres_user = "plunk" -postgres_db = "plunk" +# Generate unique domains for each service +api_domain = "${domain}" +dashboard_domain = "${domain}" +landing_domain = "${domain}" +wiki_domain = "${domain}" +minio_domain = "${domain}" + +# Database credentials +postgres_password = "${password:32}" + +# Security +jwt_secret = "${password:64}" + +# Minio credentials +minio_root_user = "plunk" +minio_root_password = "${password:32}" [config] isolated = true +# API Domain [[config.domains]] serviceName = "plunk" -port = 3000 -host = "${main_domain}" +port = 80 +host = "${api_domain}" +path = "/" + +# Dashboard Domain +[[config.domains]] +serviceName = "plunk" +port = 80 +host = "${dashboard_domain}" +path = "/" + +# Landing Page Domain +[[config.domains]] +serviceName = "plunk" +port = 80 +host = "${landing_domain}" +path = "/" + +# Documentation Domain +[[config.domains]] +serviceName = "plunk" +port = 80 +host = "${wiki_domain}" +path = "/" + +# Minio Console Domain (optional) +[[config.domains]] +serviceName = "minio" +port = 9001 +host = "${minio_domain}" path = "/" [config.env] -POSTGRES_USER = "${postgres_user}" -POSTGRES_DB = "${postgres_db}" -POSTGRES_PASSWORD = "${password:32}" +# Database +DB_PASSWORD = "${postgres_password}" +# Redis REDIS_URL = "redis://redis:6379" -JWT_SECRET = "${password:64}" -APP_URI = "https://${main_domain}" +# Security +JWT_SECRET = "${jwt_secret}" -AWS_REGION = "" -AWS_ACCESS_KEY_ID = "" -AWS_SECRET_ACCESS_KEY = "" -AWS_SES_CONFIGURATION_SET = "" +# Nginx configuration +NGINX_PORT = "80" -DISABLE_SIGNUPS = "False" \ No newline at end of file +# Domain configuration (subdomain-based routing) +API_DOMAIN = "${api_domain}" +DASHBOARD_DOMAIN = "${dashboard_domain}" +LANDING_DOMAIN = "${landing_domain}" +WIKI_DOMAIN = "${wiki_domain}" +USE_HTTPS = "true" + +# AWS SES (Required - users must configure these for email to work) +AWS_SES_REGION = "us-east-1" +AWS_SES_ACCESS_KEY_ID = "" +AWS_SES_SECRET_ACCESS_KEY = "" +SES_CONFIGURATION_SET = "" + +# S3-compatible storage (Minio) +MINIO_ROOT_USER = "${minio_root_user}" +MINIO_ROOT_PASSWORD = "${minio_root_password}" +S3_ENDPOINT = "http://minio:9000" +S3_ACCESS_KEY_ID = "${minio_root_user}" +S3_ACCESS_KEY_SECRET = "${minio_root_password}" +S3_BUCKET = "uploads" +S3_PUBLIC_URL = "https://${minio_domain}/uploads" +S3_FORCE_PATH_STYLE = "true" + +# Minio ports +MINIO_API_PORT = "9000" +MINIO_CONSOLE_PORT = "9001" + +# SMTP Server ports +PORT_SECURE = "465" +PORT_SUBMISSION = "587" + +# Notifications (ntfy.sh) +NTFY_URL = "http://ntfy/plunk-notifications" + +# Optional: OAuth (leave empty if not using) +GITHUB_OAUTH_CLIENT = "" +GITHUB_OAUTH_SECRET = "" +GOOGLE_OAUTH_CLIENT = "" +GOOGLE_OAUTH_SECRET = "" + +# Optional: Stripe (leave empty if not using) +STRIPE_SK = "" +STRIPE_WEBHOOK_SECRET = "" +STRIPE_PRICE_ONBOARDING = "" +STRIPE_PRICE_EMAIL_USAGE = "" +STRIPE_METER_EVENT_NAME = "emails" + +# Internal +PLUNK_API_KEY = "" +PLUNK_FROM_ADDRESS = "" +SMTP_DOMAIN = "" \ No newline at end of file