Table of Contents

WGer

WGer is a self-hosted workout tracker. It is actually targeted at gyms and not very capable of tracking more activities like byke, runs, etc.

Note: I am not using this at this time, so this information might be out of date.

Installation

WGer provides instruction for a bare-metal installation, but as is often the case, it require to install some additional packages system-wide and that's not a good practice in my opinion. This is one of the cases where going container might be a good idea.

Some good refrence for WGer and docker can be found here.

As usual, let's create the dedicated user wger first:

useradd -d /data/daemons/wger -m wger
mkdir /data/wger
mkdir /data/wger/db
chown -R wger /data/wger
docker-compose.yml
services:
  web:
    image: wger/server:latest
    container_name: wger_server
    env_file:
      - ./config/prod.env
    volumes:
      - /data/wger/static:/home/wger/static
      - /data/wger/media:/home/wger/media
    ports:
      - 8123:8000
    networks:
      - wger-net

networks:
  wger-net: {}

Also, you need the following prod.env file:

prod.env
SECRET_KEY=wger-docker-supersecret-key-<my key>
SIGNING_KEY=wger-docker-secret-jwtkey-<my key>
TIME_ZONE=Europe/Berlin
CSRF_TRUSTED_ORIGINS=https://train.mydomain.com
X_FORWARDED_PROTO_HEADER_SET=True
WGER_INSTANCE=https://wger.de # Wger instance from which to sync exercises, images, etc.
ALLOW_REGISTRATION=True
ALLOW_GUEST_USERS=True
ALLOW_UPLOAD_VIDEOS=True
MIN_ACCOUNT_AGE_TO_TRUST=21
DJANGO_DB_ENGINE=django.db.backends.sqlite3
DJANGO_DB_DATABASE=/home/wger/db/wger.sqlite3
DJANGO_DB_USER=wger
DJANGO_DB_PASSWORD=wger
DJANGO_DB_HOST=localhost
DJANGO_DB_PORT=5432
DJANGO_PERFORM_MIGRATIONS=True
DJANGO_DEBUG=False
WGER_USE_GUNICORN=True
EXERCISE_CACHE_TTL=18000
SITE_URL=http://localhost
ACCESS_TOKEN_LIFETIME=10
REFRESH_TOKEN_LIFETIME=24
USE_RECAPTCHA=False
DJANGO_CLEAR_STATIC_FIRST=False
FROM_EMAIL='wger Workout Manager <me@mydomain.com>'

Reverse Proxy

I didn't try to urn WGer on a subpath. The following NGINX config file should be enough:

wger.conf
server {
        server_name train.mydomain.com;
        listen 443 ssl;
        listen 8443 ssl;

        access_log /var/log/nginx/train.mydomain.com_access_log main;
        error_log /var/log/nginx/train.mydomain.com_error_log info;

        location / {
                proxy_pass http://127.0.0.1:8123;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
                proxy_set_header X-Forwarded-Host $host:$server_port;
                proxy_redirect off;
        }

        location /static/ {
                alias /deposito/wger/static/;
        }

        location /media/ {
                alias /deposito/wger/media/;
        }

        client_max_body_size 100M;
        include com.mydomain/certbot.conf;
}

See The Reverse Proxy concept for more details.