feat: CMDB full-stack app - FastAPI + PostgreSQL + React

- PostgreSQL schema: 14 tables, JSONB attributes, audit triggers, soft delete
- FastAPI backend: CRUD, search/filter, relationship graph, bulk import, JWT RBAC
- React frontend: CI table, detail card, force-graph, dashboard
- Seed data: homelab scenario (Proxmox, Mikrotik, VMs, services)
- Docker Compose + Kubernetes manifests
- 20 backend tests (pytest + httpx)
This commit is contained in:
2026-06-25 13:01:40 +07:00
commit 9b15f8b09c
47 changed files with 4268 additions and 0 deletions

69
docker-compose.prod.yml Normal file
View File

@@ -0,0 +1,69 @@
version: "3.9"
services:
postgres:
image: postgres:16-alpine
container_name: cmdb-postgres
environment:
POSTGRES_DB: cmdb
POSTGRES_USER: cmdb
POSTGRES_PASSWORD: cmdb_secret
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./backend/migrations/001_initial_schema.sql:/docker-entrypoint-initdb.d/001.sql
- ./backend/migrations/002_seed_data.sql:/docker-entrypoint-initdb.d/002.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cmdb"]
interval: 5s
timeout: 3s
retries: 5
redis:
image: redis:7-alpine
container_name: cmdb-redis
ports:
- "6379:6379"
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: cmdb-backend
environment:
DATABASE_URL: postgresql+asyncpg://cmdb:cmdb_secret@postgres:5432/cmdb
JWT_SECRET: ${JWT_SECRET:-super-secret-change-me}
REDIS_URL: redis://redis:6379/0
CORS_ORIGINS: '["http://localhost:3000","http://localhost:5173"]'
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: cmdb-frontend
ports:
- "3000:80"
depends_on:
- backend
nginx:
image: nginx:alpine
container_name: cmdb-nginx
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- backend
- frontend
volumes:
pgdata: