# Self-hosted TeamRoom: Postgres, the published server image, and Caddy for HTTPS. # # cp .env.example .env # set TEAMROOM_DOMAIN and POSTGRES_PASSWORD # docker compose up -d # # Run it from this folder. Point the domain's DNS at this machine first; Caddy then # gets a certificate on its own. Postgres is reachable only inside Docker. # Huddles (live voice) add LiveKit: set COMPOSE_PROFILES=huddles and its key and secret in .env, # and open 7881/tcp and 7882/udp. # Guide: docs/self-hosting.md name: teamroom services: postgres: image: postgres:17-alpine restart: unless-stopped environment: POSTGRES_DB: teamroom POSTGRES_USER: teamroom_user POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env (openssl rand -hex 24)} volumes: - teamroom-postgres:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U teamroom_user -d teamroom"] interval: 5s timeout: 5s retries: 10 server: image: ${TEAMROOM_IMAGE:-darkmatter08/teamroom-server}:${TEAMROOM_VERSION:-latest} restart: unless-stopped depends_on: postgres: { condition: service_healthy } environment: DATABASE_URL: postgres://teamroom_user:${POSTGRES_PASSWORD}@postgres:5432/teamroom PUBLIC_URL: ${PUBLIC_URL:-https://${TEAMROOM_DOMAIN:?Set TEAMROOM_DOMAIN in .env}} CORS_ORIGINS: ${CORS_ORIGINS:-} TEAMROOM_SECRET_KEY: ${TEAMROOM_SECRET_KEY:-} MAX_UPLOAD_MB: ${MAX_UPLOAD_MB:-50} TEAMROOM_PERMISSION_TIMEOUT_MIN: ${TEAMROOM_PERMISSION_TIMEOUT_MIN:-10} TEAMROOM_API_RATE_LIMIT: ${TEAMROOM_API_RATE_LIMIT:-120} SMTP_URL: ${SMTP_URL:-} MAIL_FROM: ${MAIL_FROM:-} BITBUCKET_OAUTH_KEY: ${BITBUCKET_OAUTH_KEY:-} BITBUCKET_OAUTH_SECRET: ${BITBUCKET_OAUTH_SECRET:-} LOG_LEVEL: ${LOG_LEVEL:-info} # The image the app's "Add a server computer" commands name (docker-compose.gateway.yml runs the same). TEAMROOM_GATEWAY_IMAGE: ${TEAMROOM_GATEWAY_IMAGE:-} TEAMROOM_GATEWAY_VERSION: ${TEAMROOM_GATEWAY_VERSION:-} # Huddles (docs/self-hosting.md › Huddles). Without the key and secret there are none. # LIVEKIT_URL is what the apps connect to (through Caddy); LIVEKIT_API_URL what the server calls. LIVEKIT_URL: ${LIVEKIT_URL:-wss://${TEAMROOM_DOMAIN}/livekit} LIVEKIT_API_URL: ${LIVEKIT_API_URL:-http://livekit:7880} LIVEKIT_API_KEY: ${LIVEKIT_API_KEY:-} LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:-} expose: - "9800" # Huddles' media server. Started with COMPOSE_PROFILES=huddles (or --profile huddles). # Its signalling goes through Caddy at /livekit; audio goes straight to 7882/udp, or 7881/tcp # where UDP is blocked. Nothing of the audio reaches the TeamRoom server. livekit: image: livekit/livekit-server:${LIVEKIT_VERSION:-v1.13.11} profiles: ["huddles"] restart: unless-stopped environment: LIVEKIT_CONFIG: | port: 7880 rtc: tcp_port: 7881 udp_port: 7882 use_external_ip: true keys: ${LIVEKIT_API_KEY:-unset}: ${LIVEKIT_API_SECRET:-unset} webhook: api_key: ${LIVEKIT_API_KEY:-unset} urls: [http://server:9800/api/huddles/livekit] room: empty_timeout: 60 logging: level: ${LIVEKIT_LOG_LEVEL:-info} expose: - "7880" ports: - "7881:7881" - "7882:7882/udp" caddy: image: caddy:2-alpine restart: unless-stopped depends_on: - server environment: TEAMROOM_DOMAIN: ${TEAMROOM_DOMAIN} ports: - "80:80" - "443:443" - "443:443/udp" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy-data:/data - caddy-config:/config volumes: teamroom-postgres: caddy-data: caddy-config: