Refactor Docker Compose configuration to improve service dependencies and remove unused network
- Removed the portal-network configuration and associated network settings from services. - Added service health checks for database and cache dependencies in the backend service. - Updated links for backend service to connect directly to database and cache services.
This commit is contained in:
parent
ab7492f2ab
commit
c625b978d9
@ -8,8 +8,6 @@ services:
|
||||
container_name: portal-frontend
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000"
|
||||
networks:
|
||||
- portal-network
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=3000
|
||||
@ -30,8 +28,9 @@ services:
|
||||
container_name: portal-backend
|
||||
ports:
|
||||
- "127.0.0.1:4000:4000"
|
||||
networks:
|
||||
- portal-network
|
||||
links:
|
||||
- database
|
||||
- cache
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=4000
|
||||
@ -65,8 +64,10 @@ services:
|
||||
- /var/www/vhosts/asolutions.jp/httpdocs/secrets:/app/secrets:ro
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- database
|
||||
- cache
|
||||
database:
|
||||
condition: service_healthy
|
||||
cache:
|
||||
condition: service_healthy
|
||||
command: sh -c "pnpm prisma migrate deploy && node dist/main"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/health"]
|
||||
@ -78,8 +79,6 @@ services:
|
||||
database:
|
||||
image: postgres:17-alpine
|
||||
container_name: portal-database
|
||||
networks:
|
||||
- portal-network
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
@ -97,8 +96,6 @@ services:
|
||||
cache:
|
||||
image: redis:7-alpine
|
||||
container_name: portal-cache
|
||||
networks:
|
||||
- portal-network
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
restart: unless-stopped
|
||||
@ -113,11 +110,3 @@ volumes:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
portal-network:
|
||||
driver: bridge
|
||||
name: portal-network
|
||||
enable_ipv6: false
|
||||
driver_opts:
|
||||
com.docker.network.enable_ipv6: "false"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user