Overview
NeoSC uses Docker Compose to orchestrate all infrastructure services. The stack includes Pomerium (Zero Trust proxy), frontend (React SPA), backend (FastAPI), and MongoDB, all connected via isolated Docker networks.Stack Architecture
Docker Compose File
Located atinfra/docker-compose.yml:
- Full Configuration
- Networks
- Volumes
Services
Pomerium
Purpose: Zero Trust reverse proxy and authentication gateway- Bridges public and internal networks
- Only service with external ports exposed
- Health check endpoint at
:5080/ping - Depends on frontend and backend being ready
Frontend
Purpose: React SPA serving the user interface- No external ports exposed
- Accessed only via Pomerium
- Built-in nginx server on port 3000
- Environment variables injected at build time
Backend
Purpose: FastAPI REST API server- Connects to MongoDB on internal network
- Trusts
X-Pomerium-*headers for authentication - Health check at
/healthendpoint - No external ports exposed
| Variable | Purpose | Example |
|---|---|---|
MONGO_URL | MongoDB connection string | mongodb://mongo:27017/neosc |
TRUST_POMERIUM_HEADERS | Trust identity headers from Pomerium | true |
ZITADEL_AUTHORITY | Zitadel OIDC issuer URL | https://manager.kappa4.com |
JWT_SECRET | Secret for signing internal JWTs | <random-secret> |
MongoDB
Purpose: Document database for application data- Persistent volume for data
- Health check using
mongosh - Only accessible from internal network
- No authentication (network isolation provides security)
Networking Details
Network Isolation
Service Discovery
Services communicate using Docker’s built-in DNS:Port Mapping
| Service | Internal Port | External Port | Access |
|---|---|---|---|
| Pomerium | 443 | 443 | Public (via domain) |
| Pomerium | 80 | 80 | Public (redirects to 443) |
| Pomerium | 5080 | - | Health check (internal) |
| Frontend | 3000 | - | Via Pomerium only |
| Backend | 8001 | - | Via Pomerium only |
| MongoDB | 27017 | - | Via backend only |
Deployment Commands
Start Stack
Stop Stack
Update Services
View Logs
Health Checks
All services define health checks for monitoring:Manual Health Checks
Resource Limits
For production, add resource limits:Environment Variables
Createinfra/.env with required variables:
Troubleshooting
Service fails to start
Service fails to start
Cannot connect between services
Cannot connect between services
Port already in use
Port already in use
Volume permission errors
Volume permission errors
Best Practices
Use .env Files
Never hardcode secrets in docker-compose.yml. Use
.env and add to .gitignore.Health Checks
Define health checks for all services to enable automatic restart on failure.
Resource Limits
Set CPU and memory limits in production to prevent resource exhaustion.
Persistent Volumes
Always use named volumes for data that should survive container recreation.
Next Steps
Deployment Guide
Step-by-step deployment instructions
Pomerium Configuration
Configure Zero Trust proxy policies