Self-Host Wger on Raspberry Pi to Plan and Track Your Workouts and Gains
Planning your fitness regime is hard, and keeping track of it is harder. Wger is a self-hosted web app to help you track your targets, maximize your mass, benchmark your biceps, and devise your diet. It’s simple to set up and comes with mobile apps to sync your progress across devices.
Why Self-Host a Workout Tracking Web App on Raspberry Pi?
If you’re serious about gaining muscle, losing weight, or otherwise improving your body’s performance and aesthetic, it’s important to make a plan and keep a plan and keep records.
You need to know what goes into your body, and the vital calories it’s consuming as fuel; you need to make sure that your workouts are balanced and effective. Just as importantly, you need to measure what effects your workouts and diets are having. Are your thighs thicker? Your glutes tighter? Is your weight moving in the direction you want it to?
There are dozens of apps which will help you to track and record these factors. Most, however, contain adverts, and are either based on a subscription payment option, or use the freemium model, with certain features non-functional unless you pay a one-off fee. Almost all of them harvest your data, so you can be tracked by advertising companies even as you track your muscle mass.
Another alternative is to keep meticulous records of your diet and workouts in an Excel spreadsheet.
Wger is a fully featured workout manager which you can self-host on your Raspberry Pi. It’s free and open source, meaning that you can modify it or distribute it in any way you choose. There are no features locked behind paywalls and because it’s running on hardware you own, you can be sure that nobody’s tracking you either.
How to Install Wger Workout Manager on Your Raspberry Pi
Wger is a fairly beefy application, so we’d suggest that you use a Raspberry Pi 4B if there’s one available to you.
Follow our guide to set up your Raspberry Pi as a web server, then connect to the Pi using Secure Shell (SSH).
Update and upgrade all packages, then clone the wger GitHub repository to a new directory:
git clone https:
Change into the new directory, then use the nano text editor to open the Docker Compose file:
At the time of writing, the Docker Compose file lacks a version directive at the top of the file. This means that if you attempt to bring up Docker Compose, it won’t work, and you’ll see the following errors:
Unsupported config option for networks: ‘default‘
Unsupported config option for services: ‘nginx‘
Unsupported config option for volumes: ‘postgres-data‘
You will need to specify a version of Docker Compose. It’s essential to use a version prior to version 3, as certain syntax support used in the wger Docker Compose file was removed in version 3 of the Docker Compose specification, but then reintroduced in version 3.9—which is currently unavailable for Raspberry Pi OS. If you specify version 3.7, for instance, you will see this or similar error messages:
services.web.depends_on contains an invalid type, it should be an array
We found that the most reliable Docker Compose version to get wger working was 2.2. Insert the following line at the very start of your Docker Compose file:
Nginx is included in the wger Docker Compose file, and wger requires it to function. By default, Nginx listens on port 80. However, if you’re using your Pi to host other sites and services and followed our guide to setting it up as a server, you already have Apache listening on port 80. Scroll down to the nginx section, and find the line below ports: which reads 80:80. Change this to:
Save and exit nano with Ctrl + O then Ctrl + X. Bring up Docker Compose in detached mode:
docker-compose up -d
…and wait while Docker Compose downloads images and sets up the necessary containers. When the process is complete, run:
…to see the status of the containers. Each one should have the status “Up (healthy)”.
You can now visit your wger instance at your-pi-local-ip-address:81. You’ll see an inspiring background image of a heavily muscled set of arms releasing a barbell in a haze of sweat droplets and chalk dust, but you won’t be able to register or log in.
To use a domain name to access wger, visit your registrar’s DNS page and create a new “A” record. Set the host to “@”, and the value to your public IP address.
Back in the terminal, navigate to Apache’s sites-available directory, and use nano to create a new configuration file:
sudo nano wger.conf
In the new file, paste:
ProxyPass / http:
ProxyPassReverse / http:/127.0.0.1:81/
Save and exit nano with Ctrl + O, then Ctrl + X. Activate the config, then restart Apache:
sudo a2ensite wger.conf
sudo service apache2 restart
You can now visit your wger instance with your domain name from any browser. Hit the Register button at the top of the page, and enter your name, email address, and password. Don’t do anything else, or you will receive an error message which reads:
CSRF verification failed. Request aborted
This is because wger uses Django as a database, and requires trusted sources to be defined in a separate environment file.
Bring down your containers, then use nano to open this file:
Set the “from” address for emails, and adjust your timezone. Now look for a line which begins:
Change this so it contains your web addresses, as well as the Pi’s loopback address, then uncomment the following line:
If you don’t want random people on the internet accessing your wger instance to track their workouts, scroll down further to the “Application” section, and set:
Save and exit nano with Ctrl + O, then Ctrl + X.
The final thing to do is to set up TLS certificates and encryption keys to ensure that snoopers can’t use a man-in-the-middle (MITM) atack to intercept your traffic.
Select your domain name from the list, and Certbot will fetch and deploy TLS certificates and encryption keys. Restart Apache once more for the changes to take effect:
sudo service apache2 restart
Any connection to your wger workout site will be upgraded to HTTPS.
Use Wger on Raspberry Pi to Manage Your Fitness
After all that hard work with the keyboard, you’re almost ready to hit the gym! Log in to your account using the credentials you supplied earlier, and you’ll see an empty dashboard with three sections: “Workout”, “Nutrition Plan”, and “Weight”. It’s up to you to enter the data into each of these, using the green buttons at the bottom of each column.
You can either create entries manually, or click on the menu bar for each category at the top of each page and import a CSV file with your data.
The menu for Training contains everything to do with your workouts, including schedules, calendar, gallery, and more. Click on Workouts, then Add Workout. Give a name to your workout then mark the checkboxes to select the days you want to do it. Once you click Save, you’ll be able to add specific exercises to your workout routine. As you type into the box, you’ll see suggestions appearing which contain this text.
When you’ve selected the exercises, you can use a slider to set the number of reps, and add in details such as the weights involved. Save the workout and you’ll see a summary, with the muscle groups to be trained highlighted in red. You can add notes to any workout session by clicking on the cog and selecting New weight log.
Under Nutrition, you can check your BMI, create nutrition plans, and calculate your daily calorie intake. There’s no need to search for ingredients: you choose your daily meals from more than 78,000 products and see the nutritional values. Add meals to the nutritional plan and keep an overview of your diet in the calendar.
Track Your Workouts on the Go
Not many people take a laptop to the gym, and although wger displays well through most browsers, it works better if you use the dedicated wger app for Android. The app is also available on Google Play.
After installing the app on your Android device, open it in the usual way and choose Use custom server. Input your username and password, then enter the URL of your server.
The wger mobile app works the same as the web app. You can access your training logs, add workouts, and enter your meal plans.
Install Wger on Your Raspberry Pi: Success
Wger is the perfect solution if you care about privacy, and you want to plan serious workouts and diets without your data being sold to third parties. If this doesn’t concern you, consider one of the many commercial offerings available on mobile app stores.