61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
# ─── Database MySQL ───────────────────────────────────────────────────────
|
|
db:
|
|
image: mysql:8.0
|
|
container_name: webgis_db
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
|
|
MYSQL_DATABASE: ${DB_NAME:-spbu_pontianak}
|
|
MYSQL_USER: ${DB_USER:-webgis_user}
|
|
MYSQL_PASSWORD: ${DB_PASSWORD:-webgispassword}
|
|
volumes:
|
|
- db_data:/var/lib/mysql
|
|
- ./schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-rootpassword}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
networks:
|
|
- webgis_net
|
|
|
|
# ─── Aplikasi Node.js ─────────────────────────────────────────────────────
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: webgis_app
|
|
restart: unless-stopped
|
|
# CATATAN: Tidak perlu 'ports' — Coolify/Traefik handle routing otomatis
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3000
|
|
DB_HOST: db
|
|
DB_PORT: 3306
|
|
DB_USER: ${DB_USER:-webgis_user}
|
|
DB_PASSWORD: ${DB_PASSWORD:-webgispassword}
|
|
DB_NAME: ${DB_NAME:-spbu_pontianak}
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
networks:
|
|
- webgis_net
|
|
|
|
volumes:
|
|
db_data:
|
|
driver: local
|
|
|
|
networks:
|
|
webgis_net:
|
|
driver: bridge
|