-
Notifications
You must be signed in to change notification settings - Fork 7
Installation using docker hub
Since version 2.17.9, a Docker image has been published on DockerHub, making it readily available for direct use on your system.
It is necessary to specify certain configuration details required for the tool to function correctly.
For instance, create an application.properties file with the following content:
server.port=8080
server.schema=https
server.domain=<<machine-domain>>
spring.kendo.datasource.platform=mysql
spring.usermanager.datasource.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.usermanager.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.kendo.datasource.jdbc-url=jdbc:mysql://<<container-server>>:3306/kendotournament?useSSL=false&autoReconnect=true
spring.kendo.datasource.username=<<database-user>>
spring.kendo.datasource.password=<<database-password>>
database.encryption.key=<<key>>
jwt.secret=<<a-secret>>
This example assumes a connection to a MySQL server. If you are using a different setup, please consult the relevant section Using a different database engine and section Adding a database from docker
Additionally, you may include optional properties such as:
enable.guest.user=false
enable.participant.access=false
Subsequently, create the container using the official Docker image:
docker run \
--name kendo-tournament-backend \
--restart=always \
-p "8080" \
-v "./application.properties:/opt/kendo-tournament-backend/application.properties" \
-v "/dev/urandom:/dev/random" \
--network=containers \
-e "EXTERNAL_CONFIG_FILE=/opt/kendo-tournament-backend/application.properties" \
-l "traefik.enable=true" \
-l "traefik.backend=kendo-tournament-backend" \
-l "traefik.http.routers.kendo-tournament-backend.entrypoints=https" \
-l "traefik.http.routers.kendo-tournament-backend.tls.certresolver=https" \
-l "traefik.http.routers.kendo-tournament-backend.rule=Host\(\`<<machine-domain>>\`\) && PathPrefix\(\`/kendo-tournament-backend\`\)" \
-l "traefik.http.routers.kendo-tournament-backend-api.rule=Host\(\`<<machine-domain>>\`\) && \(PathPrefix\(\`/kendo-tournament-backend/swagger{any:.*}\`\) || PathPrefix\(\`/kendo-tournament-backend/v3/api-{any:.*}\`\)\)" \
-l "traefik.http.routers.kendo-tournament-backend-api.entrypoints=https" \
-l "traefik.http.routers.kendo-tournament-backend-api.tls.certresolver=https" \
-l "traefik.docker.network=containers" \
-l "traefik.http.services.kendo-tournament-backend.loadbalancer.server.port=8080" \
-d \
softwaremagico/kendo-tournament-manager-backend
Ensure that you replace <<machine-domain>> with your actual domain name. Additionally, create the containers network if it has not been established yet.
The environment variable EXTERNAL_CONFIG_FILE directs Spring to locate an alternative application.properties file;
therefore, it must correspond to the volume you have just created.
This configuration will ensure that your properties override the default settings.
The backend server requires a database to store its data. You can use various database engines by running their official Docker images. This example demonstrates how to use MySQL.
docker run \
--name kendo-tournament-database \
--restart=always \
--network=containers \
-v "kendo-tournament-database:/var/lib/mysql" \
-e "MYSQL_ROOT_PASSWORD=<<database-password>>" \
-e "MYSQL_DATABASE=kendotournament" \
-e "MYSQL_USER=<<database-user>>" \
-e "MYSQL_PASSWORD=<<database-password>>" \
-d mysql:8.4.6
The backend image currently includes clients for PostgreSQL and MySQL. For other database engines, you will need to add the appropriate Maven dependencies.
On the frontend side, basic configuration is required to establish a connection with the backend server. Create a config.js file as follows:
__config = {
backendUrl: '"https://<<machine-domain>>/kendo-tournament-backend',
websocketsUrl: 'https://<<machine-domain>>/kendo-tournament-backend/websockets',
achievementsEnabled: true,
checkForNewVersion: false,
}
When creating the frontend container, mount this file as a volume in the following manner:
docker run \
--name kendo-tournament-frontend \
--restart=always \
-v "./config.js:/www/config/config.js" \
--network=containers \
--rm softwaremagico/kendo-tournament-manager-frontend \
-e "NODE_PATH=/usr/local/lib/node_modules/" \
-l "traefik.enable=true" \
-l "traefik.backend=kendo-tournament-frontend" \
-l "traefik.http.routers.kendo-tournament-frontend.entrypoints=https" \
-l "traefik.http.routers.kendo-tournament-frontend.tls.certresolver=https" \
-l "traefik.http.routers.kendo-tournament-frontend.rule=Host\(\`<<machine-domain>>\`\) && PathPrefix\(\`/\`\)" \
-l "traefik.docker.network=containers" \
-l "traefik.http.services.kendo-tournament-frontend.loadbalancer.server.port=4200" \
-d \
softwaremagico/kendo-tournament-manager-frontend
Remember to update <<machine-domain>> with a valid domain value.
To utilize the reverse proxy necessary for operating this tool as a public web server, create a traefik.yml file with content similar to the example below:
api:
dashboard: true
debug: true
log:
level: DEBUG
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
permanent: true
https:
address: ":443"
providers:
file:
directory: /config/
watch: true
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
certificatesResolvers:
https:
acme:
email: "<<YOUR EMAIL HERE>>"
storage: /letsencrypt/acme.json
httpChallenge:
entryPoint: http
Please remember to replace the placeholder string <<YOUR EMAIL HERE>> with a valid email address, as it is required for obtaining the SSL certificate.
Finally, you may deploy the container including this file by mounting it as a volume that replaces the original configuration:
docker run \
--name kendo-tournament-rproxy \
--restart=always \
-p "80:80" \
-p "443:443" \
-v "ssl-certificates:/letsencrypt" \
-v "logs:/var/log" \
-v "./traefik.yml:/traefik.yml:ro" \
-v "/var/run/docker.sock:/var/run/docker.sock:ro" \
--network=external \
--network=containers \
-l "traefik.enable=true" \
-l "traefik.http.routers.dashboard.rule=Host\(\`<<machine-domain>>\`\) && \(PathPrefix\(\`/api/\`\) || PathPrefix\(\`/dashboard/\`\)\) " \
-l "traefik.http.routers.dashboard.service=api@internal" \
-l "traefik.http.routers.dashboard.entrypoints=https" \
-l "traefik.http.routers.dashboard.tls.certresolver=https" \
-d \
softwaremagico/kendo-tournament-manager-rproxy \
--providers.docker=true \
--providers.docker.exposedbydefault=false \
--providers.docker.network=external
Remember to update <<machine-domain>> with your existing domain. Also, ensure that both the external and containers networks exist; create them if necessary.
Alternatively, you may use docker-compose.
Examples are available at this repository.
Note: The previously provided examples assume that you possess a custom domain and that the server will be publicly accessible. If this is not the case, please refer to the section titled "Using a custom domain."