38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
postgres-db:
|
|
image: postgres:15-alpine
|
|
environment:
|
|
- POSTGRES_USER=inventory_user
|
|
- POSTGRES_PASSWORD=sandi_rahasia_db_123
|
|
- POSTGRES_DB=inventory_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://inventory_user:sandi_rahasia_db_123@postgres-db:5432/inventory_db?schema=public
|
|
- SESSION_SECRET=ganti_dengan_rahasia_acak_anda
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 2 # Aplikasi kini bisa disebar ke beberapa server!
|
|
restart_policy:
|
|
condition: on-failure
|
|
depends_on:
|
|
- postgres-db
|