chore: enhance docker-compose configuration for improved service management
- Added restart policies for PostgreSQL, Redis, Qdrant, server, and server-full services to ensure better resilience. - Updated environment variable handling for PostgreSQL credentials to support default values. - Adjusted healthcheck commands for PostgreSQL and Qdrant services for improved reliability. - Introduced a new network 'noteflow-net' to facilitate service communication within the Docker environment. All quality checks pass.
This commit is contained in:
41
compose.yaml
41
compose.yaml
@@ -5,19 +5,22 @@ services:
|
||||
postgres:
|
||||
container_name: noteflow-postgres
|
||||
image: pgvector/pgvector:pg15
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: noteflow
|
||||
POSTGRES_USER: noteflow
|
||||
POSTGRES_PASSWORD: noteflow
|
||||
POSTGRES_DB: ${POSTGRES_DB:-noteflow}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-noteflow}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-noteflow}
|
||||
volumes:
|
||||
- noteflow_pg_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U noteflow -d noteflow"]
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-noteflow} -d ${POSTGRES_DB:-noteflow}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- infra
|
||||
- server
|
||||
@@ -25,8 +28,9 @@ services:
|
||||
- server-full
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: noteflow-redis
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
@@ -37,6 +41,8 @@ services:
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- infra
|
||||
- server
|
||||
@@ -44,8 +50,9 @@ services:
|
||||
- server-full
|
||||
|
||||
qdrant:
|
||||
image: qdrant/qdrant:latest
|
||||
container_name: noteflow-qdrant
|
||||
image: qdrant/qdrant:v1.12.1
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6333:6333"
|
||||
- "6334:6334"
|
||||
@@ -54,11 +61,13 @@ services:
|
||||
environment:
|
||||
QDRANT__SERVICE__GRPC_PORT: 6334
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "timeout 1 bash -c '</dev/tcp/localhost/6333' || exit 1"]
|
||||
test: ["CMD-SHELL", "bash -c '</dev/tcp/localhost/6333'"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- infra
|
||||
- server
|
||||
@@ -68,18 +77,21 @@ services:
|
||||
# =============================================================================
|
||||
# Application Services
|
||||
# =============================================================================
|
||||
# Note: 'server' and 'server-full' are mutually exclusive (same port 50051).
|
||||
# Use profile 'server' OR 'server-full', not both.
|
||||
server:
|
||||
container_name: noteflow-server
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/server.Dockerfile
|
||||
target: server
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "50051:50051"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
NOTEFLOW_DATABASE_URL: postgresql+asyncpg://noteflow:noteflow@postgres:5432/noteflow
|
||||
NOTEFLOW_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-noteflow}:${POSTGRES_PASSWORD:-noteflow}@postgres:5432/${POSTGRES_DB:-noteflow}
|
||||
NOTEFLOW_REDIS_URL: redis://redis:6379/0
|
||||
NOTEFLOW_QDRANT_URL: http://qdrant:6333
|
||||
volumes:
|
||||
@@ -91,6 +103,8 @@ services:
|
||||
condition: service_healthy
|
||||
qdrant:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- server
|
||||
- full
|
||||
@@ -101,12 +115,13 @@ services:
|
||||
context: .
|
||||
dockerfile: docker/server.Dockerfile
|
||||
target: server-full
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "50051:50051"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
NOTEFLOW_DATABASE_URL: postgresql+asyncpg://noteflow:noteflow@postgres:5432/noteflow
|
||||
NOTEFLOW_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-noteflow}:${POSTGRES_PASSWORD:-noteflow}@postgres:5432/${POSTGRES_DB:-noteflow}
|
||||
NOTEFLOW_REDIS_URL: redis://redis:6379/0
|
||||
NOTEFLOW_QDRANT_URL: http://qdrant:6333
|
||||
volumes:
|
||||
@@ -118,6 +133,8 @@ services:
|
||||
condition: service_healthy
|
||||
qdrant:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- server-full
|
||||
|
||||
@@ -140,6 +157,8 @@ services:
|
||||
- client_npm_cache:/root/.npm
|
||||
depends_on:
|
||||
- server
|
||||
networks:
|
||||
- noteflow-net
|
||||
profiles:
|
||||
- client
|
||||
|
||||
@@ -149,3 +168,7 @@ volumes:
|
||||
noteflow_qdrant_data:
|
||||
client_cargo_cache:
|
||||
client_npm_cache:
|
||||
|
||||
networks:
|
||||
noteflow-net:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user