website logo
⌘K
What is Gameye?
Getting started
Getting ready to start
1. Set up your Docker Hub account
2: Set up your organization on Gameye
3. Sort and push your Docker file
4. Configure your ports
5. Start the API call
API
API endpoints
Regions and locations
Error handling
Guides
Integrations
Using Gameye
Working with Docker
Support
Getting support
Giving feedback
Troubleshooting
Troubleshooting problems
FAQs
How do I start using Gameye?
Do you require authorisation to use the API?
How does Gameye scale?
What is the difference between a location and a region?
Is Gameye free to use?
FAQs
Glossary
Docker
Container
Region
Image Registry
Bare metal
Flex metal
Cloud
Matchmaker
Changelogs
Docs powered by
Archbee
Getting started

4. Configure your ports

7min

When spinning up containers on a machine, our orchestrator has to decide upfront which networking modes it puts a container in. This affects how external clients (your players) will connect to the game server application running inside the container.

The Docker Engine has two built-in networking modes. As Gameye is a layer on top of the Docker Engine, our orchestrator can use them both and decide which is best according to your needs.

Using bridge networking

Learn more about bridge networking. For a more in-depth description of bridge networking, check Docker’s website.

Bridge networking lets multiple containers bind to any port without clogging up the networking stack of the host machine. For example, you have 10 different nginx containers and they should all bind to port 8080.

How does traffic flow to these nginx instances?

The bridge network opens up an ephemeral port and links it to port 8080 of a specific container. As Docker keeps track of these networks and containers, it can easily forward all traffic.

When we create a new container, our orchestrator automatically allocates an ephemeral port (between 32768 and 60299). As the orchestrator knows all the containers (and where they’re running), it searches for an available port in ascending order.

Once we’ve chosen the port, we add it as an environment variable (like GAMEYE_PORT_TCP_8080). The container then has access to the port. It can then bind or publish the port as metadata to matchmakers, clients or other services.

If you use bridge networking, your Dockerfile from step three will stay the same.

Using host networking

Learn more about host networking. For a more in-depth description of host networking, check Docker’s website.

Host networking is where you keep reusing the networking stack of the host machine. When a container needs to reserve a specific port (like 8080), it’ll block any other container from using that port. That means only one container on the whole machine uses port 8080.

That can obviously clog up the ports. So to prevent that, our orchestrator needs to allocate an ephemeral port to use instead (between 32768 and 60299). As the orchestrator knows all the containers (and where they’re running), it searches for an available port in ascending order.

Once we’ve chosen the port, we add it as an environment variable (like GAMEYE_PORT_TCP_8080). The container then has access to the port. It can then bind or publish the port as metadata to matchmakers, clients or other services.

If you want to use host networking, there are a few tweaks you need to make to your Dockerfile from step three and your ENTRYPOINT. You can use the following code blocks to help you make those changes.

Dockerfile
|
FROM ubuntu:20.04

# copy server files here
# for example:
COPY . /home/MyGame/

# add user to run the container
RUN useradd -m gameuser

# set permissions
RUN chmod 777 /home/MyGame/GameServer.sh

USER gameuser

# set your game binary as the entrypoint
ENTRYPOINT ["/home/MyGame/GameServer.sh", "-log"]

Shell
|
#!/bin/bash
./GameServer.x86_64 -batchmode -nographics -start -name "Gameye Server" -overrideEditorArgs -sessionName $GAMEYE_SESSION_ID -port $GAMEYE_PORT_UDP_7777 log.txt -timeout 30 "$@"

# Store server execution Exit Code
status=$? 

if test $status -eq 0
then
    echo "Server exited normally"
else
    echo "Server exited with code: $status"
fi

echo "Done"




Updated 22 Jun 2023
Did this page help you?
PREVIOUS
3. Sort and push your Docker file
NEXT
5. Start the API call
Docs powered by
Archbee
TABLE OF CONTENTS
Using bridge networking
Using host networking
Docs powered by
Archbee