Hosting a server using Docker
If you want to run a dedicated Veloren server 24/7 follow this.
Note: We assume general command line and docker-compose knowledge. You will need
docker
anddocker-compose
installed on the server. You will likely also need root access to access docker.
Tip: Check out the Docker Compose file reference for more information about the
docker-compose.yml
file.
Setup
Note: The default
docker_compose.yml
will automatically keep the game server updated to the latest weekly release.
- Create a folder for the server data and
cd
into it. - Download the sample
docker-compose.yml
from the repository into the folder.
wget https://gitlab.com/veloren/veloren/-/raw/master/server-cli/docker-compose.yml
- If needed, open port
14004
(14005
for metrics) in your firewall. - To create and start the containers, run
sudo docker-compose up -d
.
If you modify thedocker-compose.yml
file, you'll need to run that command again for it to take effect. - Add moderators/admins by following the instructions below
Note: If you used the provided docker-compose file, you can use
veloren-game-server-master
in place of<CONTAINER_ID>
in the following instructions.
Monitoring and maintenance
- To restart the server, run
docker-compose restart
. - To view logs, run
docker logs <CONTAINER_ID>
. - To access the server's configuration files, open the
userdata
folder automatically created next todocker-compose.yml
.
Running commands inside the docker container
The game server has a CLI interface that can be used to run commands for tasks such as adding admins and moderators. The steps for accessing this interface while the server is running inside Docker are outlined below:
- Run
docker attach <CONTAINER_ID>
(rundocker ps
to find the ID of the game server container, then if the ID is for examplee002d350ab26
, rundocker attach e002d350ab26
). - You can now run server CLI commands. To see the available options type
help
and press enter. - Once you are done, to escape press Ctrl+p followed by Ctrl+q.
Tip: To add an admin or mod, use
admin add <USER> <ROLE>
.<ROLE>
can be eitheradmin
ormoderator
.
Tip: To gracefully shutdown the server for maintenance with 2 minute countdown, use:
shutdown graceful --reason "Shutting down for maintenance :)" 120
Note: Logging output from the server can break up the visualization of command input but this can be ignored and broken up commands will still work.
You are done!