↓ Skip to Main Content

AMP Server Routing Using Traefik

·· loading · loading · ·

Prerequisite Installations
#

1. Create a DHCP Reservation
#

After installing AMP, assign the server a static IP address via DHCP reservation (preferred).

  • This ensures Traefik routing stays consistent when load-balancing to AMP or game servers.

2. Edit Traefik Dynamic Configuration
#

Create an entry in the config.yml dynamic configuration file using the hostname of your choice.

  • By default, AMP routes its management interface through port 8080.
  • A Traefik dynamic configuration can be added to resolve the IP address with a hostname.

Inside the http > routers block, add:

# routers
http:
  routers:
    amp-server-internal:
      entryPoints:
        - "https"
      rule: "Host(`play.lab.shannonwetnight.com`)"
      middlewares:
      - default-chain
      tls: {}
      service: amp-server
# end routers

Inside the http > services block, add:

http:
  # services
  services:
    amp-server:
      loadBalancer:
        servers:
          - url: "http://AMP_IP:8080"
        passHostHeader: true
  # end services

Add a UDP block to the top or bottom of the config.yml dynamic configuration file (outside of the http block):

  • Note: the services block is inside of the UDP block. This is not created inside of the http services block!
# Custom entry point settings for AMP server
# Add entry points when new game servers are created to preserve play.lab.shannonwetnight.com routing
udp:
  routers:
    minecraft-bedrock:
      entryPoints:
        - "minecraft-udp"
      service: minecraft-bedrock

  services:
    minecraft-bedrock:
      loadBalancer:
          ervers:
          - address: "AMP_IP:19132"
# End custom entry point settings for AMP server

Save and exit.

3. Edit Traefik Static Configuration
#

Add a custom entryPoint to the traefik.yml static configuration file (inside of the entryPoint block):

# custom entry point for AMP server
minecraft-udp:
  address: ":19132/udp"

Save and exit.

4. Create DNS Record
#

Create a DNS record using the selected hostname. In my configuration, Pi-hole is my primary DNS.

  • Pi-hole uses docker.lab.shannonwetnight.com, which points to 172.16.11.129, the Docker LXC that serves Traefik.
  • CNAME records are added that point to docker.lab.shannonwetnight.com.

Flow is:

Client Request > Pi-hole > play.lab.shannonwetnight.com > docker.lab.shannonwetnight.com > 192.168.1.129 > Traefik
  • The DNS record will serve AMP and the game server ports via the same hostname after the entry points are added in Traefik.

5. Edit Traefik’s Docker Compose File
#

Expose the game server port in the Traefik docker-compose.yml configuration file. Add (port will vary depending on server being added):

ports:
  - 19132:19132/udp # Minecraft Bedrock Edition default port (allows Traefik to route through play.lab.shannonwetnight.com instead of IP address and port) | expose new ports as needed for new servers

Save and exit.

6. Redeploy Traefik
#

Redeploy Traefik’s Docker container. Repeat these steps for each server added.

Note: Traefik supports UDP and TCP. Repeat with TCP if necessary.

Reply by Email