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.

Sign up forfree

Forgot your password?

Create an account

*Required: 8 chars, 1 capital letter, 1 number

By continuing, you agree to thePrivacy PolicyandTerms of Use.You also agree to receive our newsletters, you can opt-out any time.

4

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?

heavily muscled woman exercising

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 meticulousrecords of your diet and workouts in an Excel spreadsheet.

article limit background

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 aRaspberry Pi 4Bif there’s one available to you.

Follow our guide toset up your Raspberry Pi as a web server, thenconnect to the Pi using Secure Shell(SSH).

heavily muscled guy in a superman vest doing exercise

Update and upgrade all packages, then clone the wger GitHub repository to a new directory:

Change into the new directory, then use the nano text editor to open the Docker Compose file:

output of docker-compose ps in cool retro term

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 thenginxsection, and find the line belowports:which reads80:80. Change this to:

Save and exit nano withCtrl + OthenCtrl + X. Bring up Docker Compose in detached mode:

…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 atyour-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’ssites-availabledirectory, and use nano to create a new configuration file:

In the new file, paste:

Save and exit nano withCtrl + O, thenCtrl + X. Activate the config, then restart Apache:

you may now visit your wger instance with your domain name from any browser. Hit theRegisterbutton 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 withCtrl + O, thenCtrl + X.

The final thing to do is to set up TLS certificates and encryption keys to ensure that snoopers can’t use aman-in-the-middle (MITM) atackto 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:

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 forTrainingcontains everything to do with your workouts, including schedules, calendar, gallery, and more. Click onWorkouts, thenAdd Workout. Give a name to your workout then mark the checkboxes to select the days you want to do it. Once you clickSave, 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 selectingNew weight log.

UnderNutrition, you may 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 dedicatedwger app for Android. The app is also available onGoogle Play.

After installing the app on your Android device, open it in the usual way and chooseUse 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.

Love fades, even for the best open-source darling.

My foolproof plan is to use Windows 10 until 2030, with the latest security updates.

Not Linux, not Windows. Something better.

Every squeak is your PC’s way of crying for help.

It’s not super flashy, but it can help to keep your computer up and running.

You’ve been quoting these famous films wrong all along!

Technology Explained

PC & Mobile