All checks were successful
dev - build & deploy naar test / build-and-deploy (push) Successful in 21s
56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
# Deploy-compose voor test/prod. Draait op de VM.
|
|
# De app-image wordt NIET gebouwd maar uit de Forgejo registry gepulld.
|
|
# CI zet het juiste IMAGE (incl. tag) in een .env naast dit bestand en draait:
|
|
# docker compose -f compose.deploy.yaml pull
|
|
# docker compose -f compose.deploy.yaml up -d
|
|
#
|
|
# Verwachte env-variabelen op de VM (in ./.env):
|
|
# IMAGE=10.0.20.22:3000/bes-r/teach:dev (of :vX.Y.Z op prod)
|
|
# POSTGRES_DB / POSTGRES_USER / POSTGRES_PASSWORD
|
|
# DATABASE_URL=postgres://<user>:<pw>@db:5432/<db>
|
|
# APP_PORT=3000 (poort die nginx op deze VM naar de app proxyt)
|
|
|
|
services:
|
|
app:
|
|
image: ${IMAGE}
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
PORT: 3000
|
|
DATABASE_URL: ${DATABASE_URL}
|
|
APP_VERSION: ${IMAGE}
|
|
ports:
|
|
# Alleen op localhost van de VM; nginx zit ervoor als reverse proxy
|
|
- "127.0.0.1:${APP_PORT:-3000}:3000"
|
|
restart: unless-stopped
|
|
|
|
web:
|
|
image: nginx:alpine
|
|
depends_on:
|
|
- app
|
|
ports:
|
|
# Bereikbaar in de browser op http://<vm-ip>:8081
|
|
- "8081:80"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
restart: unless-stopped
|
|
|
|
db:
|
|
image: postgres:17-alpine
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./db:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
pgdata:
|