Wger
Stack
Self hosted FLOSS fitness/workout, nutrition and weight tracker written with Django
Services
wger-web
Configuration
Imagewger/server:latest8000/home/wger/static : /portainer/Files/AppData/Config/wger/static/home/wger/media : /portainer/Files/AppData/Config/wger/mediaSECRET_KEY=wger-docker-supersecret-key-1234567890!@#$%^&*(-_)SIGNING_KEY=wger-docker-secret-jwtkey-1234567890!@#$%^&*(-_=+FROM_EMAIL=info@example.comTIME_ZONE=Europe/AthensALLOW_REGISTRATION=TrueALLOW_GUEST_USERS=TrueALLOW_UPLOAD_VIDEOS=TruMIN_ACCOUNT_AGE_TO_TRUST=21SYNC_EXERCISES_ON_STARTUP=FalseDOWNLOAD_EXERCISE_IMAGES_ON_STARTUP=FalseDJANGO_DB_ENGINE=django.db.backends.postgresqlDJANGO_DB_DATABASE=wgerDJANGO_DB_USER=wgerDJANGO_DB_PASSWORD=wgerDJANGO_DB_HOST=dbDJANGO_DB_PORT=5432DJANGO_PERFORM_MIGRATIONS=TrueDJANGO_CACHE_BACKEND=django_redis.cache.RedisCacheDJANGO_CACHE_LOCATION=redis://cache:6379/1DJANGO_CACHE_TIMEOUT=12DJANGO_CACHE_CLIENT_CLASS=django_redis.client.DefaultClientAXES_ENABLED=TrueAXES_FAILURE_LIMIT=10AXES_COOLOFF_TIME=30AXES_HANDLER=axes.handlers.cache.AxesCacheHandlerDJANGO_DEBUG=FalseWGER_USE_GUNICORN=TrueEXERCISE_CACHE_TTL=10SITE_URL=http://localhostACCESS_TOKEN_LIFETIME=10REFRESH_TOKEN_LIFETIME=24unless-stoppedImage details
wger-nginx
Configuration
Imagenginx:stable680:80/etc/nginx/conf.d/default.conf : /portainer/Files/AppData/Config/wger/nginx.conf/wger/static : /portainer/Files/AppData/Config/wger/static/wger/media : /portainer/Files/AppData/Config/wger/mediaunless-stoppedImage details
wger-db
Configuration
Imagepostgres:12-alpine/var/lib/postgresql/data/ : /portainer/Files/AppData/Config/wger/postgres-dataPOSTGRES_USER=wgerPOSTGRES_PASSWORD=wgerPOSTGRES_DB=wgerunless-stoppedImage details
wger-cache
Configuration
Imageredisunless-stoppedImage details
Standalone Install
Select an install method, to see config/commands for deploying Wger
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Wger, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
Original stackfile
The compose file this template deploys, straight from its repo:
services:
wger-web:
image: wger/server:latest
container_name: wger_server
depends_on:
wger-db:
condition: service_healthy
wger-cache:
condition: service_healthy
environment:
- SECRET_KEY=wger-docker-supersecret-key-1234567890!@#$%^&*(-_)
- SIGNING_KEY=wger-docker-secret-jwtkey-1234567890!@#$%^&*(-_=+
- FROM_EMAIL=info@example.com
- TIME_ZONE=Europe/Athens
# Application
- ALLOW_REGISTRATION=True
- ALLOW_GUEST_USERS=True
- ALLOW_UPLOAD_VIDEOS=Tru
# Users won't be able to contribute to exercises if their account age is
# lower than this amount in days.
- MIN_ACCOUNT_AGE_TO_TRUST=21
# Note that setting these to true will always perform a sync during startup,
# even if the data is already current and will take some time. Usually you don't
# need to perform these steps so often and a manual trigger (see README) is
# usually enough.
- SYNC_EXERCISES_ON_STARTUP=False
- DOWNLOAD_EXERCISE_IMAGES_ON_STARTUP=False
# Database
- DJANGO_DB_ENGINE=django.db.backends.postgresql
- DJANGO_DB_DATABASE=wger
- DJANGO_DB_USER=wger
- DJANGO_DB_PASSWORD=wger
- DJANGO_DB_HOST=db
- DJANGO_DB_PORT=5432
# Perform any new database migrations on startup
- DJANGO_PERFORM_MIGRATIONS=True
# Cache
- DJANGO_CACHE_BACKEND=django_redis.cache.RedisCache
- DJANGO_CACHE_LOCATION=redis://cache:6379/1
# 60*60*24*15, 15 Days
- DJANGO_CACHE_TIMEOUT=12
- DJANGO_CACHE_CLIENT_CLASS=django_redis.client.DefaultClient
# Brute force login attacks
# https://django-axes.readthedocs.io/en/latest/index.html
- AXES_ENABLED=True
- AXES_FAILURE_LIMIT=10
# in minutes
- AXES_COOLOFF_TIME=30
- AXES_HANDLER=axes.handlers.cache.AxesCacheHandler
#
# Others
- DJANGO_DEBUG=False
- WGER_USE_GUNICORN=True
- EXERCISE_CACHE_TTL=10
- SITE_URL=http://localhost
#
# JWT auth
# The lifetime duration of the access token, in minutes
- ACCESS_TOKEN_LIFETIME=10
# The lifetime duration of the refresh token, in hours
- REFRESH_TOKEN_LIFETIME=24
#
# Other possible settings
# RECAPTCHA_PUBLIC_KEY
# RECAPTCHA_PRIVATE_KEY
# NOCAPTCHA
# https://docs.djangoproject.com/en/4.1/topics/email/#smtp-backend
# ENABLE_EMAIL
# EMAIL_HOST
# EMAIL_PORT
# EMAIL_HOST_USER
# EMAIL_HOST_PASSWORD
# EMAIL_USE_TLS
# EMAIL_USE_SSL
# DJANGO_MEDIA_ROOT
# DJANGO_STATIC_ROOT
volumes:
- /portainer/Files/AppData/Config/wger/static:/home/wger/static
- /portainer/Files/AppData/Config/wger/media:/home/wger/media
# For development, mount your local git checkout
# - type: bind
# source: /path/to/wger/sourcecode
# target: /home/wger/src/
ports:
- "8000"
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8000
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger-nginx:
image: nginx:stable
container_name: wger_nginx
depends_on:
- wger-web
volumes:
- /portainer/Files/AppData/Config/wger/nginx.conf:/etc/nginx/conf.d/default.conf
- /portainer/Files/AppData/Config/wger/static:/wger/static:ro
- /portainer/Files/AppData/Config/wger/media:/wger/media:ro
ports:
- "680:80"
healthcheck:
test: service nginx status
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger-db:
image: postgres:12-alpine
container_name: wger_db
environment:
- POSTGRES_USER=wger
- POSTGRES_PASSWORD=wger
- POSTGRES_DB=wger
volumes:
- /portainer/Files/AppData/Config/wger/postgres-data:/var/lib/postgresql/data/
expose:
- 5432
healthcheck:
test: pg_isready -U wger
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger-cache:
image: redis
container_name: wger_cache
expose:
- 6379
healthcheck:
test: redis-cli ping
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
postgres-data:
static:
media:
networks:
default:
name: wger_network
Or deploy it directly from the source:
git clone https://github.com/xneo1/portainer_templates
cd portainer_templates
docker compose -f Template/Stack/wger.yml up -dMore install options in our documentation.
Container Documentation
wger-web Documentation
Server for a wger installation
wger-nginx Documentation
Official build of Nginx.
wger-db Documentation
The PostgreSQL object-relational database system provides reliability and data integrity.
wger-cache Documentation
Redis is the world’s fastest data platform for caching, vector search, and NoSQL databases.
Serve Wger on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.
Proxying wger.example.com to http://wger-web:8000
Add this to your Caddyfile
wger.example.com {
reverse_proxy http://wger-web:8000
}Check the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs <container> - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Port already in use
If deployment fails with "Bind for 0.0.0.0:680 failed: port is already allocated", something else on your server is using that port.
- Find what's using it:
sudo ss -tlnp | grep :680 - Stop the other service, or pick a different host port. In
680:80only the left number is yours to change, the right one belongs to the app.
Published on a random port
This template exposes 8000 without setting a host port,
so Docker picks a random free one on every deploy.
- Find it in the Ports column of Portainer's container list, or with
docker port <container>
Running but the page won't load
The container is up but nothing appears in your browser.
- Use your server's real IP:
http://your-server-ip:680. The 0.0.0.0 link Portainer shows isn't a real address. - Give it a minute after first deploy, wger can take a while to initialise.
- Make sure your firewall allows the port, e.g.
sudo ufw allow 680
Permission denied on volumes
If the logs show "permission denied", the app can't write to its data folder on the host.
- Fix the ownership:
sudo chown -R 1000:1000 /portainer/Files/AppData/Config/wger/static(and the same for the other mapped folders)
Image won't pull
Test the pull directly on the host: docker pull wger/server:latest
- "manifest unknown" means the tag no longer exists. This template uses
latest, so try pinning a specific version instead. - "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect <container> --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Stack won't deploy
Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.
- YAML only accepts spaces for indentation, a single tab breaks the whole file.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue within wger's repo
- Template not working: Open an issue on xneo1/portainer_templates
- This website not working: Open an issue on lissy93/portainer-templates
A Compose stack
Wger is a Compose stack, a set of containers (4 of them) defined in one file and brought up together by Portainer, then started and stopped as a single app.
The services
This stack is built from 4 containers that run side by side. Here's each one, with the image it runs and anything it waits for first:
wger-webrunswger/server:latest, starts after wger-db, wger-cachewger-nginxrunsnginx:stable, starts after wger-webwger-dbrunspostgres:12-alpinewger-cacherunsredis
Ports
A port is the door the app answers on. A mapping like 680:80 means it's reachable on port 680 of your server, where the left number is yours to change and the right one belongs to the app. Once it's running, open http://your-server-ip:680 in a browser. It opens:
8000, published on a random host port680:80, likely the web interface
Volumes
A volume is where Wger keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/home/wger/staticfrom/portainer/Files/AppData/Config/wger/staticon the host/home/wger/mediafrom/portainer/Files/AppData/Config/wger/mediaon the host/etc/nginx/conf.d/default.conffrom/portainer/Files/AppData/Config/wger/nginx.confon the host/wger/staticfrom/portainer/Files/AppData/Config/wger/staticon the host/wger/mediafrom/portainer/Files/AppData/Config/wger/mediaon the host/var/lib/postgresql/data/from/portainer/Files/AppData/Config/wger/postgres-dataon the host
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Wger takes 34 of them, all with defaults you can leave alone or tweak:
SECRET_KEY, defaults towger-docker-supersecret-key-1234567890!@#$%^&*(-_)SIGNING_KEY, defaults towger-docker-secret-jwtkey-1234567890!@#$%^&*(-_=+FROM_EMAIL, defaults toinfo@example.comTIME_ZONE, defaults toEurope/AthensALLOW_REGISTRATION, defaults toTrueALLOW_GUEST_USERS, defaults toTrueALLOW_UPLOAD_VIDEOS, defaults toTruMIN_ACCOUNT_AGE_TO_TRUST, defaults to21SYNC_EXERCISES_ON_STARTUP, defaults toFalseDOWNLOAD_EXERCISE_IMAGES_ON_STARTUP, defaults toFalseDJANGO_DB_ENGINE, defaults todjango.db.backends.postgresqlDJANGO_DB_DATABASE, defaults towgerDJANGO_DB_USER, defaults towgerDJANGO_DB_PASSWORD, defaults towgerDJANGO_DB_HOST, defaults todbDJANGO_DB_PORT, defaults to5432DJANGO_PERFORM_MIGRATIONS, defaults toTrueDJANGO_CACHE_BACKEND, defaults todjango_redis.cache.RedisCacheDJANGO_CACHE_LOCATION, defaults toredis://cache:6379/1DJANGO_CACHE_TIMEOUT, defaults to12DJANGO_CACHE_CLIENT_CLASS, defaults todjango_redis.client.DefaultClientAXES_ENABLED, defaults toTrueAXES_FAILURE_LIMIT, defaults to10AXES_COOLOFF_TIME, defaults to30AXES_HANDLER, defaults toaxes.handlers.cache.AxesCacheHandlerDJANGO_DEBUG, defaults toFalseWGER_USE_GUNICORN, defaults toTrueEXERCISE_CACHE_TTL, defaults to10SITE_URL, defaults tohttp://localhostACCESS_TOKEN_LIFETIME, defaults to10REFRESH_TOKEN_LIFETIME, defaults to24POSTGRES_USER, defaults towgerPOSTGRES_PASSWORD, defaults towgerPOSTGRES_DB, defaults towger
Restart policy
The restart policy here is unless-stopped, so Docker restarts Wger after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Networking
Portainer puts these services on one shared private network, so they can find each other by name (like wger-web) while only the ports above are open to you.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Wger up. Add the template list to Portainer once, then deploying Wger is a click rather than a wall of config.