Minecrab: Minecraft server hosting - Painless, personalized, and cheap

December 19, 2013 - by Nate Fitch

minecrab-banner

At a recent Joyent hackathon, I threw out the idea to "nail the Minecraft experience" on Joyent's public cloud. What did that mean? Single command Minecraft server administration with automatic backup and fancy maps! This isn't the first time I've pulled out this type of goofy shenanigans. For example, my high school required the completion of a "senior project" to graduate. While some of my fellow students chose to do their projects on more useful and noble things, I did mine on juggling. Ok, technically the term is "object manipulation" because my project involved more than just throwing balls in the air, but I digress. Same thing with Joyent and Minecrab. While others threw out ideas like mdb support for Go, I suggested what became Minecrab.

Despite my obvious attempt to subvert the hack fest for my own selfish reasons, my colleagues Philip Borenstein, Filip Hajny and Drew Miller joined me for a couple fun-filled days of hacking together a set of tools that can:

  1. Launch new Minecraft worlds on Joyent's public cloud.
  2. Manage running Minecraft servers (whitelist friends, attach to the server console, etc.)
  3. Automatically backup Minecraft world data to Joyent's Manta when you shut down so that you can later pick up where you left off.
  4. Generate a Google-maps style overview (using The Minecraft Overviewer) on Manta Compute so that your server resources are left to the Minecraft game.

logo2The result is on GitHub at joyent/minecrab, which is entirely open source. Contributions to the code are welcome and encouraged!

So how do you use it? First, a disclaimer that the command line tools have only been tested from Mac OS X and Ubuntu, though we'll gladly accept patches for other *nix variants. If you already have the CLI tools from Joyent installed, you're already most of the way there. Otherwise, the easiest way is to follow our Minecrab README that points to links on installing the necessary software (node, npm, manta tools, sdc tools, the jsontool and Minecrab), generating an SSH key, signing up for a Joyent account, and setting up environment variables.

The tedious part over with, now you can test if things are working by attempting to list your minecrab servers:

$ minecrab-list
No servers found running or backed up.
Launch a new server using the minecrab-launch command!

Then launch a server with a name:

$ minecrab-launch frist
Launching frist....................... Done!
Server frist running on 165.225.149.134 id: 067494d4-987b-477f-c086-9d9187a52808
Setting up...
[some stuff redacted]
Connect to server at 165.225.149.134!

Status Website: https://us-east.manta.joyent.com/Joyent_Dev/public/minecrab/index.html

There are a few things this did:

  1. Launch a server on Joyent's cloud.
  2. Installed a fresh copy of the Minecrab software on #1.
  3. Installed the latest Minecraft server software on #1.
  4. Uploaded a personalized website to Manta to show the status of all your minecrab servers. This page is available even when your world is offline and has links to your generated maps (once they are generated).

The status page is meant to be the place where you can point people to discover what server to join and get the lay of the land (if you've generated a map from your world). Or pull up the map to show off your world to family and friends!

Back to the command line, you can also get status there:

$ minecrab-list
IP              STATE      NAME
165.225.149.134 running    frist

When you try to connect with your Minecraft client, you'll probably get a message stating "You are not white-listed on this server!", so go ahead and whitelist yourself:

$ ./bin/minecrab-add-friend frist [your minecraft name]
Finding server...
Done!

You can see who you have whitelisted at any time (whether your minecrab world is running or not) with the minecrab-list-friends [server name] command. So, if you want your friends to come play, simply add them with the add-friends command, just like you did for your own name.

Now when you're done playing, shut down your server:

$ minecrab-shutdown frist
Finding server... Found frist (165.225.149.134)!
Are you sure you want to shut down frist? y
Saving the world...
[some stuff redacted]
Done!

That did a couple things too:

  1. Backed up your world data to Manta.
  2. Kicked off a Manta Compute job to render a map for your world.
  3. Disabled the Minecraft server and shut down the virtual server.

Now when you list you'll see that your world is offline (note that I launched a second world while your attention was elsewhere):

$ minecrab-list
IP              STATE      NAME
165.225.149.137 running    sceond
n/a             offline    frist

Finally, when you're ready to play that world again, just launch it by name, like you did originally. Instead of generating a new world it will download the world data that was backed up to Manta and restarts where you left off:

$ minecrab-launch frist

Now that you've had an overview, here are some other helpful commands:

  1. minecrab-get: Get details about the Minecrab server (ip address, hardware configuration, Joyent cloud identifiers, map location, etc).
  2. minecrab-copy: Make a copy of your minecraft world.
  3. minecrab-annihilate: Remove all traces of your Minecraft world (has to be shut down for this to work).
  4. minecrab-console: If you're familiar with the Minecraft server console, this attaches and allows you to interactively issue commands.
  5. minecrab-map: Manually kick off a map job.
  6. minecrab-backup: Manually kick off a world backup.

Naturally with hack fest code there are some things that aren't so great yet. First, the map renders on Manta take a while- about 5 minutes for a new world, and hours for large worlds. We're looking into how to reduce that time, either by parallelizing the render (it is Manta, after all!) or by only regenerating what has changed. Secondly, there's no easy way (yet) to migrate a world onto Minecrab, though it should be fairly straight-forward for those that already administer servers. I migrated two of my single player worlds as proof it can be done and there should be a doc on how I did it soon. You can see all the issues on the minecrab github issues page.

So...did we nail the Minecraft experience on Joyent? If the target audience is the set of people who are comfortable generating SSH keys and use a CLI, then sure! But that's not really the target audience. The eventual target is everyone else. We (Joyent) have some things in the works that will make this experience even better. In the meantime, happy crafting! Oh, and watch out for Herobrine!

<Cue creepy music... and... cut!>

Sign up Now For
Instant Cloud Access

Get Started