services: # MongoDB service textbee-db: container_name: textbee-db image: mongo:latest restart: always environment: - MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER:-adminUser} - MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASS:-adminPassword} - MONGO_INITDB_DATABASE=textbee volumes: # - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro - mongodb_data:/data/db networks: - textbee-network healthcheck: test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 30s timeout: 10s retries: 3 start_period: 20s # MongoDB Express (optional admin UI) mongo-express: container_name: textbee-mongo-express image: mongo-express:latest restart: always ports: - "127.0.0.1:56081:8081" environment: - ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USER:-adminUser} - ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASS:-adminPassword} - ME_CONFIG_MONGODB_SERVER=textbee-db depends_on: textbee-db: condition: service_healthy networks: - textbee-network # NestJS API textbee-api: container_name: textbee-api # image: ghcr.io/vernu/textbee/api:latest build: context: ./api dockerfile: Dockerfile restart: always ports: # TEXTBEE_API_BIND defaults to 0.0.0.0 for dev (laptop LAN access). # Set to 127.0.0.1 on prod so only the host-local Caddy reaches it. - "${TEXTBEE_API_BIND:-0.0.0.0}:56031:3001" env_file: - ./api/.env environment: - PORT=3001 - REDIS_URL=${REDIS_URL:-redis://textbee-redis:6379} # SMS limits for the free / default tier. -1 = unlimited (self-host default). # Set positive integers to cap per-user usage. Overrides the DB plan values. - SMS_DAILY_LIMIT=${SMS_DAILY_LIMIT:--1} - SMS_MONTHLY_LIMIT=${SMS_MONTHLY_LIMIT:--1} - SMS_BULK_SEND_LIMIT=${SMS_BULK_SEND_LIMIT:--1} depends_on: textbee-db: condition: service_healthy networks: - textbee-network # Next.js Web textbee-web: container_name: textbee-web # image: ghcr.io/vernu/textbee/web:latest build: context: ./web dockerfile: Dockerfile args: # Show the paid "Upgrade to Pro" UI. false = hidden (self-host default). # NEXT_PUBLIC_* is inlined at build time, so this must be a build arg — # changing it requires rebuilding the web image (docker compose build web). - NEXT_PUBLIC_BILLING_ENABLED=${NEXT_PUBLIC_BILLING_ENABLED:-false} restart: always ports: # TEXTBEE_WEB_BIND defaults to 0.0.0.0 for dev (laptop LAN access). # Set to 127.0.0.1 on prod so only the host-local Caddy reaches it. - "${TEXTBEE_WEB_BIND:-0.0.0.0}:56030:3000" env_file: - ./web/.env environment: - PORT=3000 - NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-http://localhost:3001/api/v1} depends_on: - textbee-api networks: - textbee-network # Redis (if SMS queue is needed) textbee-redis: container_name: textbee-redis image: redis:alpine restart: always volumes: - redis_data:/data networks: - textbee-network command: redis-server --appendonly yes healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 10s retries: 3 start_period: 20s # Cloudflare Tunnel — exposes textbee-api at https://textbee-dev.voxtra.ch # for Android phone testing. Provision the tunnel in Cloudflare Zero Trust # dashboard, then drop the token into .env as TUNNEL_TOKEN. textbee-cloudflared: container_name: textbee-cloudflared image: cloudflare/cloudflared:latest restart: unless-stopped command: tunnel --no-autoupdate run environment: - TUNNEL_TOKEN=${TUNNEL_TOKEN:-} networks: - textbee-network depends_on: textbee-api: condition: service_started networks: textbee-network: driver: bridge volumes: mongodb_data: redis_data: