๐ System Architecture & Overview
Welcome to the NerdAgent Ecosystem Control Plane. This application provides a 100% web-based, zero-SSH management suite for compiling, deploying, monitoring, and migrating the entire microservice ecosystem.
๐ก Zero-SSH Philosophy: You do not need terminal SSH access to run migrations, inspect live logs, execute shell diagnostics, pull code from GitHub, or update Nginx reverse proxy rules. Everything is controlled directly from this dashboard.
Core Architectural Principles
- Container Isolation: All microservices run in isolated containers sharing a high-performance Docker bridge network named
nerdagent-net.
- Socket-Level Orchestration: The Deployment Manager communicates directly with the Docker daemon via
/var/run/docker.sock to rebuild images, recreate containers, and collect telemetry.
- Unified Ingress: Host Nginx proxies incoming traffic from
https://app.deploy.nerdagent.ai with extended timeouts (900s) to support large Docker builds without 504 errors.
- Zero-Downtime Rollouts: Health checks verify that newly spawned containers pass HTTP/TCP probes before routing traffic.
๐ฆ Microservice Lifecycle & Card Actions
Each service card represents a containerized microservice and displays live health status, port bindings, RAM/CPU load, and operational buttons:
Status Indicators
- HEALTHY Service is running and passing both HTTP health check and TCP port checks.
- STARTING Container is spinning up, waiting on database dependencies, or running startup migrations.
- STOPPED Container has exited or has not yet been built and deployed.
Card Action Buttons
- ๐จ Build & Rollout: Runs
git pull in the service directory, compiles a fresh Docker image via docker compose build, recreates the container, and automatically executes database migrations.
- ๐ Logs: Opens a live streaming terminal displaying realtime
stdout and stderr from the Docker daemon.
- ๐ป Exec: Launches an interactive in-container shell allowing you to run debugging commands (e.g.
alembic current, ps aux, df -h) directly inside the container sandbox.
- โก DB: Opens the database console pre-selected for that microservice's database.
- โ Docs: Opens the interactive Swagger / OpenAPI documentation UI for the microservice.
- ๐ Restart: Gracefully reboots the existing container instance in-place.
- โก Recreate: Destroys the container and spawns a fresh container instance to reload new environment variables or volume mounts.
- โน Stop: Gracefully stops the container process.
๐๏ธ Database Migrations & Rollback Guide
The ecosystem utilizes PostgreSQL clusters running in Docker containers. Migrations are managed natively using the microservice's framework:
Supported Migration Frameworks
- Alembic (Python): Unified Agent Platform, Tool Gateway Service, FinOps & Audit Service.
- Prisma (Node.js): Identity IAM Service.
- SQL DDL Migrator: Knowledgebase EKS Control.
Operation Reference
- โก Upgrade to Head: Executes all pending schema migration scripts in chronological order. Runs transactionally (rolls back on SQL error).
- โช Rollback -1: Safely reverts the most recent migration revision (e.g.
alembic downgrade -1). Use this if a newly deployed schema change introduced an unexpected issue.
- ๐ Check Status: Inspects the database
alembic_version or _prisma_migrations table and prints the current revision ID without modifying anything.
- ๐ History: Displays the complete chronology of migration files and their timestamps.
- ๐ฑ Seed DB: Executes seed scripts to populate base lookup tables, system accounts, and default configurations.
โก Zero-SSH Gateway & Manager Self-Update
How the Update Gateway & Ops button operates without requiring SSH:
Automated Workflow
- Git Pull Master: Executes
git pull origin master with safe.directory=* in /opt/nerdagent/ecosystem-deployment-manager.
- Atomic Nginx Sync: Reads
templates/nginx/app.deploy.nerdagent.ai.conf and writes it directly to host /etc/nginx/sites-available/ and enables the symlink in sites-enabled/.
- Graceful Nginx Reload: Spawns an ephemeral container with host PID access to execute
pkill -HUP -f 'nginx: master process'. Nginx reloads worker processes with zero downtime and zero dropped connections.
- Asynchronous Container Restart: Schedules an asynchronous reload of the
nerdagent-deployment-manager container 2 seconds later to apply code changes cleanly.
- UI Auto-Refresh: The browser automatically reloads 3.5 seconds later to display the new frontend version.
๐ Ingress, Nginx & Port Matrix
Public domain: https://app.deploy.nerdagent.ai
Port Allocations & Network Routing
Service Name Container Port Host Bind Port Internal Bridge DNS
-------------------------------------------------------------------------------------
Deployment Manager (Control) 8090 :8090 nerdagent-deployment-manager
Agent Platform (Unified) 8000 :8000 unified-agent-platform
Identity IAM Service 3000 :3000 identity-service
Knowledgebase Service (EKS) 8000 :8002 eks-control
Tool Gateway Service 8003 :8003 tool-gateway-service
FinOps & Audit Service 8004 :8004 finops-audit-service
IAM PostgreSQL 5432 :5433 nerd-iam-postgres
EKS PostgreSQL (Vector) 5432 :5435 nerd-eks-postgres
Tool PostgreSQL 5432 :5434 nerd-tool-postgres
Unified PostgreSQL 5432 :5436 nerd-unified-postgres
Redis Cache 6379 :6379 nerd-redis
MinIO S3 Storage 9000 / 9001 :9000 / :9001 nerd-minio
Nginx Reverse Proxy Paths
/ops/ โ Proxies to Deployment Manager on port :8090 (Timeout: 900s).
/api/v1/deploy/ โ Deploy build & streaming logs endpoint.
/ โ Proxies to NerdAgent Web Application.
๐ก๏ธ Config & Secret Vault Guide
The Config Vault allows viewing and editing configuration variables stored in .env without manual file editing:
Safety & Backup Guarantee
- Automatic Timestamped Backups: Before any save operation, the existing file is saved to
.env.bak_YYYYMMDD_HHMMSS. You can always revert if a mistake is made.
- Categorized Grouping: Variables are categorized into Ingress, Databases, AI Providers, Security, and Application settings.
- Secret Masking: Sensitive tokens (passwords, JWT secrets, API keys) are hidden by default. Click "Reveal Secrets" to view or edit them.
- Container Auto-Reload: When "Apply & Restart Affected Containers" is checked, microservices that consume modified variables will be restarted automatically.
๐ฉบ Troubleshooting & Frequently Asked Questions
Q: Build failed with "Unexpected token '<', ..."?
Cause: Nginx default timeout (60s) cut off the HTTP connection during a long Docker compilation and returned an HTML 504 Gateway Time-out error page.
Fix: Click Update Gateway & Ops. The latest Nginx configuration sets proxy_read_timeout 900s; (15 minutes), resolving build timeouts completely.
Q: A database shows "STARTING" status indefinitely?
Cause: Host port mismatch or healthcheck timeout.
Fix: Open Health Matrix to inspect TCP socket reachability, or open DB Console and run Check Status to verify credentials.
Q: Git pull fails with "fatal: detected dubious ownership"?
Fix: The Deployment Manager automatically injects git -c safe.directory=* on all Git operations, allowing smooth execution regardless of file ownership on host.
Q: Host disk space is running low?
Fix: Click Clean Disk in the header. This removes unused build cache layers and dangling images, frequently reclaiming 10-25 GB of storage.