feat(db): add postgres setup and multi-tenant config

This commit is contained in:
DanielS
2026-08-18 23:56:51 +02:00
commit 407d40b2e8
13 changed files with 420 additions and 0 deletions

57
docker-compose.yml Normal file
View File

@@ -0,0 +1,57 @@
version: '3.8'
services:
# 1. PostgreSQL 16 Datenbank (Hybrid Multi-Tenant Storage)
postgres:
image: postgres:16-alpine
container_name: caspos-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-caspos_reservations}
POSTGRES_USER: ${POSTGRES_USER:-caspos_admin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secretpassword}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres/init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-caspos_admin} -d ${POSTGRES_DB:-caspos_reservations}"]
interval: 5s
timeout: 5s
retries: 5
# 2. Spring Boot 3 Java Backend (API)
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: caspos-backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-caspos_reservations}
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-caspos_admin}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-secretpassword}
SPRING_PROFILES_ACTIVE: docker
ports:
- "8080:8080"
# 3. TypeScript / React Frontend (Tischplan & UI)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: caspos-frontend
restart: unless-stopped
depends_on:
- backend
environment:
NEXT_PUBLIC_API_URL: http://localhost:8080/api/v1
ports:
- "3000:3000"
volumes:
postgres_data: