Docker Image
Overview
The Fusion Dedicated Server Docker Image Sample is a set of scripts and files showing how a Fusion Dedicated Server can be enveloped into a Docker Container
and executed in a Docker
environment.
The Docker
platform is a well known virtualization system build around the concept of containers, a group of "virtual machines" running a set of particular applications, properly setup and enclosed, being able to be created and destroyed at will, without the need worry about process isolation and which OS the host machine is using.
When dealing with the creation of Dedicated Servers
, the use of containers is one of the best solutions and most game server hosting providers accomplish their scalability precisely by the use of Docker
underneath.
Download
Version | Release Date | Download | ||
---|---|---|---|---|
1.0.1 | Apr 13, 2023 | Fusion Dedicated Server Docker Image 1.0.1 Build 177 |
File Description
README.md
: contain general information about how to build and use the sample.Dockerfile
: the container description, a configuration file used byDocker
when building theDocker Image
. TheFusion Game Server
will be executed from theLinux
Container by thefusion
user. More info aboutDockerfile
here.bin/entrypoint.sh
: script that will execute theFusion Game Server
and optionally parse the arguments passed to the container to the server binary.run_server.sh
: reference script of how to run the container with optional arguments.
How to Run
This sample should only be used as reference and may need some modifications to suit more complex scenarios.
It does not show how to orchestrate the Game Servers
, only how to run it using a Docker Container
.
Setup Docker
- Go to docker.com/get-started.
- Install and setup your Docker Service.
Preparing the Fusion Server for a Docker Image
- Based on the Fusion Dedicated Server sample.
- Build a the
Dedicated Server
:- Set
Linux
as theTarget Platform
andx86_64
asArchitecture
. - Check the
Server Build
flag. - Set the executable name to
server.x86_64
.
- Set
- Copy all the build files to the
bin
folder.
Create the Fusion Server Docker Image
- Open a terminal on the current folder.
- Make sure the
Docker
service is running in your system. - Run:
docker build -t <your_custom_image_name> .
- Example:
docker build -t fusion-dedicatedserver .
- Example:
- A new
Docker Image
with the namefusion-dedicatedserver
will be created on your local repository.
Run the Fusion Server as a Docker Container
- Open a terminal on the current folder.
- Make sure the
Docker
service is running in your system. - Run:
docker run -d -p <host_custom_port>:27015/udp <your_custom_image_name>
- Example:
docker run -d -p 27015:27015/udp fusion-dedicatedserver
- By default, the Fusion Dedicated Server will bind to port
27015
, and this port is already exposed by the Docker image (check theDockerfile
). Running the command above, that port will be mapped to the host27015
port as well. - Running a detached Container (
-d
argument) makes it run independently of the current terminal.
- Example:
Optional Start Arguments
The Fusion Server Docker Image is prepared to accept the same arguments as the standalone build accepts. However, they have different argument names, because how the entrypoint.sh
script read those.
Check the argument list below for more info:
-s <custom_session_name>
: Use a Custom Session ID Name. Default: Random GUID Session Name-r <custom_region>
: Connect the Server to a Custom Region. Default: Best Region-l <custom_lobby>
: Join a Custom Lobby. Default: Join the DefaultClientServer
Lobby.-i <custom_public_ip>
: Set a Custom Public IP of the Server. Default: Empty, the Server will use the STUN Service to discover its Public IP.-p <custom_public_port>
: Set a Custom Public Port of the Server. Default: Empty, the Server will use the STUN Service to discover its Public Port.
Check the run_server.sh
script for a more structured way of starting a new Fusion Server Container using the optional arguments. Example:
sh
docker run -d -p 27015:27015/udp fusion-dedicatedserver -s my_session -r eu -l my_lobby
Invoking this will start a Fusion Game Server
using the Session Name my_session
on Region eu
and the Session will be listed on Lobby my_lobby
.