The goal

Set up a Minecraft server to play with friends that is:

  • Economical: auto-pause when no players are online to save resources
  • Modded: performance and quality-of-life mods
  • Monitored: metrics exported to Prometheus
  • Secure: whitelist, no unnecessary public access

Stack

Component Technology
Runtime Docker (itzg/minecraft-server)
Mod Loader Fabric 1.21.10
Mods Modrinth (auto-download)
Metrics Prometheus Exporter
OS Linux VPS

Docker Compose

The server is deployed with a single Docker image that manages everything:

services:
  server:
    image: itzg/minecraft-server:java25
    environment:
      TYPE: FABRIC
      VERSION: 1.21.10
      MEMORY: 6G
      ENABLE_AUTOPAUSE: true
      AUTOPAUSE_TIMEOUT_EST: 600
      MODRINTH_PROJECTS: |
        lithium
        krypton
        ferrite-core
        distanthorizons
        fallingtree
        universal-graves
        spark
        fabricexporter

Smart Auto-Pause

One of the best features: the server automatically pauses when no players have been connected for 10 minutes. This reduces CPU usage from ~100% to practically 0%.

ENABLE_AUTOPAUSE: true
AUTOPAUSE_TIMEOUT_INIT: 120    # Seconds after startup
AUTOPAUSE_TIMEOUT_EST: 600     # Seconds without players

When a player connects, the server resumes automatically in ~2 seconds.

Performance Mods

The server uses Fabric as mod loader with performance-focused mods:

Mod Purpose
Lithium Game logic optimization
Krypton Networking optimization
Ferrite Core RAM usage reduction
Chunky Chunk pre-generation
Spark Profiler for lag identification

Gameplay Mods

Mod Purpose
Distant Horizons LODs to see further
Falling Tree Chop whole trees
Universal Graves Don’t lose items on death
Ping Wheel On-screen ping for communication
Xaero’s World Map World map

Monitoring

The server exports metrics to Prometheus on port 9940:

  • Players online
  • TPS (ticks per second)
  • JVM memory usage
  • Loaded chunks

This integrates with Grafana for server performance dashboards.

Security

  • Whitelist: authorized players only
  • RCON: remote server management with password
  • Minimal ports: only 25565 (game) + 9940 (metrics)

Result

A Minecraft server that costs practically nothing when unused, starts automatically when someone connects, and has full monitoring to detect performance issues.