This blog post will show how to easily deploy a Terraria server using Docker. The deployed server will be based on Tshock and use the @ryannsheehan Docker image.
Recommanded setup:
at least 1 CPU @ 2.0Ghz
at least 500 MB of RAM
about 25MB on the disk per world
Create a docker-compose.yml
file with:
---
version: '2'
services:
terraria:
image: ryshe/terraria:latest
container_name: "terraria-server"
ports:
- 7777:7777
volumes:
- /path/to/your/data/terraria/world:/world
tty: true
stdin_open: true
With docker-compose up -d
you will create a container named terraria-server
that would be accessed from any network interfaces on TCP port 7777
. Moreover, your data will be saved on your host, in your /path/to/your/data/terraria/world
folder.
Once the server is started you will need to manually select/create a world. To attach your shell to the stdin of the container, use docker attach --sig-proxy=false terraria-server
. You will then be able to:
select/create a new map and start the server
select the maximum number of players
select the server port: keep 7777
automatically forward port: enter n
set a password to access your server
An example:
[Server API] Info Plugin TShock v4.3.26.0 (by The TShock Team) initiated.
Terraria Server v1.3.5.3
1 myawesomeworld
n New World
d <number>Delete World
Choose World: 1
Max players (press enter for 8): 8
Server port (press enter for 7777):
Automatically forward port? (y/n): n
Server password (press enter for none): passwordlol
Use CTRL + c
to quit the container stdin (this will not stop the container).
If you to stop/restart the server for some reasons, feel free to use docker-compose {stop,restart}
for that: you will not lose your data.
Dont let anybody come and break everything, this is not that fun.
By default you will not be able to spawn bosses or teleport to your friends. These are some commands that will unlock those features:
/group addperm guest tshock.ignore.*
/group addperm guest tshock.tp.rod
/group addperm guest tshock.world.editspawn
/group addperm guest tshock.npc.summonboss
/group addperm guest tshock.world.movenpc
/group addperm guest tshock.npc.hurttown
/group addperm guest tshock.npc.startdd2
/group addperm guest tshock.npc.startinvasion
/group addperm default tshock.ignore.*
/group addperm default tshock.tp.rod
/group addperm default tshock.world.editspawn
/group addperm default tshock.npc.summonboss
/group addperm default tshock.world.movenpc
/group addperm default tshock.npc.hurttown
/group addperm default tshock.npc.startdd2
/group addperm default tshock.npc.startinvasion
/group addperm admin tshock.ignore.*
/group addperm admin tshock.tp.rod
/group addperm admin tshock.world.editspawn
/group addperm admin tshock.npc.summonboss
/group addperm admin tshock.world.movenpc
/group addperm admin tshock.npc.hurttown
/group addperm admin tshock.npc.startdd2
/group addperm admin tshock.npc.startinvasion
Feel free to check the official Tshock documentation to learn more about this.
This is the more important.