
Deploy Minecraft | (Just Updated) Paper Server Whose Heap Fits Your Plan, Auto Backups
Paper server whose heap fits your plan, plus rotating world backups.
minecraft
Just deployed
/data
Deploy and Host a Minecraft Server on Railway
A Paper Minecraft server (Minecraft 26.2) on one service and one volume, reachable over a Railway TCP proxy. Paper is the high-performance Spigot/Bukkit-compatible server, so plugins work and the tick loop is faster than vanilla.
Two things a hosted Minecraft server actually has to do, which this template does and the alternatives do not: the JVM heap is sized to the plan you deployed on, and your world is backed up on a schedule.
About Hosting a Minecraft Server
A Minecraft server is a long-lived Java process whose memory ceiling is set at launch and cannot be
changed afterwards. That makes MAX_MEMORY the single most consequential setting on the deploy, and
it is the one that is usually wrong: a container reports the host's total memory, not its own
limit, so a fixed value baked into a template is either far larger than the container can supply —
in which case the JVM grows into it and the container is killed — or so small that the server stalls
on garbage collection.
This template reads the container's own cgroup memory limit at boot, reserves a share of it for the
JVM's off-heap footprint (metaspace, thread stacks, the operating system) and gives the rest to the
heap. Setting MAX_MEMORY yourself turns the sizing off, so tuning is still available.
The second problem is durability. A Minecraft world is a live-mutating set of region files; copying
them while the server is writing produces an archive that may not load. The backup here goes through
RCON — save-off, save-all flush, archive, save-on — so what lands in /data/backups is a
consistent snapshot, taken on a schedule and rotated.
Why Deploy a Minecraft Server on Railway?
Railway gives the server a stable address, a persistent volume and usage-based billing with no VM to maintain, no operating system to patch, and no port forwarding on a home router. A redeploy is a clean restart on the same world. Scaling the plan up scales the heap with it, because the heap is computed from the container rather than pinned in the template.
Common Use Cases
- A private survival or creative server for friends, always on and always at the same address.
- A Paper plugin server for a small community, with configuration and plugins on a volume.
- A modded-adjacent Paper setup where the world matters and losing it is not acceptable.
- A temporary event or build server that can be redeployed without losing progress.
Dependencies for the Minecraft Server
- The
itzg/minecraft-serverimage, pinned by digest and wrapped for Railway (bon5co/minecraft-railway).
Deployment Dependencies
- A Railway volume mounted at
/data(created by this template). - A TCP proxy on port 25565 (created by this template) — this is the address players connect to.
RCON_PASSWORD— generated automatically; the container will not start with an empty value.
Implementation Details
The server accepts the EULA, runs Paper, and enables Aikar's garbage-collection flags. Backups are
controlled by BACKUP_INTERVAL_HOURS (default 6, 0 disables) and BACKUP_KEEP (default 5), and
land in /data/backups. Every upstream itzg/minecraft-server variable still works — DIFFICULTY,
MAX_PLAYERS, MOTD, OPS, SEED, LEVEL_TYPE, WHITELIST and the rest — so the server is
configured from the Railway variables panel rather than by editing files over RCON. Online mode is
on, so accounts are verified against Mojang.
There is no HTTP healthcheck, because a Railway service with a TCP proxy has no HTTP port for one to
dial; the restart policy is ON_FAILURE.
Template Content
minecraft
ghcr.io/bon5co/minecraft-railway