What is the Serverhost?
The Serverhost is a distributed execution agent that runs on each machine in your SimpleCloud infrastructure. It receives commands from the Controller and manages the actual lifecycle of Minecraft servers - from preparation to execution to cleanup.Key Responsibilities
Server Lifecycle
The Serverhost manages the complete server lifecycle:- Preparation - Execute workflows, copy templates, install plugins
- Configuration - Apply configurators to set ports, secrets, etc.
- Execution - Launch the server process (Screen/Tmux or Docker)
- Monitoring - Track server health and stream logs
- Cleanup - Stop process and remove temporary files
Workflow Execution
Workflows define the server preparation process:- Copy template files to server directory
- Download and install plugins from registries
- Apply configuration based on server software
- Execute custom setup steps
Plugin Management
Automatic plugin installation from multiple sources:| Source | Description |
|---|---|
| Modrinth | Modern plugin/mod registry |
| Hangar | PaperMC’s plugin repository |
| Spigot | SpigotMC resource pages |
| URL | Direct download from any HTTP(S) URL |
Architecture
Execution Modes
Screen/Tmux (Local)
The default execution mode using terminal multiplexers:- Screen - Preferred, widely available on Linux
- Tmux - Alternative if Screen is unavailable
Docker
Container-based execution for isolation:- Each server runs in its own container
- Resource limits enforced by Docker
- Better isolation between servers
- Requires Docker to be installed
Directory Structure
secrets
network-id.key
network-secret.key
serverhost-id.key
workflows
internal
setup.yml
cleanup.yml
options
configurators
modrinth-platform-mappings.yml
templates
every
every_proxy
every_server
every_paper
every_velocity
_tagged
cache
running
logs
Template Hierarchy
Templates are applied in order, with later templates overwriting earlier ones:| Order | Directory | Description |
|---|---|---|
| 1 | every/ | Base files for all servers |
| 2 | every_{type}/ | Type-specific (e.g., every_proxy/) |
| 3 | every_{software}/ | Software-specific (e.g., every_paper/) |
| 4 | _tagged/{tag}/ | For each tag assigned to the group |
| 5 | {server-name}/ | Server-specific templates |
| 6 | cache/{group}/ | Cached files from previous runs |
Communication
NATS Messaging
The Serverhost communicates with the Controller via NATS: Inbound (from Controller):{networkId}.serverhost.{id}.start- Start server request
{networkId}.server.{id}.status- Server status updates{networkId}.server.{id}.logs- Log streaming{networkId}.internal.serverhost.{id}.keep-alive- Health checks
State Synchronization
Every minute, the Serverhost:- Fetches active servers from Controller
- Compares with locally running servers
- Stops orphaned servers not in Controller’s state
Server Preparation Flow
When a start request arrives:Configuration
Serverhost configuration via CLI parameters:| Parameter | Description | Default |
|---|---|---|
--network-id | Network identifier | From env |
--controller-url | Controller API URL | platform.simplecloud.app |
--nats-url | NATS server URL | platform.simplecloud.app |
--deployment-type | Execution mode | local |
--port-range | Available port range | 25565-25665 |
--multiplexer | Screen or Tmux | Auto-detect |
Monitoring
Via CLI
Keep-Alive
The Serverhost sends periodic keep-alive messages:- Reports current version
- Receives update notifications
- Maintains connection with Controller
Serverhosts automatically restart servers if the Serverhost itself restarts,
based on synchronization with the Controller’s state.
Related Topics
- Configurators - Server configuration system
- Workflows - Server preparation workflows