Files
tower/docker-compose.vps.yml
T
maaz519 530f81416a feat: AI dev stream over HTTPS (SSE read + draft writeback)
Replaces the Redis-over-Tailscale handoff with a far simpler HTTP surface
on the existing public API — no Redis client, Tailscale, or firewall changes
needed on the dev side.

- GET /ai/stream — SSE feed of every ingested message, reads the internal
  Redis stream; resumes from Last-Event-ID on reconnect (no missed messages);
  heartbeats keep the connection warm through proxies
- POST /ai/drafts — writeback: creates a ContentDraft (PENDING_REVIEW) that
  shows up in the admin /admin/drafts review UI
- AiStreamGuard — static bearer token auth (AI_STREAM_TOKEN), accepts header
  or ?token= query for browser EventSource
- Remove Tailscale sidecar + public Redis port; Redis stays internal-only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 13:06:17 +05:30

132 lines
3.6 KiB
YAML

services:
postgres:
image: postgres:17-alpine
environment:
POSTGRES_USER: tower
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: tower
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U tower -d tower']
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- dokploy-network
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD}
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
volumes:
- redis_data:/data
healthcheck:
test: ['CMD-SHELL', 'redis-cli -a $REDIS_PASSWORD ping']
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- dokploy-network
meilisearch:
image: getmeili/meilisearch:v1.11
ports:
- '7700:7700'
environment:
MEILI_NO_ANALYTICS: 'true'
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
volumes:
- meilisearch_data:/meili_data
restart: unless-stopped
networks:
- dokploy-network
api:
build:
context: .
dockerfile: apps/api/Dockerfile
expose:
- 3001
labels:
- traefik.enable=true
- traefik.http.routers.tower-api.rule=Host(`${API_DOMAIN}`)
- traefik.http.routers.tower-api.tls=true
- traefik.http.routers.tower-api.tls.certresolver=letsencrypt
- traefik.http.services.tower-api.loadbalancer.server.port=3001
environment:
DATABASE_URL: postgresql://tower:${DB_PASSWORD}@postgres:5432/tower
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
MEILI_URL: http://meilisearch:7700
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
MEMBER_JWT_EXPIRES_IN: ${MEMBER_JWT_EXPIRES_IN:-30d}
BCRYPT_ROUNDS: ${BCRYPT_ROUNDS:-10}
NODE_ENV: production
LOG_LEVEL: ${LOG_LEVEL:-info}
TOWER_PORTAL_BASE_URL: ${TOWER_PORTAL_BASE_URL}
AI_STREAM_TOKEN: ${AI_STREAM_TOKEN}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_SECURE: ${SMTP_SECURE:-false}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
SMTP_FROM: ${SMTP_FROM:-noreply@tower.local}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
meilisearch:
condition: service_started
restart: unless-stopped
networks:
- dokploy-network
worker:
build:
context: .
dockerfile: apps/worker/Dockerfile
environment:
DATABASE_URL: postgresql://tower:${DB_PASSWORD}@postgres:5432/tower
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
MEILI_URL: http://meilisearch:7700
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
JWT_SECRET: ${JWT_SECRET}
NODE_ENV: production
LOG_LEVEL: ${LOG_LEVEL:-info}
WHATSAPP_SESSION_PATH: /app/sessions
TOWER_PORTAL_BASE_URL: ${TOWER_PORTAL_BASE_URL}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_SECURE: ${SMTP_SECURE:-false}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
SMTP_FROM: ${SMTP_FROM:-noreply@tower.local}
volumes:
- sessions:/app/sessions
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
api:
condition: service_started
restart: unless-stopped
networks:
- dokploy-network
volumes:
postgres_data:
redis_data:
meilisearch_data:
sessions:
networks:
dokploy-network:
external: true