ackvf / terraria

Terraria dedicated server running in Docker
https://hub.docker.com/r/ackvf/terraria
MIT License
3 stars 0 forks source link
dedicated-server terraria

Motivation

Having used other Dockerized dedicated Terraria servers, it was always immensely painful having to reinstall images and recreate containers from scratch whenever new Terraria version was released - and now multiply the pain by number of running instances...
I was certain that it should be possible to make this flow easier.
This here is my attempt at that.

No longer it is necessary to fetch an updated docker image for every new terraria server version - this image is a mere shell for the underlying bash scripts which do all the magic.
Everything is controlled by environment variables.
Clean and simple.

Credits

This project was created by modifying:

Getting started

👉 Configuring the server

note: Whenever you restart the server container, it downloads new zip from terraria website.

FYI, these are the necessary environment variables:

DOWNLOAD_VERSION=1446-fixed
FILENAME_CONFIG=serverconfig.txt
FILENAME_WORLD=world.wld
FILENAME_BANLIST=banlist.txt

👉 Updating Terraria server version

Development

Development

See package.json for available tasks.

During script development, it is useful to use set -euxo pipefail. Read more here.

Dockerfile

The flow is: source -> docker build -> image -> docker run -> container

  1. Build an image locally npm run build
  2. Start a container npm start

CLI docker run

CLI docker build

Useful commands

Start container with "Choose world" interactive prompt.

docker run --rm --name terraria -it --entrypoint bash -i -e FILENAME_WORLD= -p 7777:7777 ackvf/terraria

Publishing

  1. Make sure to be logged in
    docker login
  2. Push
    npm run push