From c771a7aab49b982f76f067cd60923cc66ed9ffbd Mon Sep 17 00:00:00 2001 From: xucai Date: Sun, 23 Feb 2025 16:17:39 +0800 Subject: [PATCH 1/4] feat/postgres-volumes --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 78044c03b8..2cb5b6ce6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: db: - image: postgres + image: postgres:16 restart: always environment: POSTGRES_DB: litellm @@ -31,6 +31,8 @@ services: POSTGRES_PASSWORD: dbpassword9090 ports: - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -d litellm -U llmproxy"] interval: 1s @@ -53,6 +55,8 @@ services: volumes: prometheus_data: driver: local + postgres_data: + name: litellm_postgres_data # ...rest of your docker-compose config if any From 9a03e1dfd84ea936b182ef0f6a7aa96cde512f47 Mon Sep 17 00:00:00 2001 From: xucai Date: Wed, 12 Mar 2025 03:30:14 +0800 Subject: [PATCH 2/4] add postgres-volumes comment --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2cb5b6ce6a..b56e037253 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: ports: - "5432:5432" volumes: - - postgres_data:/var/lib/postgresql/data + - postgres_data:/var/lib/postgresql/data # Persists Postgres data across container restarts healthcheck: test: ["CMD-SHELL", "pg_isready -d litellm -U llmproxy"] interval: 1s @@ -56,7 +56,7 @@ volumes: prometheus_data: driver: local postgres_data: - name: litellm_postgres_data + name: litellm_postgres_data # Named volume for Postgres data persistence # ...rest of your docker-compose config if any From 3944f67b1abb4bf596e522409a26c35dc83c0e4f Mon Sep 17 00:00:00 2001 From: xucai Date: Thu, 13 Mar 2025 22:32:19 +0800 Subject: [PATCH 3/4] add healthcheck --- docker-compose.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index b56e037253..5be6604b17 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,14 @@ services: STORE_MODEL_IN_DB: "True" # allows adding models to proxy via UI env_file: - .env # Load local .env file + depends_on: + - db # Indicates that this service depends on the 'db' service, ensuring 'db' starts first + healthcheck: # Defines the health check configuration for the container + test: [ "CMD", "curl", "-f", "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 db: From 3382ca2f605ded398eceaf3e4504381d75bfc1a4 Mon Sep 17 00:00:00 2001 From: xucai Date: Thu, 13 Mar 2025 22:38:37 +0800 Subject: [PATCH 4/4] add healthcheck --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5be6604b17..d16ec6ed20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: depends_on: - db # Indicates that this service depends on the 'db' service, ensuring 'db' starts first healthcheck: # Defines the health check configuration for the container - test: [ "CMD", "curl", "-f", "http://localhost:4000/health/liveliness" ] # Command to execute for health check + test: [ "CMD", "curl", "-f", "http://localhost:4000/health/liveliness || exit 1" ] # 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