Skip to content

Instantly share code, notes, and snippets.

@vivekascoder
Created November 14, 2025 16:05
Show Gist options
  • Select an option

  • Save vivekascoder/8c2a2dbd0ab031765ace3c6d9cd368ee to your computer and use it in GitHub Desktop.

Select an option

Save vivekascoder/8c2a2dbd0ab031765ace3c6d9cd368ee to your computer and use it in GitHub Desktop.
version: '3.8'
# Common environment variables used by app services
x-common-env: &common-env
CLERK_JWKS_URL: ${CLERK_JWKS_URL}
CLERK_SECRET_KEY: ${CLERK_SECRET_KEY}
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY}
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET}
LIVEKIT_SANDBOX_ID: ${LIVEKIT_SANDBOX_ID}
LIVEKIT_URL: ${LIVEKIT_URL}
LIVEKIT_AGENTS_PORT: ${LIVEKIT_AGENTS_PORT}
LIVEKIT_AGENTS_LOG_LEVEL: ${LIVEKIT_AGENTS_LOG_LEVEL:-debug}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
OPENAI_API_KEY: ${OPENAI_API_KEY}
ELEVEN_API_KEY: ${ELEVEN_API_KEY}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-notbf}
REDIS_HOST: redis
REDIS_PORT: 6379
PYTHONUNBUFFERED: 1
services:
postgres:
container_name: notbf-db
image: pgvector/pgvector:pg18
ports:
- "5432:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-notbf}
volumes:
- postgres_data:/var/lib/postgresql
- ./init-pgvector.sql:/docker-entrypoint-initdb.d/init-pgvector.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
container_name: notbf-redis
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 10s
retries: 5
restart: unless-stopped
server:
container_name: notbf-server
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
extra_hosts:
- "host.docker.internal:host-gateway"
# Increase shared memory for IPC communication (critical for LiveKit agents)
shm_size: '2gb'
# Increase file descriptor limits
ulimits:
nofile:
soft: 65536
hard: 65536
tmpfs:
- /tmp:rw,noexec,nosuid,size=1g
environment:
<<: *common-env
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
interval: 10s
timeout: 5s
retries: 10 # Increase retries
start_period: 60s # Increase start period to 60 seconds
deploy:
resources:
limits:
memory: 512M
restart: unless-stopped
agent:
container_name: notbf-agent
build:
context: .
dockerfile: Dockerfile.agent
ports:
- "8081:8081"
depends_on:
postgres:
condition: service_healthy
server:
condition: service_healthy
redis:
condition: service_healthy
# extra_hosts:
# - "host.docker.internal:host-gateway"
# Increase shared memory for IPC communication (critical for LiveKit agents)
shm_size: '3gb'
# Increase file descriptor limits
ulimits:
nofile:
soft: 65536
hard: 65536
# Resource limits and reservations
deploy:
resources:
limits:
memory: 3G
# Mount tmpfs for Unix sockets
tmpfs:
- /tmp:rw,noexec,nosuid,size=1g
environment:
<<: *common-env
restart: unless-stopped
arq-worker:
container_name: notbf-arq
build:
context: .
dockerfile: Dockerfile.worker
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
<<: *common-env
deploy:
resources:
limits:
memory: 512M
restart: unless-stopped
caddy:
container_name: notbf-caddy
image: caddy:latest
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
volumes:
- ./caddy:/etc/caddy
- caddy_data:/data
depends_on:
- server
restart: unless-stopped
volumes:
postgres_data:
redis_data:
caddy_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment