Install with docker
Install Tanktrace with docker
We host tanktrace in docker, even though go programs are not that invasive.
Prerequisites
Install docker and docker-compose:
You also need to get an API key from Wargaming to access their API. Create an application here: https://developers.wargaming.net/applications/
Download and run the software
- Copy and edit the
docker-compose.yml
below. (The most current version can be found in the tanktrace repository.) - Put it into a directory that has enough space for the ever growing database, possibly on a SSD.
- Change at least the following:
- Put your API key you created before into
TANKTRACE_APPLICATIONID
- change
SECURE_PASSWORD
into something well secure (even though it’s not accessible from the outside) - put your clan into
TANKTRACE_OBSERVEDCLANS
. If you don’t want to get data from a full clan, add the account names into TANKTRACE_OBSERVEDNAMES, separated by spaces. - Change
tanktrace.example.com
into your hostname. - replace
tanktrace@example.com
with your email address to enable traefik (the webserver) to create SSL certificates.
- Put your API key you created before into
- run
docker-compose up -d
to start everything. After a couple of moments, you should be able to access the site from your provided domain name. Sometimes it takes a minute for the SSL certificate to load and if you are in a big clan, it’ll take some time to fetch all the data.
version: '3.4'
services:
tanktrace:
image: registry.tanktrace.de/tanktrace/tanktrace:latest
container_name: tanktrace
restart: unless-stopped
depends_on:
- db
- traefik
environment:
# CHANGE YOUR API KEY HERE
TANKTRACE_APPLICATIONID: "abcdefghijklmnopqrstuvwxyz1234567890"
# ADAPT TO WHATEVER YOU WANT TO NAME THE PAGE
TANTRACE_TITLE: "Tanktrace"
TANKTRACE_DB.USER: "root"
# CHANGE THE PASSWORD HERE
TANKTRACE_DB.PASS: "SECURE_PASSWORD"
TANKTRACE_DB.ADDR: "db:3306"
TANKTRACE_DB.NAME: "tanktrace"
# CHANGE THE HOSTNAME
TANKTRACE_WEBSITE.URL: "http://tanktrace.example.com"
# Put your clan(s) here or add space seperated single accounts to TANKTRACE_OBSERVEDNAMES
TANKTRACE_OBSERVEDCLANS: "T-17"
# TANKTRACE_OBSERVEDNAMES: "player1 player2 player3"
TANKTRACE_DAEMON: "true"
TANKTRACE_REPEATINTERVAL: "every 3m"
TANKTRACE_DEBUG: "false"
# Change the time zone
TZ: "Europe/Berlin"
volumes:
- ./downloads:/tanktrace/static/d
labels:
- "traefik.enable=true"
# CHANGE THE HOSTNAME
- "traefik.http.routers.tanktrace.rule=Host(`tanktrace.example.com`)"
- "traefik.http.services.tanktrace.loadbalancer.server.port=8000"
- "traefik.http.routers.tanktrace.entrypoints=websecure"
- "traefik.http.routers.tanktrace.tls.certresolver=default"
db:
image: mysql
container_name: tanktrace_mysql
restart: unless-stopped
command: --default-authentication-plugin=mysql_native_password
environment:
TZ: "Europe/Berlin"
# CHANGE THE PASSWORD HERE
MYSQL_ROOT_PASSWORD: SECURE_PASSWORD
MYSQL_DATABASE: tanktrace
volumes:
- ./mysql:/var/lib/mysql
- /etc/timezone:/etc/timezone:ro
traefik:
image: "traefik"
container_name: "traefik"
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/certs:/certs/
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
# CHANGE THE E-MAIL ADDRESS HERE
- "--certificatesresolvers.default.acme.email=tanktrace@example.com"
- "--certificatesresolvers.default.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.default.acme.httpchallenge=true"
- "--certificatesresolvers.default.acme.storage=/certs/acme.json"
# optional, backs up the database every night
mysql-cron-backup:
image: fradelg/mysql-cron-backup
container_name: tanktrace-backup
restart: unless-stopped
depends_on:
- db
volumes:
- ./backup:/backup
environment:
MYSQL_HOST: "db"
MYSQL_USER: "root"
# CHANGE THE PASSWORD HERE
MYSQL_PASS: "SECURE_PASSWORD"
MAX_BACKUPS: 15
INIT_BACKUP: 0
CRON_TIME: "0 3 * * *"
GZIP_LEVEL: 9
TZ: "Europe/Berlin"
Stop everything
Change into the directory with the docker-compose.yml
and run docker-compose down
Updates
Change into the directory with the docker-compose.yml
and run docker-compose pull; docker-compose up -d