# Host a Minecraft server

Your Minecraft server online with your PC off: your AI agent sets it up on Estiba. It sleeps when nobody plays and pays for the memory it uses.

## Put it online

1. [Sign up](https://app.estiba.cloud) and [connect your agent](https://estiba.cloud/docs/connect-your-agent) to Estiba, once.
2. Ask it, in the folder of your server if you already have one: "put this Minecraft server online on Estiba".
3. Your agent creates the server from the `itzg/minecraft-server` image (with the Minecraft version pinned and the Java it needs: tag `java25` for current versions, an older one for an old version or modpack), Paper, Vanilla, Fabric or Forge as you choose. Its `/data` folder goes in a volume, so the world, plugins and settings are kept. It gives port 25565 a public port for players and sets the memory as below.
4. [Add credit](https://estiba.cloud/docs/credit-and-prices), from $5. The server starts once there is credit.

Your agent reads the logs after each change and fixes what fails. To change something later, ask it again.

## How players join

Estiba gives the server a port of its own and shows the address, such as `ports.estiba.cloud:21450`. Players add it in **Multiplayer → Add Server**.

## When nobody plays, it sleeps

After 5 minutes with nobody connected, the server sleeps: it stops and pays only for its files. A player wakes it by joining: Minecraft may say it cannot connect, and the server starts. Once it is up, which takes as long as your world takes to load (about 30 seconds for a new one), they join again and get in. Opening the server list in Minecraft wakes it too.

Keep it always on when it has to be there without anyone playing: it is in a public server list, or plugins or schedules do things at set times (daily resets, rewards, restarts). Tell your agent and it sets the server to never sleep. If people play only at certain times, such as evenings and weekends, ask for those hours instead: it starts by itself when they open, schedules and plugins run while it is open, and it stops when they close.

## Pay for the memory it uses, not what it reserves

Java takes memory as it needs it and gives little back, and the usual settings (`-Xms` equal to `-Xmx`, with `AlwaysPreTouch`) make it take the maximum from the start. Estiba charges the memory a server holds, so those settings make you pay for the maximum all the time. Your agent sets three things instead:

- **A low start and a set maximum.** `-Xms1G` and `-Xmx` at the most it may need, never `-Xms` equal to `-Xmx`, and not the "Aikar flags", which pair the two with `AlwaysPreTouch`.
- **A collector that gives memory back.** `-XX:+UseZGC -XX:ZUncommitDelay=60` returns heap Java has not used for a minute. On Java 21, add `-XX:+ZGenerational` for the newer ZGC; on Java 25 it is the only one.
- **A target.** `-XX:SoftMaxHeapSize` keeps Java around that size and lets it grow to the maximum only for peaks. Start at about twice the heap still in use after Java cleans up, as `-Xlog:gc` shows, and check it while people play. Too low and Java spends its time cleaning, with lag and more CPU; too high and it holds memory it does not need.

With `itzg/minecraft-server` these go in `INIT_MEMORY`, `MAX_MEMORY` and `JVM_XX_OPTS` (not `MEMORY`, which sets both to the same).

## The world is saved when it stops

When the server sleeps, moves or updates, it gets a signal to stop and the seconds of its `grace` to save the world. Your agent sets `grace` to 120: the 10 seconds by default can cut a big world in the middle of saving.

## With Crafty Controller

Crafty runs several Minecraft servers in one app. On Estiba the whole app sleeps and wakes at once, so one player on any server keeps them all awake, and waking starts every one set to start by itself. Your agent gives each Minecraft server its own Crafty:

- **Auto start on**, with a delay of 0, in the server's settings: waking starts Crafty, and Crafty must start the server.
- **The execution command** with the memory settings above.
- **Crafty's panel on your domain**, such as `crafty.example.com`, marked HTTPS, since the panel serves only HTTPS (see [Domains](https://estiba.cloud/docs/domains)). An open panel keeps the server awake.
- **`grace` at 120.** When it is stopped, Crafty stops its servers, which save the world, and waits for each up to its shutdown timeout, 60 seconds by default: for a big world, your agent raises it in Crafty and `grace` with it.

Crafty's schedules run only while it is awake: if you rely on them, keep it always on.

## Files for your team

You and your team can upload worlds and plugins with FileZilla, WinSCP or any SFTP program. Ask your agent for an SFTP user for each person, with the folder they may touch, such as only `plugins`, and whether they may upload and delete or only download. Each person gets their own login and password.

## What it costs

You pay for what the server uses, measured every second: $4 per GB of memory and $8 per vCPU busy, a month, and $0.10 per GB its files take, taxes included. Traffic is free.

For example, a new Paper server with a maximum of 6 GB, started empty on one of Estiba's servers, once with the usual settings (`-Xms6G -Xmx6G` and the Aikar flags) and once with the ones above (`-Xms1G -Xmx6G`, ZGC, a 2 GB target), each kept on all month (memory only):

| Settings | Memory | A month |
| --- | --- | --- |
| Usual | 6.6 GB | 6.6 × $4 = **$26** |
| Above | 2.3 GB | 2.3 × $4 = **$9** |

Players add memory and CPU while they play. If it sleeps when nobody plays, it pays only for its files while asleep: played 4 hours a day with the settings above, its memory comes to about $1.50 a month, plus what players add, a little CPU and its files: a new world takes 0.25 GB, $0.03. The dashboard shows what yours really uses and costs each day.

Credit is prepaid, from $5 with PayPal. No bill arrives; if the credit runs out, the server stops until you add more. See [Credit and prices](https://estiba.cloud/docs/credit-and-prices).

## If a server goes down

Your Minecraft server keeps its files in a volume, so if the machine it runs on goes down, it waits for it to come back instead of starting somewhere else without them. When it moves to another machine, its files go with it; the move restarts it for a moment, and players join again.
