88 lines
3.0 KiB
YAML
88 lines
3.0 KiB
YAML
# FitOS — hosting na alternatywnym urządzeniu (alt-host).
|
|
# Pełny stos (api + db + app + admin) w jednym projekcie "fitos-alt".
|
|
# Porty hosta 13xxx odpowiadają głównemu mapowaniu 9xxx:
|
|
# admin 13000 (9000), app 13001 (9001), api 13002 (9002),
|
|
# db 13543 tylko na 127.0.0.1. Kontenery wewnętrznie: 9002/9001/9000/5432.
|
|
# Uruchamiane przez remote/deploy.ps1: docker compose -f remote/docker-compose.yml --env-file ../.env up -d --build
|
|
name: fitos-alt
|
|
|
|
services:
|
|
api:
|
|
build: ../api
|
|
container_name: fitos-api-alt
|
|
ports:
|
|
- "${API_HOST_PORT:-13002}:9002"
|
|
environment:
|
|
DATABASE_URL: postgresql://fitos:fitos@db:5432/fitos
|
|
PORT: 9002
|
|
NODE_ENV: production
|
|
JWT_ACCESS_SECRET: ${JWT_ACCESS_SECRET:?set JWT_ACCESS_SECRET in .env}
|
|
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:?set JWT_REFRESH_SECRET in .env}
|
|
FITOS_FIRST_ADMIN_EMAIL: ${FITOS_FIRST_ADMIN_EMAIL:-}
|
|
FITOS_FIRST_ADMIN_PASSWORD: ${FITOS_FIRST_ADMIN_PASSWORD:-}
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
COOKIE_SECURE: ${COOKIE_SECURE:-false}
|
|
# dokładne origins gdy użytkownicy wchodzą po IP alt-hosta (poza DDNS)
|
|
CORS_EXTRA_ORIGINS: ${CORS_EXTRA_ORIGINS:-}
|
|
UPLOAD_DIR: /app/uploads
|
|
# Daty treningowe (północ/23:59 dnia) liczone są w strefie procesu —
|
|
# kontener musi pracować w strefie użytkowników, nie w UTC.
|
|
TZ: ${TZ:-Europe/Warsaw}
|
|
volumes:
|
|
- fitos_alt_uploads:/app/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:9002/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: fitos-db-alt
|
|
ports:
|
|
# tylko localhost na hoście alt — dostęp wyłącznie z sieci compose (DNS "db")
|
|
- "127.0.0.1:${DB_HOST_PORT:-13543}:5432"
|
|
environment:
|
|
POSTGRES_USER: fitos
|
|
POSTGRES_PASSWORD: fitos
|
|
POSTGRES_DB: fitos
|
|
volumes:
|
|
- fitos_alt_pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U fitos -d fitos"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
app:
|
|
build: ../app
|
|
container_name: fitos-app-alt
|
|
ports:
|
|
- "${APP_HOST_PORT:-13001}:9001"
|
|
volumes:
|
|
# runtime config API (window.__FITOS_CONFIG__) — generowany przez deploy.ps1
|
|
# z config.js.tpl i montowany BEZ rebuildu obrazu.
|
|
# :z — przeetykietowanie SELinux (Fedora na hoście alt blokuje inaczej odczyt
|
|
# plików z katalogu domowego przez kontener — "Permission denied" w nginx)
|
|
- ./config/app.config.js:/usr/share/nginx/html/config.js:ro,z
|
|
restart: unless-stopped
|
|
|
|
admin:
|
|
build: ../admin
|
|
container_name: fitos-admin-alt
|
|
ports:
|
|
- "${ADMIN_HOST_PORT:-13000}:9000"
|
|
volumes:
|
|
- ./config/admin.config.js:/usr/share/nginx/html/config.js:ro,z
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
fitos_alt_pgdata:
|
|
fitos_alt_uploads:
|