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
|
container_name: portal-frontend
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:3000:3000"
|
- "127.0.0.1:3000:3000"
|
||||||
networks:
|
|
||||||
- portal-network
|
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
@ -30,8 +28,9 @@ services:
|
|||||||
container_name: portal-backend
|
container_name: portal-backend
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:4000:4000"
|
- "127.0.0.1:4000:4000"
|
||||||
networks:
|
links:
|
||||||
- portal-network
|
- database
|
||||||
|
- cache
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- PORT=4000
|
- PORT=4000
|
||||||
@ -65,8 +64,10 @@ services:
|
|||||||
- /var/www/vhosts/asolutions.jp/httpdocs/secrets:/app/secrets:ro
|
- /var/www/vhosts/asolutions.jp/httpdocs/secrets:/app/secrets:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
database:
|
||||||
- cache
|
condition: service_healthy
|
||||||
|
cache:
|
||||||
|
condition: service_healthy
|
||||||
command: sh -c "pnpm prisma migrate deploy && node dist/main"
|
command: sh -c "pnpm prisma migrate deploy && node dist/main"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/health"]
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/health"]
|
||||||
@ -78,8 +79,6 @@ services:
|
|||||||
database:
|
database:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
container_name: portal-database
|
container_name: portal-database
|
||||||
networks:
|
|
||||||
- portal-network
|
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_DB=${POSTGRES_DB}
|
- POSTGRES_DB=${POSTGRES_DB}
|
||||||
- POSTGRES_USER=${POSTGRES_USER}
|
- POSTGRES_USER=${POSTGRES_USER}
|
||||||
@ -97,8 +96,6 @@ services:
|
|||||||
cache:
|
cache:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
container_name: portal-cache
|
container_name: portal-cache
|
||||||
networks:
|
|
||||||
- portal-network
|
|
||||||
volumes:
|
volumes:
|
||||||
- redis_data:/data
|
- redis_data:/data
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@ -113,11 +110,3 @@ volumes:
|
|||||||
driver: local
|
driver: local
|
||||||
redis_data:
|
redis_data:
|
||||||
driver: local
|
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