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
dockeranddocker-composeinstalled on the server. You will likely also need root access to access docker.
Note: The Docker version of the server will not run on systems that use an ARM CPU (see issue 1799 on our gitlab for updates).
Tip: Check out the Docker Compose file reference for more information about the
docker-compose.ymlfile.
Setup
Note: The default
docker_compose.ymlwill automatically keep the game server updated to the latest weekly release.
- Create a folder for the server data and
cdinto it. - Download the sample
docker-compose.ymlfrom the repository into the folder.
wget https://gitlab.com/veloren/veloren/-/raw/master/server-cli/docker-compose.yml - If needed, open the following ports in your firewall:
14004(TCP/UDP, required): Gameserver14005(TCP, optional): HTTP metrics14006(UDP, optional): Query server protocol
- To create and start the containers, run
sudo docker-compose up -d.
If you modify thedocker-compose.ymlfile, 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-masterin 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
userdatafolder 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 psto 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
helpand 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 eitheradminormoderator.
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!