Skip to main content

All-in-one with Traefik

This variant is recommended if you want to host on a small machine with a low amount of players and want to host your MU Online website on the same machine. Traefik acts as reverse proxy, so multiple websites can share ports 80 and 443.

All kinds of OpenMU subsystems (connect server, game server, login server, admin panel, …) still run in one process, but the admin panel and other websites can be routed separately.

How routing works​

You tell Traefik how to handle incoming requests by adding labels to a container:

services:
admin-panel:
# ...
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.adm.entrypoints=websecure"
- "traefik.http.routers.adm.rule=Host(`admin.domain.com`)"

muonline-website:
# ...
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.muonline.entrypoints=websecure"
- "traefik.http.routers.muonline.rule=Host(`muonline.domain.com`)"

You can even add multiple domains and/or subdomains to one host label:

- "traefik.http.routers.muonline.rule=Host(`www.domain1.com`,`domain1.com`,`sub.domain1.com`)"

Deployment with docker compose​

Install git​

See the git install guide.

Clone the repository​

git clone https://github.com/MUnique/OpenMU.git
cd OpenMU/deploy/all-in-one-traefik

Create a docker network​

The containers of different docker compose files need to communicate with each other:

docker network create proxy
Use OpenMU 0.9.12 or newer

The deployment files on master rely on the built-in login of the admin panel, which the docker images up to version 0.9.10 don't have yet. These older images expected the basic authentication of Traefik with an .htpasswd file, which isn't part of these files anymore — combined with them, the admin panel is reachable by anybody, without a login.

If you pulled munique/openmu before, get the current image first:

docker compose pull

To keep running an older image, check out the matching git tag instead (e.g. git checkout v0.9.10), so that the deployment files and the image fit together.

Option A — for local testing​

docker compose -f docker-compose.yml up -d

It's then available on your local computer through a loopback IP. The admin panel URL is http://admin.docker.localhost. You can change it in the docker-compose.yml file.

Option B — with HTTPS​

If you want to share your server with the world, set up HTTPS — Traefik can handle it for you. Otherwise, traffic from and to the admin panel is not encrypted.

Copy .env.example to .env and edit it with the domain/subdomain of your admin panel URL:

cp .env.example .env

Copy data-traefik/acme.example.json to data-traefik/acme.json and give it permission 600:

cp data-traefik/acme.example.json data-traefik/acme.json
chmod 600 data-traefik/acme.json

Then run it:

docker compose -f docker-compose.prod.yml up -d

Optional: monitoring with Grafana​

Like the all-in-one deployment with nginx, this variant comes with an optional observability backend in docker-compose.monitoring.yml. OpenMU then exports its logs, metrics and traces with OpenTelemetry, and Grafana is available under /grafana/ of the admin panel host, with the login of the admin panel — see Logs and monitoring.

Add it as another file to the commands above:

docker compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d

or, with HTTPS:

docker compose -f docker-compose.prod.yml -f docker-compose.monitoring.yml up -d

With HTTPS, also set the environment variable GRAFANA_ROOT_URL to the public address of Grafana, e.g. https://admin.domain.com/grafana/.

Traefik asks the admin panel for every request to Grafana with a forwardAuth middleware (/auth/proxy?loginRedirect=true). The admin panel answers with the user and its Grafana role, or sends a browser without a login to its login page.

Admin panel users​

The admin panel authenticates its users itself, so there is no basic authentication middleware in Traefik anymore — and no restart after a user changed. Users are managed on the Users page; the login and the optional second factor are described under Signing in.

What's next​

The server is automatically started and initialized for Season 6.

Go to the admin panel — locally that is http://admin.docker.localhost/. Until the first admin panel user exists, it is reachable without a login; create one before the server is reachable from the internet, or configure a bootstrap user beforehand (see Signing in).

If you want to run another game version, use the Setup page.