Operations + Deployment
Deploy NioFlow apps with predictable startup behavior, observable health, and safe runtime defaults. This page covers both release mechanics and day-2 operations basics.
Deployment Strategy
Treat deployment as a repeatable process, not a manual push. Build immutable artifacts, configure env values per environment, verify readiness endpoints, and only then shift traffic.
11) Build once (CI) and publish artifact22) Promote same artifact to staging/prod33) Inject environment-specific variables at runtime44) Validate /_ready before accepting traffic55) Roll forward or roll back based on health + logs
Production Build with CLI
You can use the CLI to package your application for deployment. This generates the fat JAR in your target directory.
If you scaffolded with nioflow new, the Maven Wrapper is already included. Run nioflow dev locally and use ./mvnw package in CI.
1# From project root2./mvnw clean package -DskipTests34# Runnable artifact will be in:5# target/my-app-1.0-SNAPSHOT-jar-with-dependencies.jar
Required Environment Variables
Keep environment values outside source control. Use your platform secret manager for all sensitive values.
1PORT=80802JWT_SECRET=replace-with-32-plus-char-secret3NIOFLOW_CORS_ORIGIN=https://your-frontend-domain4NIOFLOW_ENABLE_DB=false5NIOFLOW_CHAOS_ENABLED=false6NIOFLOW_REPLAY_ENABLED=false
Recommended Production Runtime Values
Warning: NIOFLOW_EXPOSE_ERROR_DETAILS=true will leak full Java exception stack traces directly to HTTP clients. This should remain false in production to prevent exposing internal application structure.
1NIOFLOW_EXPOSE_ERROR_DETAILS=false2NIOFLOW_DISABLE_AUTH=false3NIOFLOW_CHAOS_ENABLED=false4NIOFLOW_REPLAY_ENABLED=false5JAVA_TOOL_OPTIONS=-Xms256m -Xmx512m -XX:+UseG1GC
Docker Deployment
Container deployments are ideal for consistency. Ensure the image runs as non-root and only exposes the required port.
1docker build -t nioflow-app .2docker run --rm -p 8080:8080 -e PORT=8080 -e JWT_SECRET=replace-with-32-plus-char-secret -e NIOFLOW_ENABLE_DB=false nioflow-app
Render / Railway Quick Setup
These platforms provide port and process orchestration. Keep startup command simple and rely on environment variables for all deployment-specific behavior.
1PORT = (auto provided by platform)2JWT_SECRET = your long random secret3NIOFLOW_CORS_ORIGIN = https://your-frontend-domain4NIOFLOW_ENABLE_DB = false
Health + Readiness Checks
Health indicates the process is alive, readiness indicates the service can accept production traffic.
1curl -i http://localhost:8080/_health2curl -i http://localhost:8080/_ready3curl -i http://localhost:8080/metrics
Operations Incident Basics
11) Confirm failing endpoint and scope22) Check /_health and /_ready status33) Review application logs around the failure window44) Verify env values and secrets are present55) Roll back to last healthy release if needed66) Capture root cause and preventive action in runbook
Post-Deploy Verification
1curl -fsS https://your-api/_health2curl -fsS https://your-api/_ready3curl -fsS https://your-api/api/tasks/45# Expected: all commands return successful HTTP responses
Production Checklist
1[x] Global onError handler registered2[x] Graceful shutdown hook registered3[x] Protected routes gated by AuthMiddleware4[x] JWT secret validated at startup5[x] Integration tests assert auth enforcement and observability6[x] Integration tests assert 404 vs 405 distinction7[x] Integration tests assert middleware ordering and header preservation8[x] Integration tests assert circuit breaker state transitions9[x] TLS plan finalized (listenSecure or reverse proxy termination)10[x] Runtime sizing validated with load testing (k6)11[x] Vulnerability scanning enforced in CI (OWASP) — 271 tests passing, 83% instruction coverage