Update wger to v2.6

Co-authored-by: Kai Chappel <kaichappel@users.noreply.github.com>
Co-authored-by: nmfretz <nmfretz@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-06-23 12:47:56 +10:00
1 parent 7ca781310e
commit 0752280674
7 files changed
+477 -24

No files matched your search

+41 -3
View File
@@ -2,21 +2,59 @@ upstream wger {
server wger_web_1:8000;
}
upstream powersync {
server wger_powersync_1:8080;
}
map $http_x_forwarded_proto $final_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
server {
listen 80;
location / {
proxy_pass http://wger;
proxy_set_header Host $host;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $final_forwarded_proto;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_http_version 1.1;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location /ps/ {
proxy_pass http://powersync/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $final_forwarded_proto;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
}
location /static/ {
alias /wger/static/;
add_header Cache-Control "public, max-age=31536000, immutable" always;
add_header Vary "Accept-Encoding" always;
}
location /media/ {
+3
View File
@@ -16,7 +16,10 @@ SYNC_EXERCISE_IMAGES_CELERY=True
SYNC_EXERCISE_VIDEOS_CELERY=True
SYNC_INGREDIENTS_CELERY=True
SYNC_INGREDIENTS_DUMP_URL=https://wger.de/media/ingredients/ingredients.jsonl.gz
DOWNLOAD_INGREDIENTS_FROM=WGER
CACHE_API_EXERCISES_CELERY=True
CACHE_API_EXERCISES_CELERY_FORCE_UPDATE=True
USE_CELERY=True
+72 -7
View File
@@ -5,21 +5,26 @@ services:
environment:
APP_HOST: wger_nginx_1
APP_PORT: 80
PROXY_AUTH_WHITELIST: "/allauth,/allauth/*,/api/v2,/api/v2/*,/ps,/ps/*,/media/exercise-images/*,/media/exercise-video/*,/media/ingredients/*"
web:
image: wger/server:2.5@sha256:1cac2c62b8d85b54dab16291df802a1cdbf66828201b8df6104db0400320f0df
image: wger/server:2.6@sha256:997ead43aabdcd67d054f933e07d2b23875f01bf43271a267cb7796925ca27c4
user: "1000:1000"
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
powersync_setup:
condition: service_completed_successfully
environment:
SECRET_KEY: ${APP_SEED}
SIGNING_KEY: ${APP_SEED}
CSRF_TRUSTED_ORIGINS: http://${DEVICE_DOMAIN_NAME}:${APP_WGER_PORT},http://${DEVICE_HOSTNAME}:${APP_WGER_PORT},${APP_WGER_LOCAL_URLS}
SITE_URL: http://${DEVICE_DOMAIN_NAME}:8450
MEDIA_URL: http://${DEVICE_DOMAIN_NAME}:8450/media/
SITE_URL: http://${DEVICE_DOMAIN_NAME}:${APP_WGER_PORT}
MEDIA_URL: http://${DEVICE_DOMAIN_NAME}:${APP_WGER_PORT}/media/
PS_DATABASE_URI: postgres://wger:wger@db:5432/wger
PS_STORAGE_PG_URI: postgres://powersync_storage:${APP_SEED}@db:5432/wger
POWERSYNC_URL_PATH: ps
env_file:
- ${APP_DATA_DIR}/config/prod.env
volumes:
@@ -33,10 +38,47 @@ services:
retries: 5
restart: on-failure
powersync_setup:
image: wger/server:2.6@sha256:997ead43aabdcd67d054f933e07d2b23875f01bf43271a267cb7796925ca27c4
user: "1000:1000"
command: ./manage.py setup-powersync-storage
depends_on:
db:
condition: service_healthy
environment:
SECRET_KEY: ${APP_SEED}
PS_DATABASE_URI: postgres://wger:wger@db:5432/wger
PS_STORAGE_PG_URI: postgres://powersync_storage:${APP_SEED}@db:5432/wger
env_file:
- ${APP_DATA_DIR}/config/prod.env
restart: on-failure
powersync:
image: journeyapps/powersync-service:1.22.0@sha256:2d5084910f03a029174ebc7f7ce0c0d2c43e932ead63a2d87b919e90ebbb0e77
depends_on:
db:
condition: service_healthy
web:
condition: service_healthy
powersync_setup:
condition: service_completed_successfully
command: ["start", "-r", "unified"]
environment:
POWERSYNC_CONFIG_PATH: /config/powersync.yaml
PS_JWKS_URL: http://wger_web_1:8000/api/v2/powersync-keys
PS_DATABASE_URI: postgres://wger:wger@db:5432/wger
PS_STORAGE_PG_URI: postgres://powersync_storage:${APP_SEED}@db:5432/wger
PS_PORT: 8080
volumes:
- ${APP_DATA_DIR}/powersync.yaml:/config/powersync.yaml:ro
- ${APP_DATA_DIR}/sync_rules.yaml:/config/sync_rules.yaml:ro
restart: on-failure
nginx:
image: nginx:alpine3.22@sha256:d67ea0d64d518b1bb04acde3b00f722ac3e9764b3209a9b0a98924ba35e4b779
image: nginx:alpine3.22@sha256:b3c656d55d7ad751196f21b7fd2e8d4da9cb430e32f646adcf92441b72f82b14
depends_on:
- web
- powersync
volumes:
- ${APP_DATA_DIR}/config/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ${APP_DATA_DIR}/data/static:/wger/static:ro
@@ -52,6 +94,7 @@ services:
db:
image: postgres:17.5-alpine@sha256:6567bca8d7bc8c82c5922425a0baee57be8402df92bae5eacad5f01ae9544daa
user: "1000:1000"
shm_size: 256mb
environment:
POSTGRES_USER: wger
POSTGRES_PASSWORD: wger
@@ -59,6 +102,20 @@ services:
TZ: Europe/Berlin
volumes:
- ${APP_DATA_DIR}/data/postgres-data:/var/lib/postgresql/data/
command:
- postgres
- -c
- wal_level=logical
- -c
- shared_buffers=256MB
- -c
- effective_cache_size=768MB
- -c
- work_mem=8MB
- -c
- random_page_cost=1.1
- -c
- max_connections=30
healthcheck:
test: pg_isready -U wger
interval: 10s
@@ -81,9 +138,13 @@ services:
restart: on-failure
celery_worker:
image: wger/server:2.5@sha256:1cac2c62b8d85b54dab16291df802a1cdbf66828201b8df6104db0400320f0df
image: wger/server:2.6@sha256:997ead43aabdcd67d054f933e07d2b23875f01bf43271a267cb7796925ca27c4
user: "1000:1000"
command: /start-worker
environment:
SECRET_KEY: ${APP_SEED}
PS_DATABASE_URI: postgres://wger:wger@db:5432/wger
PS_STORAGE_PG_URI: postgres://powersync_storage:${APP_SEED}@db:5432/wger
env_file:
- ${APP_DATA_DIR}/config/prod.env
volumes:
@@ -100,9 +161,13 @@ services:
restart: on-failure
celery_beat:
image: wger/server:2.5@sha256:1cac2c62b8d85b54dab16291df802a1cdbf66828201b8df6104db0400320f0df
image: wger/server:2.6@sha256:997ead43aabdcd67d054f933e07d2b23875f01bf43271a267cb7796925ca27c4
user: "1000:1000"
command: /start-beat
environment:
SECRET_KEY: ${APP_SEED}
PS_DATABASE_URI: postgres://wger:wger@db:5432/wger
PS_STORAGE_PG_URI: postgres://powersync_storage:${APP_SEED}@db:5432/wger
volumes:
- ${APP_DATA_DIR}/data/celery-beat:${APP_DATA_DIR}/beat/
env_file:
+193
View File
@@ -0,0 +1,193 @@
#!/usr/bin/env bash
set -euo pipefail
APP_DIR="${APP_DATA_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
config_dir="${APP_DIR}/config"
config_file="${config_dir}/prod.env"
nginx_config_file="${config_dir}/nginx.conf"
# Umbrel updates do not copy nested package files such as config/nginx.conf or
# config/prod.env. The config directory is already part of the released wger
# package, so this hook only updates package-owned files inside it. It does not
# create or chown a new bind-mount directory.
set_env_default() {
local key="$1"
local value="$2"
if ! grep -q "^${key}=" "${config_file}"; then
printf '%s=%s\n' "${key}" "${value}" >> "${config_file}"
fi
}
# Existing installs keep their old prod.env, so backfill the 2.6 defaults that
# fresh installs receive from the package.
set_env_default "SYNC_INGREDIENTS_DUMP_URL" "https://wger.de/media/ingredients/ingredients.jsonl.gz"
set_env_default "CACHE_API_EXERCISES_CELERY" "True"
set_env_default "CACHE_API_EXERCISES_CELERY_FORCE_UPDATE" "True"
# Keep the nginx config in sync for updates. Without this, upgraded installs
# would keep the 2.5 config and miss the /ps/ proxy required by PowerSync.
cat > "${nginx_config_file}" <<'NGINX'
upstream wger {
server wger_web_1:8000;
}
upstream powersync {
server wger_powersync_1:8080;
}
map $http_x_forwarded_proto $final_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
server {
listen 80;
location / {
proxy_pass http://wger;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $final_forwarded_proto;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_http_version 1.1;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location /ps/ {
proxy_pass http://powersync/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $final_forwarded_proto;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
}
location /static/ {
alias /wger/static/;
add_header Cache-Control "public, max-age=31536000, immutable" always;
add_header Vary "Accept-Encoding" always;
}
location /media/ {
alias /wger/media/;
}
client_max_body_size 100M;
}
NGINX
if grep -q '^JWT_PRIVATE_KEY=' "${config_file}" && grep -q '^JWT_PUBLIC_KEY=' "${config_file}"; then
exit 0
fi
# wger 2.6 replaced SIGNING_KEY with an RS256 JWK pair used by SimpleJWT,
# allauth headless auth, and PowerSync. Generate it once per install and keep it
# stable across restarts and future updates.
umask 077
tmp_dir="$(mktemp -d)"
trap 'rm -rf "${tmp_dir}"' EXIT
openssl genrsa 2048 > "${tmp_dir}/jwt.pem"
openssl rsa -in "${tmp_dir}/jwt.pem" -outform DER -traditional -out "${tmp_dir}/jwt.der" 2>/dev/null
python3 - "${tmp_dir}/jwt.der" >> "${config_file}" <<'PY'
import base64
import json
import sys
from pathlib import Path
blob = Path(sys.argv[1]).read_bytes()
pos = 0
def read_byte():
global pos
b = blob[pos]
pos += 1
return b
def read_len():
first = read_byte()
if first < 0x80:
return first
n = first & 0x7F
value = int.from_bytes(blob[pos:pos+n], 'big')
globals()['pos'] += n
return value
def expect(tag):
actual = read_byte()
if actual != tag:
raise ValueError(f'Expected ASN.1 tag {tag:#x}, got {actual:#x}')
return read_len()
def read_int():
length = expect(0x02)
data = blob[pos:pos+length]
globals()['pos'] += length
return int.from_bytes(data, 'big')
expect(0x30)
version = read_int()
if version != 0:
raise ValueError('Unexpected RSA private key version')
n = read_int()
e = read_int()
d = read_int()
p = read_int()
q = read_int()
dp = read_int()
dq = read_int()
qi = read_int()
def b64u_int(value):
data = value.to_bytes((value.bit_length() + 7) // 8, 'big')
return base64.urlsafe_b64encode(data).decode()
def b64u_json(value):
return base64.urlsafe_b64encode(json.dumps(value, separators=(',', ':')).encode()).decode()
kid = 'umbrel-wger'
private_jwk = {
'kty': 'RSA',
'n': b64u_int(n),
'e': b64u_int(e),
'd': b64u_int(d),
'p': b64u_int(p),
'q': b64u_int(q),
'dp': b64u_int(dp),
'dq': b64u_int(dq),
'qi': b64u_int(qi),
'alg': 'RS256',
'kid': kid,
}
public_jwk = {key: private_jwk[key] for key in ('kty', 'n', 'e', 'alg', 'kid')}
print(f'JWT_PRIVATE_KEY={b64u_json(private_jwk)}')
print(f'JWT_PUBLIC_KEY={b64u_json(public_jwk)}')
PY
+26
View File
@@ -0,0 +1,26 @@
# yaml-language-server: $schema=../schema/schema.json
telemetry:
disable_telemetry_sharing: true
prometheus_port: 9090
replication:
connections:
- type: postgresql
uri: !env PS_DATABASE_URI
sslmode: disable
storage:
type: postgresql
uri: !env PS_STORAGE_PG_URI
sslmode: disable
port: !env PS_PORT
sync_rules:
path: sync_rules.yaml
client_auth:
allow_local_jwks: true
jwks_uri: !env PS_JWKS_URL
audience: ["powersync"]
+131
View File
@@ -0,0 +1,131 @@
# Note that changes to this file are not watched.
# The service needs to be restarted for changes to take effect.
# Warning: a user may have at most 1000 buckets, i.e. parameter-query results
# summed across all streams. This counts the *parameter* rows, not the data
# rows inside a bucket (a single bucket can hold any number of rows). For a
# stream with a `with:` CTE the count is the number of rows the CTE returns,
# so for `user_ingredients` below that is the number of distinct ingredients
# a user has ever referenced. Exceeding the limit is a hard error
# (PSYNC_S2305 "Too many parameter query results").
# See https://docs.powersync.com/sync/rules/parameter-queries
#
# Streams are split by update frequency (cold / medium / hot) so that
# bucket compaction can collapse the head of hot buckets without being
# blocked by long-lived rows from cold tables.
#
# For details, see the documentation:
# https://docs.powersync.com/sync/streams/overview
# https://docs.powersync.com/maintenance-ops/compacting-buckets
config:
edition: 3
streams:
# Global reference data, shared by all users, changes rarely enough
core:
auto_subscribe: true
queries:
- SELECT * FROM core_language
- SELECT * FROM core_license
- SELECT * FROM core_repetitionunit
- SELECT * FROM core_weightunit
- SELECT * FROM exercises_exercise
- SELECT * FROM exercises_translation
- SELECT * FROM exercises_alias
- SELECT * FROM exercises_exercisecomment
- SELECT * FROM exercises_muscle
- SELECT * FROM exercises_exercise_muscles
- SELECT * FROM exercises_exercise_muscles_secondary
- SELECT * FROM exercises_equipment
- SELECT * FROM exercises_exercise_equipment
- SELECT * FROM exercises_exercisecategory
- SELECT * FROM exercises_exerciseimage
- SELECT * FROM exercises_exercisevideo
# COLD, per-user data that almost never changes after creation.
user_profile:
auto_subscribe: true
queries:
- SELECT * FROM core_userprofile WHERE CAST(user_id AS TEXT) = auth.user_id()
- SELECT * FROM gallery_image WHERE CAST(user_id AS TEXT) = auth.user_id()
# COLD but potentially large, only the per-user filter set changes when the user logs new foods
user_ingredients:
auto_subscribe: true
with:
user_ingredients: |
SELECT DISTINCT nutrition_synced_ingredient.id
FROM nutrition_synced_ingredient
WHERE nutrition_synced_ingredient.id IN (
SELECT nutrition_logitem.ingredient_id FROM nutrition_logitem
JOIN nutrition_nutritionplan ON nutrition_logitem.plan_id = nutrition_nutritionplan.id
WHERE CAST(nutrition_nutritionplan.user_id AS TEXT) = auth.user_id())
OR nutrition_synced_ingredient.id IN (
SELECT nutrition_mealitem.ingredient_id FROM nutrition_mealitem
JOIN nutrition_meal ON nutrition_mealitem.meal_id = nutrition_meal.id
JOIN nutrition_nutritionplan ON nutrition_meal.plan_id = nutrition_nutritionplan.id
WHERE CAST(nutrition_nutritionplan.user_id AS TEXT) = auth.user_id())
queries:
- SELECT * FROM nutrition_synced_ingredient AS nutrition_ingredient WHERE id IN user_ingredients
- |
SELECT nutrition_image.* FROM nutrition_image
WHERE nutrition_image.ingredient_id IN user_ingredients
- |
SELECT nutrition_ingredientweightunit.* FROM nutrition_ingredientweightunit
WHERE nutrition_ingredientweightunit.ingredient_id IN user_ingredients
# MEDIUM. Edited e.g. when the user builds or edits their routine or nutrition plan,
# but not on every workout.
user_planning:
auto_subscribe: true
queries:
# Routines (templates excluded)
- SELECT * FROM manager_routine WHERE CAST(user_id AS TEXT) = auth.user_id() AND is_template = FALSE
# Measurements
- SELECT * FROM measurements_category WHERE CAST(user_id AS TEXT) = auth.user_id()
- |
SELECT measurements_measurement.*
FROM measurements_measurement
INNER JOIN measurements_category
ON measurements_measurement.category_id = measurements_category.id
WHERE CAST(measurements_category.user_id AS TEXT) = auth.user_id()
# Nutrition plan structure (not the log items)
- SELECT * FROM nutrition_nutritionplan WHERE CAST(user_id AS TEXT) = auth.user_id()
- |
SELECT nutrition_meal.*
FROM nutrition_meal
JOIN nutrition_nutritionplan
ON nutrition_meal.plan_id = nutrition_nutritionplan.id
WHERE CAST(nutrition_nutritionplan.user_id AS TEXT) = auth.user_id()
- |
SELECT nutrition_mealitem.*
FROM nutrition_mealitem
JOIN nutrition_meal
ON nutrition_mealitem.meal_id = nutrition_meal.id
JOIN nutrition_nutritionplan
ON nutrition_meal.plan_id = nutrition_nutritionplan.id
WHERE CAST(nutrition_nutritionplan.user_id AS TEXT) = auth.user_id()
# HOT. Generates one or more new rows per workout / meal. Compaction has the
# biggest impact here, so it must stay isolated from the other streams above
user_activity:
auto_subscribe: true
queries:
# Weight tracking
- SELECT uuid AS id, weight, date, user_id FROM weight_weightentry WHERE CAST(user_id AS TEXT) = auth.user_id()
# Workout sessions and per-set logs
- SELECT * FROM manager_workoutsession WHERE CAST(user_id AS TEXT) = auth.user_id()
- SELECT * FROM manager_workoutlog WHERE CAST(user_id AS TEXT) = auth.user_id()
# Nutrition log entries
- |
SELECT nutrition_logitem.*
FROM nutrition_logitem
JOIN nutrition_nutritionplan
ON nutrition_logitem.plan_id = nutrition_nutritionplan.id
WHERE CAST(nutrition_nutritionplan.user_id AS TEXT) = auth.user_id()
+11 -14
View File
@@ -1,9 +1,9 @@
manifestVersion: 1
manifestVersion: 1.1
id: wger
name: wger
tagline: A fitness tracker for workouts and nutrition
category: files
version: "2.5"
version: "2.6"
port: 8450
description: >-
📈 wger is a powerful and flexible open-source fitness management software designed to assist users in planning, tracking, and optimizing their workouts, nutrition, and overall fitness progress. Whether you are an individual looking to improve your training efficiency, a personal trainer managing multiple clients, or a gym owner searching for a digital solution to streamline workout programming, wger provides a feature-rich platform tailored to various fitness needs.
@@ -36,21 +36,18 @@ gallery:
- 5.jpg
- 6.jpg
releaseNotes: >-
⚠️ Major update: wger 2.6 adds a new PowerSync service and JWT-based authentication. You may need to log in again after updating, and custom scripts that used the removed legacy token endpoints must switch to the new allauth/JWT flow or a user API key.
Key highlights in this release include:
- Improved ingredient sync using a pre-generated database dump for faster and more efficient processing
- Serving size support for ingredients, allowing food to be logged in units like "1 Cup" or "1 Serving"
- Serving sizes automatically imported from Open Food Facts
- Added vegan, vegetarian, and nutriscore fields to ingredients
- Added "warmup" as a new set type
- Automatic date reading from uploaded gallery images
- Exercise variations moved to a field directly on the exercise model
- Set UI language preference
- Timer support for timed exercises
- Multiple measurement entries per day
- Ability to set UI language per user
- Backend support for offline mode in the mobile app, including PowerSync data synchronization
- Social login and two-factor authentication support
- Exercise image API responses now include small and medium thumbnails
- Ingredient API filtering now supports nutriscore ranges
- Username suggestions are shown when a requested username is already taken
Full release notes are available at https://github.com/wger-project/wger/releases
Full release notes are available at https://github.com/wger-project/wger/releases/tag/2.6
dependencies: []
path: ""
defaultUsername: ""