services: litellm: image: docker.litellm.ai/berriai/litellm:main-latest ports: - 4000:4000 env_file: /home/ai/litellm.env environment: DATABASE_URL: "postgresql://llmproxy:dbpassword9090@host.containers.internal:5432/litellm" STORE_MODEL_IN_DB: "True" restart: unless-stopped depends_on: - litellm-db # Indicates that this service depends on the 'litellm-db' service, ensuring 'litellm-db' starts first healthcheck: # Defines the health check configuration for the container test: - CMD-SHELL - python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:4000/health/liveliness')" # Command to execute for health check interval: 30s # Perform health check every 30 seconds timeout: 10s # Health check command times out after 10 seconds retries: 3 # Retry up to 3 times if health check fails start_period: 40s # Wait 40 seconds after container start before beginning health checks litellm-db: image: docker.io/postgres:16 restart: always environment: POSTGRES_DB: litellm POSTGRES_USER: llmproxy POSTGRES_PASSWORD: dbpassword9090 ports: - "5432:5432" volumes: - litellm_postgres_data:/var/lib/postgresql/data:z healthcheck: test: ["CMD-SHELL", "pg_isready -d litellm -U llmproxy"] interval: 1s timeout: 5s retries: 10