You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include an example which sets up a Traefik reverse proxy in Docker,
including ACME for automated https certificate management. The
deprecated and legacy `--link` flag of run commands is replaced with
Docker networks in all run commands.
Copy file name to clipboardExpand all lines: docker/README.md
+56-4Lines changed: 56 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,43 @@ These containers do not include MySQL / MariaDB; the [MariaDB](https://hub.docke
33
33
34
34
These images are available on the [Docker Hub](https://hub.docker.com) as `domjudge/domserver` and `domjudge/judgehost`.
35
35
36
+
### DOMjudge network
37
+
For isolation, create a Docker network which will be used for the communication between DOMjudge-related containers.
38
+
```bash
39
+
docker network create dj
40
+
```
41
+
42
+
### Traefik container (Optional)
43
+
An easy way to get trusted certificates using ACME is running the Traefik reverse proxy in front of the DOMjudge stack. Create a Docker network which allows communication across compose stacks using:
44
+
45
+
```bash
46
+
docker network create proxy_network
47
+
```
48
+
49
+
Now, you can deploy a Traefik reverse proxy. An example test deployment with **insecure** API access on port `8080` can be created using:
This will start a Traefik container listening for http traffic on port `80`, https traffic on port `443`, and listening for Traefik dashboard traffic at port `8080`.
64
+
Traefik automatically listens to the Docker socket for running containers with labels defining reverse proxy routes.
65
+
It also defines an ACME resolver named `myresolver` which creates a Let's Encrypt ACME account using email address `[email protected]` used to create the TLS certificates for https traffic.
66
+
36
67
### MariaDB container
37
68
38
69
Before starting the containers, make sure you have a MySQL / MariaDB database somewhere. The easiest way to get one up and running is to use the [MariaDB](https://hub.docker.com/r/_/mariadb/) Docker container:
docker run -it --name dj-mariadb --net dj -e MYSQL_ROOT_PASSWORD=rootpw -e MYSQL_USER=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_DATABASE=domjudge -p 13306:3306 mariadb --max-connections=1000
42
73
```
43
74
44
75
This will start a MariaDB container, set the root password to `rootpw`, create a MySQL user named `domjudge` with password `djpw` and create an empty database named `domjudge`. It will also expose the server on port `13306` on your local machine, so you can use your favorite MySQL GUI to connect to it. If you want to save the MySQL data after removing the container, please read the [MariaDB](https://hub.docker.com/r/_/mariadb/) Docker Hub page for more information.
@@ -47,10 +78,10 @@ This will start a MariaDB container, set the root password to `rootpw`, create a
47
78
48
79
Next, if you are on Linux make sure you have cgroups enabled. See the [DOMjudge documentation about setting up a judgehost](https://www.domjudge.org/docs/manual/master/install-judgehost.html#linux-control-groups) for information about how to do this. Docker on Windows and macOS actually use a small Linux VM which already has these options set.
49
80
50
-
Now you can run the domserver using the following command:
81
+
Without the optional Traefik reverse proxy, you can run the domserver using the following command:
docker run -it --name domserver --net dj -e MYSQL_HOST=dj-mariadb -e MYSQL_USER=domjudge -e MYSQL_DATABASE=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_ROOT_PASSWORD=rootpw -p 12345:80 domjudge/domserver:latest
54
85
```
55
86
56
87
If you want a specific DOMjudge version instead of the latest, replace `latest` with the DOMjudge version (e.g. `5.3.0`).
@@ -70,6 +101,26 @@ If you lose access to the admin user, see the [DOMjudge documentation on resetti
70
101
71
102
Make a note of the password for the `judgehost` user, it will be used when the judgehost container is configured. The password can be changed from the web interface by editing the `judgehost` user.
72
103
104
+
For a deployment using the Traefik container with ACME on domain `domjudge.example.com`, run domserver using the following command:
With DNS configured, you can now access the web interface on [http://domjudge.example.com/](http://domjudge.example.com/) or [https://domjudge.example.com/](https://domjudge.example.com/) and log in as admin.
123
+
73
124
#### Environment variables
74
125
75
126
The following environment variables are supported by the `domserver` container:
@@ -130,13 +181,14 @@ where `[service]` is one of `nginx` or `php`.
130
181
131
182
#### Docker-compose
132
183
See https://github.com/DOMjudge/domjudge-packaging/blob/main/docker/docker-compose.yml for a docker-compose example which automates the steps above.
184
+
When using the optional Traefik reverse proxy, deploy the stack defined in https://github.com/DOMjudge/domjudge-packaging/blob/main/docker/docker-compose-traefik.yml first and uncomment the relevant lines in the `docker-compose.yml` file.
133
185
134
186
### Judgehost container
135
187
136
188
To run a single judgehost, run the following command:
0 commit comments