What the Controller Does
The Controller coordinates your SimpleCloud infrastructure. It tracks what servers should be running, decides when to start or stop them based on scaling rules, and tells serverhosts what to do via NATS messaging.When You Need to Know This
Understanding the Controller helps when you’re:- Debugging server startup issues - Why isn’t my server starting? Is it queued? Is the reconciler running?
- Setting up high availability - Running multiple controllers requires understanding leader election
- Understanding scaling behavior - Why did a server start or stop? How does the reconciliation loop decide?
State Management
The Controller maintains the authoritative state of your network:| Entity | Description |
|---|---|
| Networks | Registered Minecraft networks with credentials |
| Blueprints | Server configuration templates |
| Groups | Scalable server collections with auto-scaling rules |
| Servers | Running server instances and their status |
| Persistent Servers | Long-running dedicated servers |
| Serverhosts | Connected execution agents |
| Plugins | Plugin definitions and assignments |
Reconciliation Loop
Every 5 seconds, the Controller:- Compares desired state (your configuration) with actual state (running servers)
- Determines which servers need to start or stop
- Selects serverhosts based on capacity and preferences
- Sends start/stop commands via NATS
Auto-Scaling
Slot-Based Scaling
Scale based on total available player slots:Server-Based Scaling
Maintain a fixed number of servers:High Availability
For production deployments, you can run multiple Controller instances:- Leader election uses database-backed consensus with a 30-second lease
- Only the leader performs network assignments and reconciliation
- All instances can serve API requests
- Automatic failover if the leader becomes unavailable
Infrastructure Requirements
| Component | Purpose | Required |
|---|---|---|
| PostgreSQL | State persistence | Yes |
| NATS | Serverhost messaging | Yes |
| Valkey/Redis | Metrics caching | Optional |
| ClickHouse | Log storage | Optional |
Troubleshooting
Controller not starting
Controller not starting
Symptom: Controller process exits immediately or fails to bind to port.Solution:
- Check PostgreSQL is running:
systemctl status postgresql - Verify NATS is reachable:
nc -zv localhost 4222 - Check logs:
sc logs controller - Ensure port 1337 is free:
lsof -i :1337
Servers stuck in QUEUED
Servers stuck in QUEUED
Symptom: Servers stay in QUEUED state and never start.Cause: No serverhost available to run the server.Solution:
- Check serverhost status:
sc status serverhost - Verify hosts have available memory
- Check deployment settings allow the serverhost
- Review logs:
sc logs controller
Scaling not working
Scaling not working
Symptom: Servers don’t scale up when players join or down when empty.Cause: Reconciliation not triggering or metrics not reported.Solution:
- Verify Controller is leader: look for “became leader” in logs
- Check group scaling config (min/max servers, threshold)
- Ensure servers report player counts
- Check reconciliation logs for errors
API returns 401/403
API returns 401/403
Symptom: API calls fail with authentication errors.Solution:
- Verify
X-Network-IDheader matches your network - Verify
X-Network-Secretheader is correct - Check credentials in
secrets/directory
API returns 500
API returns 500
Symptom: API calls fail with internal server error.Solution:
- Check Controller logs for stack traces
- Verify PostgreSQL connectivity
- Check disk space and memory
CLI Access
The Controller must be running for new servers to start. Existing servers
continue running if the Controller temporarily goes offline.
Related
- Developer API - Full API documentation
- Servers - Server lifecycle and states
- Architecture Overview - System architecture diagram