wger - Self-Hosted Fitness and Workout Manager
Table of Contents
Overview
wger (Workout Manager) is a free, open-source fitness and workout tracking application deployed in the Fako cluster. It provides comprehensive features for managing workouts, tracking nutrition, monitoring body weight, and creating exercise routines. The application includes a large exercise database with images and videos, making it an excellent self-hosted alternative to commercial fitness apps. It’s accessible via the web interface and offers both registered user accounts and guest access.
Key Features
- Workout Management: Create and track custom workout routines
- Exercise Database: Large database with images and videos
- Nutrition Tracking: Log meals and track calories/macros
- Weight Tracking: Monitor body weight progress over time
- Multi-Language: Support for multiple languages
- REST API: Full API for mobile apps and integrations
- Guest Access: Try before registering
- PDF Export: Generate workout plans as PDFs
- Exercise Sync: Automatic sync of exercise database
Architecture
Components
- Helm Release: Deployed via Flux Helm controller
- Django Backend: Python-based web framework
- PostgreSQL Database: Uses cluster’s PostgreSQL
- Redis Cache: For performance optimization
- Celery Workers: Background task processing
- nginx: Web server and static file serving
- Persistent Storage: NFS for media files
Resource Requirements
- Django App: 256Mi RAM (request), 1Gi (limit)
- Celery: 256Mi RAM (request), 512Mi (limit)
- CPU: 250m-1000m for app, 100m-500m for Celery
- Storage: 10Gi for media, 5Gi for Redis
Configuration
Application Settings
| Parameter | Value | Description |
|---|---|---|
WGER_ALLOW_REGISTRATION | True | Open registration |
WGER_ALLOW_GUEST_USERS | True | Guest access enabled |
DJANGO_DEBUG | False | Production mode |
EXERCISE_CACHE_TTL | 86400 | 24-hour cache |
WGER_USE_GUNICORN | True | Production server |
Infrastructure
- Database: External PostgreSQL cluster
- Cache: Redis with 5Gi storage
- Ingress:
trackit.landryzetam.net - Storage Class:
nfs-csi-v2
Usage
Accessing wger
External access:
https://trackit.landryzetam.net
Internal access:
http://wger.wger.svc.cluster.local:8000
Getting Started
- Visit the site: Navigate to the URL
- Choose access type:
- Register new account
- Use guest account
- Login with existing account
- Create first workout:
- Browse exercise database
- Create workout routine
- Add exercises with sets/reps
- Track progress:
- Log workouts
- Track weight
- Monitor nutrition
Mobile Access
- Responsive web design works on all devices
- REST API available for custom apps
- Progressive Web App (PWA) support
Exercise Management
Database Features
- Automatic Sync: Celery syncs exercises daily
- Images & Videos: Visual exercise guides
- Categories: Organized by muscle groups
- Equipment: Filter by available equipment
- Custom Exercises: Add your own
Creating Workouts
- Templates: Use pre-made routines
- Custom Plans: Build from scratch
- Scheduling: Set workout days
- Logging: Track completed sets
- Progress: View strength gains
Operations
Database Initialization
The database is initialized via job:
# Check init job status
kubectl get job wger-db-init -n wger
# View initialization logs
kubectl logs -n wger job/wger-db-init
Managing Users
Django admin interface:
# Create superuser
kubectl exec -it -n wger deployment/wger -- \
python manage.py createsuperuser
# Access admin at /admin
Backup Procedures
Database Backup
# Backup wger database
kubectl exec -n postgres postgres-cluster-1 -- \
pg_dump -U postgres wger > wger-backup.sql
Media Files Backup
# Backup uploaded files
kubectl exec -n wger deployment/wger -- \
tar -czf /tmp/media-backup.tar.gz /app/media
# Copy locally
kubectl cp wger/wger-xxx:/tmp/media-backup.tar.gz ./wger-media-backup.tar.gz
Troubleshooting
Application Not Loading
- Check pods:
kubectl get pods -n wger
kubectl describe pod -n wger -l app.kubernetes.io/name=wger
- View logs:
# Django logs
kubectl logs -n wger -l app.kubernetes.io/component=wger
# Celery logs
kubectl logs -n wger -l app.kubernetes.io/component=celery
Database Connection Issues
- Verify credentials:
kubectl get secret wger-db-credentials -n wger -o yaml
- Test connection:
kubectl exec -n wger deployment/wger -- \
python -c "from django.db import connection; connection.ensure_connection()"
Exercise Sync Issues
- Check Celery workers:
kubectl logs -n wger -l app.kubernetes.io/component=celery-beat
- Trigger manual sync:
kubectl exec -n wger deployment/wger -- \
python manage.py sync-exercises
Performance Issues
- Check Redis:
kubectl exec -n wger deployment/redis -- redis-cli ping
- Monitor resources:
kubectl top pods -n wger
Security Considerations
Authentication
- Django authentication system
- Brute force protection (Axes)
- JWT tokens for API access
- Guest users have limited access
Data Privacy
- All data stored locally
- No external tracking
- User data isolation
- GDPR compliant
Best Practices
- Strong passwords: Enforce password policy
- Regular updates: Keep wger updated
- Limit registrations: Consider closing if needed
- Monitor access: Check logs regularly
- Backup data: Regular automated backups
Customization
Branding
Modify settings:
# Custom site name
SITE_HEADER = "My Fitness Tracker"
Language Support
Add languages:
# Generate translations
kubectl exec -n wger deployment/wger -- \
python manage.py makemessages -l es
# Compile translations
kubectl exec -n wger deployment/wger -- \
python manage.py compilemessages
Custom Exercises
Via API:
curl -X POST https://trackit.landryzetam.net/api/v2/exercise/ \
-H "Authorization: Token YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Custom Exercise",
"category": 1,
"description": "Description here"
}'
API Usage
Authentication
Get API token:
curl -X POST https://trackit.landryzetam.net/api/v2/token/ \
-d "username=user&password=pass"
Example Requests
List workouts:
curl https://trackit.landryzetam.net/api/v2/workout/ \
-H "Authorization: Token YOUR_TOKEN"
Log weight:
curl -X POST https://trackit.landryzetam.net/api/v2/weightentry/ \
-H "Authorization: Token YOUR_TOKEN" \
-d "weight=75&date=2024-01-01"
Monitoring
Key Metrics
- Active users count
- Workout completions
- Database size growth
- API request rate
- Cache hit ratio
Health Checks
Application health:
curl https://trackit.landryzetam.net/api/v2/status/
Performance Monitoring
Cache statistics:
kubectl exec -n wger deployment/redis -- redis-cli info stats
Maintenance
Regular Tasks
Daily:
- Monitor exercise sync
- Check error logs
- Review registrations
Weekly:
- Backup database
- Clean old sessions
- Update exercises
Monthly:
- Review storage usage
- Update wger version
- Audit user accounts
Update Procedure
- Update Helm values:
# In release.yaml
spec:
chart:
spec:
version: "0.2.5" # New version
- Apply changes:
kubectl apply -f apps/base/wger/release.yaml
- Run migrations:
kubectl exec -n wger deployment/wger -- \
python manage.py migrate
Database Maintenance
Clean old data:
# Remove old guest accounts
kubectl exec -n wger deployment/wger -- \
python manage.py cleanup-guests --days=30
# Clean sessions
kubectl exec -n wger deployment/wger -- \
python manage.py clearsessions
Integration Examples
With Mobile Apps
Configure for app access:
# CORS settings
CORS_ALLOWED_ORIGINS:
- "capacitor://localhost"
- "http://localhost"
With Fitness Trackers
Import data via API:
import requests
# Import workout from fitness tracker
data = {
"date": "2024-01-01",
"exercises": [...],
"notes": "Imported from Garmin"
}
response = requests.post(
"https://trackit.landryzetam.net/api/v2/workout/",
headers={"Authorization": f"Token {token}"},
json=data
)
With Monitoring
Prometheus metrics:
# Add Django Prometheus
- name: django-prometheus
image: django-prometheus
ports:
- containerPort: 8001
Advanced Features
Meal Planning
Enable nutrition features:
environment:
- name: WGER_ENABLE_NUTRITION
value: "True"
Social Features
Enable sharing:
environment:
- name: WGER_ENABLE_SOCIAL
value: "True"
Custom Workflows
Celery tasks:
# Custom task for reminders
@shared_task
def send_workout_reminder():
# Send reminders for scheduled workouts
pass
Future Improvements
- Add OAuth2 authentication
- Implement mobile app notifications
- Create automated workout suggestions
- Add social features for gym buddies
- Integrate with wearable devices
- Add video workout guides
- Implement AI-powered form checking
- Create progress prediction models
- Add meal planning integration
- Implement coaching features