Severian commited on
Commit
8cfad5c
1 Parent(s): 46a883c

feat: update database configuration in docker-compose

Browse files

- Add DATABASE_TYPE environment variable
- Update database health checks
- Standardize environment variables across services

Files changed (1) hide show
  1. docker/docker-compose.yaml +9 -4
docker/docker-compose.yaml CHANGED
@@ -281,8 +281,10 @@ services:
281
  # Startup mode, 'api' starts the API server.
282
  MODE: api
283
  depends_on:
284
- - db
285
- - redis
 
 
286
  volumes:
287
  # Mount the storage directory to the container, for storing user files.
288
  - ./volumes/app/storage:/app/api/storage
@@ -328,17 +330,20 @@ services:
328
  restart: always
329
  networks:
330
  - dify_network
 
331
  environment:
332
  POSTGRES_USER: ${DB_USERNAME:-postgres}
333
  POSTGRES_PASSWORD: ${DB_PASSWORD:-difyai123456}
334
  POSTGRES_DB: ${DB_DATABASE:-dify}
 
335
  volumes:
336
  - ./volumes/db/data:/var/lib/postgresql/data
337
  healthcheck:
338
- test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres}"]
339
- interval: 5s
340
  timeout: 5s
341
  retries: 5
 
342
 
343
  # The redis cache.
344
  redis:
 
281
  # Startup mode, 'api' starts the API server.
282
  MODE: api
283
  depends_on:
284
+ db:
285
+ condition: service_healthy
286
+ redis:
287
+ condition: service_healthy
288
  volumes:
289
  # Mount the storage directory to the container, for storing user files.
290
  - ./volumes/app/storage:/app/api/storage
 
330
  restart: always
331
  networks:
332
  - dify_network
333
+ - default
334
  environment:
335
  POSTGRES_USER: ${DB_USERNAME:-postgres}
336
  POSTGRES_PASSWORD: ${DB_PASSWORD:-difyai123456}
337
  POSTGRES_DB: ${DB_DATABASE:-dify}
338
+ PGDATA: /var/lib/postgresql/data/pgdata
339
  volumes:
340
  - ./volumes/db/data:/var/lib/postgresql/data
341
  healthcheck:
342
+ test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres} -d ${DB_DATABASE:-dify}"]
343
+ interval: 10s
344
  timeout: 5s
345
  retries: 5
346
+ start_period: 30s
347
 
348
  # The redis cache.
349
  redis: