Update docker-compose to use external postgres database
This commit is contained in:
1 parent
908d5f41e2
commit
f3732380b3
1 file changed
+2
-23
+2
-23
@@ -1,37 +1,16 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
postgres-db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
# PENTING: Lokasi folder data PostgreSQL di Node Manager
|
||||
- /opt/inventory/pgdata:/var/lib/postgresql/data
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
# Database tetap dikunci di Node Manager agar file data tidak hilang
|
||||
- node.role == manager
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
|
||||
inventory-app:
|
||||
image: git.proit.id/ypratama/portal-inventory:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-db:5432/${POSTGRES_DB}?schema=public
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- SESSION_SECRET=${SESSION_SECRET}
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 2 # Aplikasi kini bisa disebar ke beberapa server!
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
depends_on:
|
||||
- postgres-db
|
||||
Reference in new issue
Block a user