Ceremony Integration (NATS)
Ceremony Integration
Section titled “Ceremony Integration”Journey uses Ceremony’s NATS messaging system to enable cross-server functionality for global tasks and parties. This guide explains how to set up NATS for your server network.
What is NATS?
Section titled “What is NATS?”NATS is a lightweight messaging system that allows your servers to communicate in real-time. Journey uses Ceremony’s NATS integration to sync:
- Global task progress across all servers
- Global task start/stop commands
- Party invites and updates across servers
- Party task progress for cross-server parties
Prerequisites
Section titled “Prerequisites”- Ceremony mod installed on all servers
- Journey mod installed on all servers
- A NATS server (can be on a separate machine or one of your Minecraft servers)
Setting Up NATS
Section titled “Setting Up NATS”Step 1: Install a NATS Server
Section titled “Step 1: Install a NATS Server”Choose one of these options:
Option A: Docker (Recommended)
Section titled “Option A: Docker (Recommended)”docker run -d --name nats -p 4222:4222 -p 8222:8222 nats:latestPorts:
4222- Client connections8222- HTTP monitoring
Option B: Standalone Binary
Section titled “Option B: Standalone Binary”- Download from https://nats.io/download/
- Run the server:
Terminal window ./nats-server
Step 2: Configure Ceremony
Section titled “Step 2: Configure Ceremony”Edit config/ceremony/config.json on each Minecraft server:
{ "nats": { "enabled": true, "url": "nats://localhost:4222", "cluster_name": "my-network", "server_name": "survival" }}Configuration Options:
enabled- Set totrueto enable NATS messagingurl- URL of your NATS server (use your NATS server’s IP/hostname)cluster_name- A unique identifier for your server network (must be the same on all servers)server_name- A unique name for this specific server (e.g., “survival”, “creative”, “skyblock”)
Multi-Server Setup Example
Section titled “Multi-Server Setup Example”Network Layout
Section titled “Network Layout”- NATS Server:
192.168.1.100:4222 - Servers: Survival, Creative, Skyblock
Survival Server
Section titled “Survival Server”File: config/ceremony/config.json
{ "nats": { "enabled": true, "url": "nats://192.168.1.100:4222", "cluster_name": "pixelmon-network", "server_name": "survival" }}Creative Server
Section titled “Creative Server”File: config/ceremony/config.json
{ "nats": { "enabled": true, "url": "nats://192.168.1.100:4222", "cluster_name": "pixelmon-network", "server_name": "creative" }}Skyblock Server
Section titled “Skyblock Server”File: config/ceremony/config.json
{ "nats": { "enabled": true, "url": "nats://192.168.1.100:4222", "cluster_name": "pixelmon-network", "server_name": "skyblock" }}Key Points:
- All servers use the same NATS URL
- All servers use the same cluster_name
- Each server has a unique server_name
Verification
Section titled “Verification”Check Server Logs
Section titled “Check Server Logs”After starting your Minecraft servers, check the logs for:
[Ceremony] Successfully connected to NATS server at nats://192.168.1.100:4222[Ceremony] NATS cluster: pixelmon-network, server: survivalVerify Connection
Section titled “Verify Connection”If you see connection errors:
- NATS server is running - Check with
docker ps(Docker) or process manager - Port 4222 is accessible - Check firewall rules
- URL is correct - Verify IP/hostname in config
- NATS server is reachable - Test with
telnet 192.168.1.100 4222
How Cross-Server Sync Works
Section titled “How Cross-Server Sync Works”Global Tasks Sync
Section titled “Global Tasks Sync”When you run /globaltask start journey:example_task on the Survival server:
- Survival server broadcasts a
GlobalTaskStartPacketvia NATS - All connected servers receive the packet and start the task locally
- Boss bars appear for all players on all servers
- Any player action on any server contributes to the shared progress
- Progress updates are broadcast via
GlobalTaskProgressPacket - All servers update their boss bars in real-time
Party Sync
Section titled “Party Sync”When a party is created:
- Party data is stored on the server where it was created
- Party invites are sent via NATS to players on other servers
- Party updates (member join/leave/kick) sync across all servers
- Task progress from any party member on any server is shared with all party members
NATS Monitoring
Section titled “NATS Monitoring”HTTP Monitoring Interface
Section titled “HTTP Monitoring Interface”Access the NATS monitoring interface at:
http://your-nats-server:8222Available endpoints:
/varz- General server information/connz- Connection information/subsz- Subscription information/routez- Route information
Command Line Monitoring
Section titled “Command Line Monitoring”If using NATS CLI tools:
# List serversnats server list
# Monitor activitynats server request
# View subscriptionsnats subscription listTroubleshooting
Section titled “Troubleshooting”Global Tasks Not Syncing
Section titled “Global Tasks Not Syncing”Symptoms:
- Global tasks start on one server but not others
- Progress doesn’t sync across servers
Check:
- NATS is running and accessible from all servers
- All servers have matching
cluster_namein Ceremony config global_tasks_enabled: truein Journey config- Server logs show successful NATS connection
- No firewall blocking port 4222
Test:
- Start a global task on Server A
- Check logs on Server B for “Started global task from network: …”
- If no message appears, NATS messages aren’t reaching Server B
Party Invites Not Working Cross-Server
Section titled “Party Invites Not Working Cross-Server”Symptoms:
- Players can’t invite players on other servers
- Party commands fail for cross-server operations
Check:
- NATS is configured and connected
party_enabled: truein Journey config- Players have correct permissions
- Target player is actually online on the other server
- Check server logs for NATS errors
Connection Errors
Section titled “Connection Errors”Error: Failed to connect to NATS server
Solutions:
- Verify NATS server is running
- Check firewall allows port 4222
- Verify
urlin config is correct - Test connectivity with
telnet <ip> 4222
Error: Authentication failed
Solutions:
- If NATS has authentication, add credentials to URL:
"url": "nats://username:password@192.168.1.100:4222"
Performance Considerations
Section titled “Performance Considerations”NATS Server Resources
Section titled “NATS Server Resources”Recommended Specs:
- CPU: 1-2 cores
- RAM: 512MB - 1GB
- Network: Low latency connection to Minecraft servers
Message Throughput
Section titled “Message Throughput”- Global tasks generate messages on every player action that matches filters
- Parties generate messages when any member makes task progress
- For large networks (100+ players), monitor NATS message throughput
Optimization Tips
Section titled “Optimization Tips”- Dedicated NATS server - Don’t run NATS on the same machine as Minecraft for production
- Low latency network - Keep NATS server on the same network as Minecraft servers
- Monitor message rate - Use NATS monitoring to track messages/second
- Limit concurrent global tasks - Max 2-3 active global tasks recommended
- Optimize task filters - Complex MoLang filters execute on every event
Security
Section titled “Security”Network Security
Section titled “Network Security”✅ Internal network only - Don’t expose NATS port 4222 to the internet
✅ Firewall rules - Allow only your Minecraft servers to connect
✅ Authentication - Enable NATS authentication for production:
# Start NATS with authenticationnats-server --user admin --pass secretpasswordUpdate Ceremony config:
{ "nats": { "url": "nats://admin:secretpassword@192.168.1.100:4222" }}TLS Encryption
Section titled “TLS Encryption”For sensitive data, enable TLS:
# Start NATS with TLSnats-server --tls --tlscert=server.crt --tlskey=server.keyUpdate Ceremony config:
{ "nats": { "url": "nats://192.168.1.100:4222", "tls": true }}Best Practices
Section titled “Best Practices”Infrastructure
Section titled “Infrastructure”✅ Dedicated NATS server - Separate from Minecraft servers
✅ Reliable networking - Low latency, high availability network
✅ Monitor NATS - Use monitoring interface to track health
✅ Backup configs - Keep Ceremony configs in version control
Failover
Section titled “Failover”What happens if NATS goes down?
- Global tasks continue working locally on each server
- Cross-server sync stops until NATS reconnects
- Parties continue working locally on their home server
- When NATS reconnects, sync resumes automatically
Recommendations:
- Run NATS on a reliable machine with high uptime
- Consider NATS clustering for high availability (advanced)
- Monitor NATS health and set up alerts
Related Systems
Section titled “Related Systems”- Global Tasks - Server-wide collaborative tasks
- Party System - Group task sharing
- Configuration - Journey configuration options