A single-JAR orchestrator for deploying and managing application instances across a cluster of nodes. Originally inspired by Minecraft cloud systems (CloudNet, SimpleCloud), Universe is designed as a general-purpose instance orchestrator with a clean extension API.
- Master/Wrapper Cluster — One Master node exposes a REST API; any number of Wrapper nodes execute instances via Hazelcast task dispatch.
- Template-Based Deployment — Instances are created from templates (file trees) with dynamic variable replacement.
- Pluggable Runtimes — Built-in
screenandtmuxruntimes; Docker and Kubernetes support via extensions. - Remote Template Storage — S3-backed template storage extension for centralized template management.
- Mesh Networking — Tailscale extension exposes mesh-network IPs as template variables for cross-node connectivity.
- Console & REST Commands — Full command system accessible via console or HTTP API.
- Single Fat JAR — Master and Wrapper run from the same JAR; node type is determined by configuration.
- GitOps & ArgoCD — Sync templates from Git; export Kubernetes manifests for ArgoCD tracking.
┌─────────────────────────────────────────────────────────────┐
│ Master Node │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Ktor REST │ │ Hazelcast │ │ Console Commands │ │
│ │ API │ │ IMap/Exec │ │ (Cloud v2) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ POST /api/instances DeployInstanceTask instance create │
│ PUT /api/instances StopInstanceTask instance stop │
│ POST /api/commands TemplateSyncTask template sync │
└─────────────────────────────────────────────────────────────┘
│
│ Hazelcast Cluster
▼
┌─────────────────────────────────────────────────────────────┐
│ Wrapper Node(s) │
│ ┌─────────────┐ ┌─────────────┐ ┌──────────────────────┐ │
│ │ TaskRouter │ │ Template │ │ RuntimeProvider │ │
│ │ (IExecutor) │ │ Manager │ │ (screen/tmux/docker) │ │
│ └─────────────┘ └─────────────┘ └──────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ Receive Tasks Copy Templates Start Processes │
│ Route Actions Replace Variables Pipe Stdin │
└─────────────────────────────────────────────────────────────┘
Requires JDK 25+ and Gradle 9.5+.
./gradlew buildArtifacts are copied to .built/ after build.
| Module | Purpose |
|---|---|
api |
Shared data classes, task DTOs, runtime interfaces, command abstractions |
app |
Core orchestrator logic: Hazelcast, Ktor API, template management, commands |
loader |
Bootstrap classloader that downloads runtime deps and launches app |
extensions/extension-api |
Extension-facing interfaces (Extension, TemplateStorageProvider, etc.) |
extensions/runtime-docker |
Docker container runtime provider |
extensions/runtime-k8s |
Kubernetes Pod runtime provider |
extensions/tailscale |
Tailscale mesh-network IP template variables |
extensions/storage-s3 |
AWS S3 template storage backend |
extensions/db-postgres |
PostgreSQL database provider |
extensions/db-mongodb |
MongoDB database provider |
extensions/db-redis |
Redis database provider |
extensions/metrics-prometheus |
Prometheus metrics export |
extensions/metrics-influxdb |
InfluxDB metrics export |
extensions/gitops |
Git-based template and config sync |
extensions/argocd |
ArgoCD manifest exporter |
extensions/discord |
Discord bot for cluster management |
extensions/example |
Reference extension implementation |
minecraft/minecraft-api |
JVM 8 compatible public API for Minecraft plugin developers |
minecraft/minecraft-modern |
Paper 1.21.11+ plugin with MiniMessage support |
minecraft/minecraft-legacy |
Spigot 1.8.8 plugin with legacy color codes |
minecraft/minecraft-velocity |
Velocity 3.5.0 proxy plugin |
minecraft/minecraft-bungee |
BungeeCord proxy plugin |
minecraft/minecraft-folia |
Folia 1.21+ plugin |
The loader module produces a fat JAR with all dependencies embedded or downloaded at runtime.
java -jar .built/universe-loader-0.0.1.jarOn first run, the following files/directories are created:
./config.json— Node identity and cluster configuration./configuration/— Instance configuration files (.json)./templates/— Template storage (<group>/<name>/)./running/— Active instance working directories./extensions/— Extension JARs and configs
./config.json (main node config):
{
"address": "127.0.0.1",
"port": 6000,
"apiPort": 7000,
"nodeId": "node-1",
"clusterName": "universe-cluster",
"isMasterNode": true,
"masterAddress": "127.0.0.1",
"masterPort": 6000,
"masterApiPort": 7000
}./database.json (database config):
{
"provider": "h2",
"url": "universe.db",
"host": "localhost",
"port": 3306,
"database": "universe",
"username": "sa",
"password": ""
}| Provider | Key | Notes |
|---|---|---|
| H2 (embedded) | h2 |
Default, zero setup, file-based |
| MySQL | mysql |
Built-in, requires running MySQL server |
| PostgreSQL | postgres |
Via extension-db-postgres |
| MongoDB | mongodb |
Via extension-db-mongodb |
| Redis | redis |
Via extension-db-redis |
./configuration/default.json (instance config):
{
"name": "default",
"runtime": "screen",
"command": "java -jar server.jar",
"static": false,
"instanceGroups": [],
"nodes": ["node-1"],
"hostAddress": "127.0.0.1",
"availablePorts": { "min": 25565, "max": 25570 },
"minimumServiceCount": 1,
"environmentVariables": {},
"templateInstallationConfig": {
"allOf": [{ "name": "base", "group": "server", "storage": "local", "priority": 0 }],
"allInGroups": [],
"oneOf": [],
"oneInGroups": [],
"onTemplatePasteOverridePresentFiles": false
},
"fileModifications": ["server.properties"],
"properties": {}
}Create a docker-compose.yml:
services:
universe-master:
image: git.lunarlabs.dev/scala/universe:latest
container_name: universe-master
stdin_open: true
tty: true
ports:
- "7000:7000" # REST API
- "6000:6000" # Hazelcast
volumes:
- ./data:/data
# You can also add a wrapper, but the master should be able to run instances on its own
universe-wrapper:
image: git.lunarlabs.dev/scala/universe:latest
depends_on:
- universe-master
volumes:
- ./wrapper-data:/data
Important: The Wrapper's config.json must set isMasterNode: false and point to the Master's Hazelcast address:
{
"isMasterNode": false,
"masterAddress": "universe-master", // In this case, the Docker Compose service name, it could also be the Master's IP if running separately
"masterPort": 6000,
"masterApiPort": 7000
}Run:
docker compose up -dOption 1: Interactive attach
docker attach universe-master
# Then type commands directly
cluster status
instance list
stopOption 2: REST API (recommended)
# Get all instances
curl http://localhost:7000/api/instances
# Create an instance
curl -X POST http://localhost:7000/api/instances \
-H "Content-Type: application/json" \
-d '{"configurationName": "default"}'
# Execute a console command via REST
curl -X POST http://localhost:7000/api/commands/execute \
-H "Content-Type: application/json" \
-d '{"command": "cluster status"}'All commands work both in the console and via POST /api/commands/execute.
| Command | Description |
|---|---|
cluster status |
Show cluster members and local node info |
cluster nodes |
List all connected nodes |
instance list |
List all instances with state, host, port |
instance create <config> |
Create a new instance from a configuration |
instance stop <id> |
Stop an instance by ID |
instance info <id> |
Show full instance details |
instance execute <id> <cmd> |
Send a command to an instance's stdin |
config list |
List all loaded configurations |
config reload |
Reload configurations from ./configuration/ |
template list |
List local templates (group/name) |
template sync <pattern> <node> |
Sync template(s) to another cluster node |
extension list |
Show installed and loaded extensions |
extension reload |
Trigger onReload() on all extensions |
help |
Show all available commands |
stop / exit |
Graceful shutdown |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/instances |
List all instances |
POST |
/api/instances |
Create instance from configuration |
PUT |
/api/instances/{id}/state |
Update instance state and heartbeat |
POST |
/api/commands/execute |
Execute console command, return output |
DELETE |
/api/instances/{id} |
Stop and remove an instance |
PATCH |
`/api/instances/{id}/lifecycle?target=start | stop |
POST |
/api/instances/{id}/execute |
Send command to instance stdin |
GET |
/api/instances/{id}/logs?lines=100 |
Retrieve last N log lines |
WS |
/api/instances/{id}/live-log |
WebSocket live log streaming |
GET |
/api/ping |
Health check |
GET |
/api/node |
Node info (version, resources, uptime) |
GET |
/api/node/config |
Node configuration |
POST |
/api/node/reload |
Reload node configuration |
WS |
/api/console |
Interactive console WebSocket (master only) |
GET |
/api/cluster/nodes |
List all cluster nodes |
GET |
/api/cluster/nodes/{id} |
Node details with instances |
POST |
/api/cluster/nodes/{id}/command |
Execute command on remote node |
GET |
/api/configurations |
List all configurations |
GET |
/api/configurations/{name} |
Get configuration by name |
PUT |
/api/configurations/{name} |
Create or update configuration |
DELETE |
/api/configurations/{name} |
Delete configuration |
GET |
/api/templates |
List all templates |
GET |
/api/templates/{group}/{name} |
Get template info |
POST |
/api/templates/sync |
Sync templates matching pattern to all nodes |
Universe uses two complementary logging systems:
| System | Purpose | Output |
|---|---|---|
Console (gg.scala.universe.console) |
User-facing CLI output with styled arrows, badges, and tables | stdout (via JLine) |
| SLF4J/Logback | Framework internals (Hazelcast, Docker, K8s, Netty) | ./logs/universe.log |
The debug flag in ./config.json controls both:
- Normal (
debug: false): Console showsINFO+ operational messages; Logback console showsWARN+ only; full logs go to file - Debug (
debug: true): Console showsINFO+ andDEBUGmessages; Logback showsINFO+ for all loggers including frameworks
Log files are rotated daily and retained for 30 days.
Templates live in ./templates/<group>/<name>/.
templates/
global/
server/
server.properties
plugins/
lobby/
default/
server.properties
world/
When an instance is created, TemplateManager:
- Resolves templates from
TemplateInstallationConfig - Copies them to
./running/<instance-id>/in priority order - Scans files listed in
Configuration.fileModifications - Replaces built-in variables:
%PORT%— allocated instance port%INSTANCE_ID%— 6-character instance ID%MASTER_IP%/%MASTER_ADDRESS%— master node address%MASTER_PORT%— master Hazelcast port%MASTER_API_PORT%— master REST API port%NODE_ID%— local node ID%HOST_ADDRESS%— local host address (or runtime-specific override)%CONFIGURATION_NAME%— configuration name
- Replaces extension-provided variables:
- K8s runtime:
%NAMESPACE%,%SERVICE_DNS%,%POD_NAME% - Tailscale:
%TAILSCALE_IP%,%TAILSCALE_MAGIC_DNS%,%TAILSCALE_HOSTNAME%
- K8s runtime:
- Replaces custom variables from
Configuration.properties:- Each entry
{ "myKey": "myValue" }becomes%myKey%→myValue
- Each entry
Template sync between nodes:
template sync server/base node-2
template sync server/* node-2 # sync all in group
template sync * node-2 # sync all templatesExtensions are self-registering JARs placed in ./extensions/.
Runtime extensions:
runtime-docker— Docker container runtimeruntime-k8s— Kubernetes Pod runtimetailscale— Mesh-network IP template variables
Storage extensions:
storage-s3— AWS S3 template storage
Database extensions:
db-postgres— PostgreSQL database providerdb-mongodb— MongoDB database providerdb-redis— Redis database provider
Metrics extensions:
metrics-prometheus— Prometheus metrics export (/api/metrics)metrics-influxdb— InfluxDB metrics export
DevOps extensions:
gitops— Sync templates and configs from Gitargocd— Export Kubernetes manifests for ArgoCD
Integration extensions:
discord— Discord bot for cluster management
Extension structure:
class MyExtension : Extension {
override fun id() = "my-extension"
override fun version() = "1.0.0"
@Inject lateinit var registry: RuntimeRegistry
override fun onLoad() {
registry.register("my-runtime", MyRuntimeProvider())
}
}S3 commands:
s3 upload server/base # upload template to S3
s3 download server/base # download template from S3Universe provides first-class Minecraft integration through a standalone :minecraft:api module and three platform-specific plugins.
- JVM 8 compatible, zero external dependencies
- Provides
UniverseAPIwithInstanceManager,ConfigurationManager, andTemplateManager - All async operations return
CompletableFuture<Optional<T>>for Java ergonomics - Not relocated in shadow JARs so dependent plugins can use API classes at runtime
// In your plugin's onEnable()
Universe.register(this)
// Access the API
val api = Universe.getAPI()
api.instanceManager.getInstances().thenAccept { instances ->
// ...
}- Targets Paper 1.21.11+
- Uses MiniMessage for all chat formatting (
CC.ktconverts&codes internally) - Commands:
/universe info,/universe players,/universe tps - Reports TPS, player count, and max players in heartbeat
- Targets Spigot 1.8.8
- Uses legacy
&color codes viaChatColor.translateAlternateColorCodes - Same
/universecommand set adapted for legacy Bukkit API
- Targets Velocity 3.5.0
- Uses MiniMessage via same
CC.ktpattern as modern - Polls instances from Master REST API and auto-registers them as Velocity servers
- Commands:
/universe info,/universe send <player> <server> - Auto-connect on player join with configurable strategies (
LEAST_POPULATED,MOST_POPULATED,RANDOM)
- Targets BungeeCord (legacy proxy support)
- Uses legacy
&color codes - Same auto-connect and instance polling as Velocity
- Targets Folia 1.21+ (regionized tick scheduling)
- Same command set as modern Paper plugin
- Adapts to Folia's async entity API
The plugin resolves the Master REST API URL from (in priority order):
universe.master.urlJVM system propertyUNIVERSE_MASTER_URLenvironment variablemaster-urlinplugins/Universe/config.yml- Default
http://localhost:6000
Docker / Kubernetes networking:
If the Minecraft server runs in a container or pod and the Master is on a different network, set the env var to a reachable address:
# Docker Compose → containerized server
-e UNIVERSE_MASTER_URL=http://host.docker.internal:6000
# Kubernetes pod → external Master
-e UNIVERSE_MASTER_URL=http://my-game-host.example.com:6000
# Kubernetes pod → in-cluster Master Service
-e UNIVERSE_MASTER_URL=http://universe-master-service:6000./gradlew :minecraft:minecraft-api:build
./gradlew :minecraft:minecraft-modern:build
./gradlew :minecraft:minecraft-legacy:build
./gradlew :minecraft:minecraft-velocity:buildShadow JARs are output to .built/.
Universe's PortAllocator checks three sources before assigning a port:
- Local in-memory allocations — ports already assigned by this JVM instance
- Cluster-wide active instances — queries Hazelcast for all
ONLINE/CREATINGinstances and skips their ports - OS-level availability — attempts a
ServerSocketbind + TCP connect probe to catch services already listening on the machine
This prevents port conflicts even when multiple configurations share overlapping ranges or when external services occupy ports.
By default, instances advertise hostAddress from their configuration. For nodes on different networks, use:
- Tailscale extension — set
hostAddress: "%TAILSCALE_IP%"for encrypted mesh-network connectivity - K8s headless Services — in-cluster DNS:
universe-<id>.<namespace>.svc.cluster.local - Public IP / NodePort — configure
hostAddressto the node's public IP and use K8sNodePortservices
The Velocity and BungeeCord plugins automatically connect players to backend instances on join. Strategies:
| Strategy | Behavior |
|---|---|
LEAST_POPULATED |
Send player to the instance with the fewest players |
MOST_POPULATED |
Send player to the instance with the most players (e.g. for minigame lobbies) |
RANDOM |
Pick a random instance |
Configure in plugins/Universe/config.yml:
auto-connect: true
auto-connect-strategy: LEAST_POPULATED- Create
extensions/runtime-myprovider/ - Implement
RuntimeProviderfrom:api - Implement
Extensionfrom:extensions:extension-api - Register provider in
onLoad()via injectedRuntimeRegistry - Add to
settings.gradle.kts
- Create
extensions/storage-mybackend/ - Implement
TemplateStorageProviderfrom:extensions:extension-api - Register in
onLoad()via injectedTemplateStorageRegistry
- Built-In extensions depend on
:apiand:extensions:extension-apiby default - Never depend on
:appfrom an extension - Use
runtimeDownloadfor external dependencies - Register via injected registries in
onLoad(), not statically
See LICENSE and COPYRIGHT.txt.