Spaces:
Running
Running
File size: 15,541 Bytes
b17baae | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# MicProtocol β Coolify Production Stack
# Deploy via Coolify Docker Compose resource.
# Coolify auto-builds API/Web/Admin from source on git push.
# Coolify proxy handles SSL + domain binding for all services.
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
services:
# βββ Database βββββββββββββββββββββββββββββββββββββββββββββ
postgres:
image: pgvector/pgvector:pg16
restart: unless-stopped
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
environment:
POSTGRES_USER: ${POSTGRES_USER:-micprotocol}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-micprotocol_secret}
POSTGRES_DB: ${POSTGRES_DB:-micprotocol}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-micprotocol}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- micprotocol
# βββ Cache & Queues βββββββββββββββββββββββββββββββββββββββ
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD:-redis_secret}
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
networks:
- micprotocol
# βββ Search Engine (embedded in API container) βββββββββββ
# Meilisearch runs inside the API container (see apps/api/Dockerfile).
# No separate service needed.
# βββ API (NestJS + tRPC) βββββββββββββββββββββββββββββββββ
api:
build:
context: .
dockerfile: apps/api/Dockerfile
restart: unless-stopped
environment:
NODE_ENV: production
API_PORT: 4000
DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/${POSTGRES_DB:-micprotocol}?schema=public
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-redis_secret}
MEILISEARCH_HOST: http://localhost:7700
WEB_URL: ${WEB_URL:-https://micprotocol-web.local}
CLERK_SECRET_KEY: ${CLERK_SECRET_KEY}
RESEND_API_KEY: ${RESEND_API_KEY}
R2_ACCESS_KEY_ID: ${R2_ACCESS_KEY_ID}
R2_SECRET_ACCESS_KEY: ${R2_SECRET_ACCESS_KEY}
R2_ENDPOINT: ${R2_ENDPOINT}
R2_BUCKET: ${R2_BUCKET}
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY:-devkey}
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:-devsecret}
LIVEKIT_HOST: ${LIVEKIT_HOST:-http://livekit:7880}
LISTMONK_URL: ${LISTMONK_URL:-http://listmonk:9000}
LISTMONK_API_TOKEN: ${LISTMONK_API_TOKEN}
NVIDIA_NIM_API_KEY: ${NVIDIA_NIM_API_KEY}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
MOONSHOT_API_KEY: ${MOONSHOT_API_KEY}
COOKIE_SECRET: ${COOKIE_SECRET:-cookie_secret_change_in_production}
# Real-time collaboration engine (Erlang) β see mic-realtime service below.
# MIC_REALTIME_URL is the in-network base URL the API uses to publish
# events + issue WS tokens. The two secrets MUST be strong random values
# in production (the API fails to boot otherwise β RealtimeClient).
MIC_REALTIME_URL: ${MIC_REALTIME_URL:-http://mic-realtime:4001}
MIC_REALTIME_INTERNAL_TOKEN: ${MIC_REALTIME_INTERNAL_TOKEN}
MIC_REALTIME_SHARED_SECRET: ${MIC_REALTIME_SHARED_SECRET}
SENTRY_DSN: ${SENTRY_DSN}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
mic-realtime:
condition: service_started
networks:
- micprotocol
# βββ Background Workers (BullMQ) ββββββββββββββββββββββββββ
worker:
build:
context: .
dockerfile: apps/api/Dockerfile
restart: unless-stopped
command: npx bullmq-pro
environment:
NODE_ENV: production
DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/${POSTGRES_DB:-micprotocol}?schema=public
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-redis_secret}
RESEND_API_KEY: ${RESEND_API_KEY}
NVIDIA_NIM_API_KEY: ${NVIDIA_NIM_API_KEY}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
MOONSHOT_API_KEY: ${MOONSHOT_API_KEY}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- micprotocol
# βββ Erlang/OTP Real-time Collaboration Engine βββββββββββββ
# Owns chat fanout, presence, live domain events. The NestJS API
# publishes into it via /internal/dispatch; the web client opens
# a WebSocket at /ws?token=... to subscribe to conversations.
# Exposed to the internet by Caddy on realtime.<domain> (wss://).
mic-realtime:
build:
context: ./services/mic-realtime
dockerfile: Dockerfile
restart: unless-stopped
environment:
MIC_REALTIME_PORT: 4001
MIC_REALTIME_HOST: 0.0.0.0
# Internal in-network API URL (NOT the public NEXT_PUBLIC_API_URL)
# so realtimeβAPI callbacks stay on the Docker network.
MICPROTOCOL_API_URL: ${API_URL:-http://api:4000}
# Both secrets MUST be strong random values in production
# (the service fails closed at startup otherwise).
MIC_REALTIME_INTERNAL_TOKEN: ${MIC_REALTIME_INTERNAL_TOKEN}
MIC_REALTIME_SHARED_SECRET: ${MIC_REALTIME_SHARED_SECRET}
MIC_REALTIME_PUBLIC_URL: ${MIC_REALTIME_PUBLIC_URL}
MIC_REALTIME_MAX_MSG: 65536
MIC_REALTIME_RATE_LIMIT: 120
MIC_REALTIME_PRESENCE_TTL: 90
depends_on:
- api
networks:
- micprotocol
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:4001/healthz"]
interval: 15s
timeout: 5s
retries: 5
# βββ Web App (Next.js) βββββββββββββββββββββββββββββββββββ
web:
build:
context: .
dockerfile: apps/web/Dockerfile
restart: unless-stopped
depends_on:
- api
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}
CLERK_SECRET_KEY: ${CLERK_SECRET_KEY}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${UMAMI_WEBSITE_ID}
NEXT_PUBLIC_UMAMI_URL: ${UMAMI_URL}
# Must be a public wss:// URL in production (e.g. wss://realtime.<domain>)
NEXT_PUBLIC_MIC_REALTIME_URL: ${MIC_REALTIME_PUBLIC_URL}
networks:
- micprotocol
# βββ Admin Panel (Next.js) βββββββββββββββββββββββββββββββ
admin:
build:
context: .
dockerfile: apps/admin/Dockerfile
restart: unless-stopped
depends_on:
- api
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
API_URL: http://api:4000
# Must be a public wss:// URL in production (e.g. wss://realtime.<domain>)
NEXT_PUBLIC_MIC_REALTIME_URL: ${MIC_REALTIME_PUBLIC_URL}
networks:
- micprotocol
# βββ Cal.com (Scheduling) βββββββββββββββββββββββββββββββββ
calcom:
image: calcom/cal.com:latest
restart: unless-stopped
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/calcom?schema=public
DATABASE_DIRECT_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/calcom?schema=public
NEXTAUTH_SECRET: ${CALCOM_NEXTAUTH_SECRET}
CALENDSO_ENCRYPTION_KEY: ${CALCOM_ENCRYPTION_KEY}
NEXTAUTH_URL: ${CALCOM_URL:-https://calcom.local}
NEXT_PUBLIC_WEBAPP_URL: ${CALCOM_URL:-https://calcom.local}
CALCOM_TELEMETRY_DISABLED: "1"
EMAIL_FROM: ${EMAIL_FROM:-noreply@micprotocol.local}
EMAIL_SERVER_HOST: ${SMTP_HOST}
EMAIL_SERVER_PORT: ${SMTP_PORT:-587}
EMAIL_SERVER_USER: ${SMTP_USER}
EMAIL_SERVER_PASSWORD: ${SMTP_PASSWORD}
REDIS_URL: redis://:${REDIS_PASSWORD:-redis_secret}@redis:6379
NEXT_PUBLIC_SINGLE_ORG_SLUG: ${CALCOM_SINGLE_ORG_SLUG:-micprotocol}
ORGANIZATIONS_ENABLED: "0"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- micprotocol
# βββ Listmonk (Newsletter / Email Marketing) βββββββββββββ
listmonk:
image: listmonk/listmonk:latest
restart: unless-stopped
command: >
sh -c "./listmonk --install --idempotent --yes &&
./listmonk --upgrade --yes &&
./listmonk"
environment:
LISTMONK_app__address: "0.0.0.0:9000"
LISTMONK_db__host: postgres
LISTMONK_db__port: 5432
LISTMONK_db__user: ${POSTGRES_USER:-micprotocol}
LISTMONK_db__password: ${POSTGRES_PASSWORD:-micprotocol_secret}
LISTMONK_db__database: listmonk
LISTMONK_db__ssl_mode: disable
LISTMONK_ADMIN_USER: ${LISTMONK_ADMIN_USER:-admin}
LISTMONK_ADMIN_PASSWORD: ${LISTMONK_ADMIN_PASSWORD:-admin_secret}
volumes:
- listmonk_uploads:/listmonk/uploads:rw
depends_on:
postgres:
condition: service_healthy
networks:
- micprotocol
# βββ Formbricks (Surveys) βββββββββββββββββββββββββββββββββ
formbricks:
image: ghcr.io/formbricks/formbricks:latest
restart: unless-stopped
environment:
WEBAPP_URL: ${FORMBRICKS_URL:-https://formbricks.local}
NEXTAUTH_URL: ${FORMBRICKS_URL:-https://formbricks.local}
DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/formbricks?schema=public
NEXTAUTH_SECRET: ${FORMBRICKS_NEXTAUTH_SECRET}
ENCRYPTION_KEY: ${FORMBRICKS_ENCRYPTION_KEY}
CRON_SECRET: ${FORMBRICKS_CRON_SECRET}
REDIS_URL: redis://:${REDIS_PASSWORD:-redis_secret}@redis:6379
EMAIL_VERIFICATION_DISABLED: 1
PASSWORD_RESET_DISABLED: 1
MAIL_FROM: ${EMAIL_FROM:-noreply@micprotocol.local}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT:-587}
TELEMETRY_DISABLED: 1
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- micprotocol
# βββ Documenso (Document Signing) βββββββββββββββββββββββββ
documenso:
image: documenso/documenso:latest
restart: unless-stopped
environment:
NEXTAUTH_SECRET: ${DOCUMENSO_NEXTAUTH_SECRET}
NEXT_PRIVATE_ENCRYPTION_KEY: ${DOCUMENSO_ENCRYPTION_KEY}
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY: ${DOCUMENSO_ENCRYPTION_SECONDARY_KEY}
NEXT_PUBLIC_WEBAPP_URL: ${DOCUMENSO_URL:-https://documenso.local}
NEXT_PRIVATE_INTERNAL_WEBAPP_URL: http://documenso:3000
NEXT_PRIVATE_DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/documenso?schema=public
NEXT_PRIVATE_DIRECT_DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/documenso?schema=public
NEXT_PUBLIC_UPLOAD_TRANSPORT: r2
NEXT_PRIVATE_SMTP_TRANSPORT: smtp
NEXT_PRIVATE_SMTP_HOST: ${SMTP_HOST}
NEXT_PRIVATE_SMTP_PORT: ${SMTP_PORT:-587}
NEXT_PRIVATE_SMTP_FROM_NAME: MicProtocol
NEXT_PRIVATE_SMTP_FROM_ADDRESS: ${EMAIL_FROM:-noreply@micprotocol.local}
NEXT_PUBLIC_DISABLE_SIGNUP: "false"
NEXT_PUBLIC_DISABLE_SIGNIN: "false"
volumes:
- documenso_cert:/opt/documenso/cert:ro
depends_on:
postgres:
condition: service_healthy
networks:
- micprotocol
# βββ Chatwoot (Live Chat) βββββββββββββββββββββββββββββββββ
chatwoot:
image: chatwoot/chatwoot:latest
restart: unless-stopped
entrypoint: docker/entrypoints/rails.sh
command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]
environment:
NODE_ENV: production
RAILS_ENV: production
INSTALLATION_ENV: docker
SECRET_KEY_BASE: ${CHATWOOT_SECRET_KEY_BASE}
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DATABASE: chatwoot
POSTGRES_USERNAME: ${POSTGRES_USER:-micprotocol}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-micprotocol_secret}
REDIS_URL: redis://:${REDIS_PASSWORD:-redis_secret}@redis:6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-redis_secret}
REDIS_SIDEKIQ_URL: redis://:${REDIS_PASSWORD:-redis_secret}@redis:6379
FRONTEND_URL: ${CHATWOOT_URL:-https://chatwoot.local}
SMTP_ADDRESS: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USERNAME: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
MAILER_SENDER_EMAIL: ${EMAIL_FROM:-Chatwoot <support@micprotocol.local>}
volumes:
- chatwoot_storage:/app/storage
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- micprotocol
# βββ Umami (Analytics) ββββββββββββββββββββββββββββββββββββ
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
restart: unless-stopped
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-micprotocol}:${POSTGRES_PASSWORD:-micprotocol_secret}@postgres:5432/umami?schema=public
DATABASE_TYPE: postgresql
APP_SECRET: ${UMAMI_APP_SECRET}
depends_on:
postgres:
condition: service_healthy
networks:
- micprotocol
# βββ LiveKit (WebRTC SFU) βββββββββββββββββββββββββββββββββ
livekit:
image: livekit/livekit-server:latest
restart: unless-stopped
ports:
- "7880:7880"
- "7881:7881"
- "7882:7882/udp"
command: >
--config-body
"
port: 7880
rtc:
port_range_start: 7882
port_range_end: 7882
use_external_ip: false
keys:
${LIVEKIT_API_KEY:-devkey}: ${LIVEKIT_API_SECRET:-devsecret}
webhook:
urls: [http://api:4000/integrations/webhooks/livekit]
api_key: ${LIVEKIT_API_KEY:-devkey}
"
networks:
- micprotocol
# βββ SMTP Relay βββββββββββββββββββββββββββββββββββββββββββββ
# Set SMTP_HOST/SMTP_PORT for integrations that send email directly.
# Resend (app-level email) is configured via RESEND_API_KEY.
networks:
micprotocol:
driver: bridge
volumes:
postgres_data:
redis_data:
listmonk_uploads:
chatwoot_storage:
documenso_cert:
|