Skip to main content

Overview

Oyasai Server Platform implements comprehensive monitoring through Docker health checks, RCON remote console access, and automated logging systems.

Health Checks

The Minecraft server container includes built-in health monitoring:
packages/cdktf/src/stacks/docker-stack.ts
healthcheck: {
  test: ["mc-health"],
  startPeriod: "1m",
  interval: "5s",
  retries: 20,
}

Health Check Configuration

test
array
required
Command to execute for health check: ["mc-health"]
startPeriod
string
default:"1m"
Grace period during server startup before health checks begin
interval
string
default:"5s"
Time between health check executions
retries
number
default:"20"
Number of consecutive failures before marking container unhealthy

Monitoring Health Status

Check the health status of running containers:
# View container health status
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Health}}"

# View detailed health check logs
docker inspect --format='{{json .State.Health}}' minecraft-main | jq

# Follow health check events
docker events --filter event=health_status

RCON Remote Console

RCON provides remote administration capabilities:

Connection Configuration

env: envs({
  RCON_PASSWORD: this.secrets.RCON_PASSWORD,
}),
ports: ports({
  tcp: [25575],  // RCON port
})

Common RCON Commands

# List online players
list

# Check server TPS
tps

# View server version
version

# Check memory usage
memory
# Kick player
kick <player> <reason>

# Ban player
ban <player> <reason>

# Whitelist management
whitelist add <player>
whitelist remove <player>
whitelist list
# Save world
save-all

# Stop server gracefully
stop

# Reload configuration
reload

# Broadcast message
say <message>

Logging System

The server implements rolling logs with timestamps:
env: envs({
  ENABLE_ROLLING_LOGS: true,
  LOG_TIMESTAMP: true,
})

Log Configuration

ENABLE_ROLLING_LOGS
boolean
default:"false"
Enable automatic log rotation to prevent disk space issues
LOG_TIMESTAMP
boolean
default:"false"
Add timestamps to all log entries for easier debugging

Viewing Logs

# Follow container logs in real-time
docker logs -f minecraft-main

# View last 100 lines
docker logs --tail 100 minecraft-main

# View logs since specific time
docker logs --since 1h minecraft-main

# View logs with timestamps
docker logs -t minecraft-main

Container Monitoring

Resource Usage

Monitor container resource consumption:
# Real-time resource stats
docker stats minecraft-main

# Resource usage in JSON format
docker stats --no-stream --format "{{json .}}" minecraft-main | jq

Memory Allocation

Memory is configured per environment:
MEMORY: "28G"
28GB allocated for production workloads

Network Monitoring

Port Status

Monitor network connectivity:
# Check listening ports
docker port minecraft-main

# Test Minecraft connection
telnet localhost 25565

# Test RCON connection
telnet localhost 25575

# Test BlueMap web interface
curl -I http://localhost:8100

Network Traffic

# View network stats
docker stats --format "table {{.Name}}\t{{.NetIO}}" minecraft-main

# Inspect network configuration
docker network inspect network

Database Monitoring

The MariaDB container requires separate monitoring:
packages/cdktf/src/stacks/docker-stack.ts
const mariadbContainer = new Container(
  this,
  this.envAwareId("mariadb-container"),
  {
    image: images.mariadb.imageId,
    name: "mariadb",
    restart: "unless-stopped",
    env: envs({
      MARIADB_ROOT_PASSWORD: this.secrets.MARIADB_PASSWORD,
    }),
  },
);

Database Health Checks

# Check MariaDB container status
docker exec mariadb mysqladmin ping -p

# View database processes
docker exec mariadb mysqladmin processlist -p

# Check database size
docker exec mariadb mysql -p -e "SELECT table_schema, SUM(data_length + index_length) / 1024 / 1024 AS 'Size (MB)' FROM information_schema.tables GROUP BY table_schema;"

Restart Policies

All production containers use automatic restart policies:
restart: "unless-stopped"
This ensures:
  • Containers restart automatically after crashes
  • Containers remain stopped if manually stopped
  • Server survives host reboots

Graceful Shutdown

The Minecraft container implements graceful shutdown:
destroyGraceSeconds: 2 * 60  // 2 minutes
1

Save world data

Server receives SIGTERM and begins save-all
2

Disconnect players

Players are disconnected with shutdown message
3

Complete shutdown

Server has 2 minutes to complete shutdown sequence
4

Force kill

If timeout expires, container is force-killed

Performance Optimization

JVM Flags

Production servers use optimized JVM flags:
USE_MEOWICE_FLAGS: this.environment !== "local"
Meowice flags provide:
  • Optimized garbage collection
  • Better memory management
  • Improved server performance
These flags are disabled in local development to reduce resource usage.

Alerting and Notifications

Custom Plugin Monitoring

The OyasaiAdminTools plugin supports webhook notifications:
plugins/OyasaiAdminTools/config.yml
webhook-url: ""
Configure a Discord or Slack webhook URL to receive:
  • Server startup/shutdown notifications
  • Error alerts
  • Player events
  • Custom admin notifications

Monitoring Best Practices

Regular Health Checks

Monitor container health status daily to catch issues early

Log Rotation

Enable rolling logs to prevent disk space exhaustion

Resource Limits

Set appropriate memory limits based on player count and plugins

Backup Verification

Regularly verify backup integrity and restoration procedures

Troubleshooting

Check container logs for errors:
docker logs minecraft-main --tail 100
Verify health check passes:
docker exec minecraft-main mc-health
Check available memory:
docker stats minecraft-main
Reduce allocated memory or adjust JVM flags:
# Check current allocation
docker inspect minecraft-main | jq '.[0].Config.Env' | grep MEMORY

# Monitor JVM heap usage via RCON
mcrcon -H localhost -P 25575 -p <PASSWORD> "memory"
Verify ports are exposed:
docker port minecraft-main
netstat -tuln | grep 25565
Check firewall rules:
sudo ufw status
Test connectivity:
telnet localhost 25565

Next Steps

Backups

Configure automated backup strategies

Server Configuration

Optimize server performance settings

Build docs developers (and LLMs) love