GitHub Readme.md
This is a Heroku buildpack that allows you to host a lightweight minecraft server for a few friends using ngrok (for TCP proxy) and heroku (for the hosting and hardware)
Create a free ngrok account and copy your authentication token. Then create a new git project with an eula.txt
file:
echo 'eula=true' > eula.txt
git init
git add eula.txt
git commit -m "Initial commit"
Then, install the Heroku toolbelt. To create a Heroku app, set your ngrok token, and push
heroku create --buildpack https://github.com/lastuniverse/minecraft-buildpack
heroku config:set NGROK_API_TOKEN="xxxxxxxxxxxxxxx"
git push heroku master
Finally, open the app:
heroku open
This will open a page in your web browser with the connection address of your server.
0.tcp.ngrok.io:53313
Copy it, and paste it into your Minecraft game as the server adress.
The Heroku filesystem is ephemeral, which means files written to the file system will be destroyed when the server is restarted.
Minecraft keeps all of the data for the server in flat files on the file system. Thus, if you want to keep you world, you'll need to sync it to you SSH server.
heroku config:set SSH_HOST=your-ssh-hostname-or-IP-adress
heroku config:set SSH_PORT=your-ssh-port
heroku config:set SSH_USERNAME=your-username-on-ssh-host
heroku config:set SSH_PATH=full-path-for-save-in-your-ssh-host
then copy id_rsa.pub file to remote host and add this file to .ssh/authorized_keys:
heroku run bash
./scp.rsa.pub.sh
> Password: (type password for your ssh remote host)
./ssh.rsa.pub.sh
> Password: (type password for your ssh remote host)
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
exit
exit
The Heroku filesystem is ephemeral, which means files written to the file system will be destroyed when the server is restarted.
Minecraft keeps all of the data for the server in flat files on the file system. Thus, if you want to keep you world, you'll need to sync it to S3.
First, create an AWS account and an S3 bucket. Then configure the bucket and your AWS keys like this:
heroku config:set AWS_BUCKET=your-bucket-name
heroku config:set AWS_ACCESS_KEY=xxx
heroku config:set AWS_SECRET_KEY=xxx
The buildpack will sync your world to the bucket every 600 seconds, but this is configurable by setting the SYNC_INTERVAL
config var.
You can choose the Minecraft version by setting the MINECRAFT_VERSION
like so:
heroku config:set MINECRAFT_VERSION="1.8.3"
You can also configure the server properties by creating a server.properties
file in your project and adding it to git. The various options available are
described on the Minecraft wiki.
You can add files such as banned-players.json
, banned-ips.json
, ops.json
,
whitelist.json
to your git repository and the Minecraft server will pick them up.
You can customize ngrok by setting the NGROK_OPTS
config variable. For example:
heroku config:set NGROK_OPTS="-subdomain=my-subdomain"
Copy the snippet above into CLI.