Wger self-hosted on Raspberry Pi to plan and track workouts and progress

[ad_1]

Planning your fitness regimen is hard, and even harder to keep track of. Wger is a self-hosted web application that helps you track your goals, increase your mass, assess your biceps, and design your diet. It’s easy to set up and comes with mobile apps to sync your progress across devices.

Why self-host an exercise tracking web app on a Raspberry Pi?

A muscular man wearing a Superman jacket doing sports.

If you’re serious about gaining muscle, losing weight, or improving your body’s performance and aesthetics, it’s important to have a plan and keep a record.

You need to know what goes into your body, the vital calories it consumes as fuel; You need to make sure that your workouts are balanced and effective. Equally important is measuring the effects of your workouts and diet. Are your thighs thicker? Are the buttock muscles firmer? Is your weight moving in the desired direction?

There are dozens of apps that will help you track and record these factors. However, most of them contain ads and are based on either a subscription-based payment option or using the freemium model, with some features only working if you pay a one-time amount. Almost all of them collect your data, so advertising companies may track you even if you are tracking your muscle mass.

Another solution is to keep accurate records of your diet and workouts in an Excel spreadsheet.

Wger is a complete workout manager that you can host on your Raspberry Pi. It’s free and open source, which means you can modify or distribute it as you see fit. There are no locked features behind paywalls, and because it works on devices you own, you can be sure that no one is tracking you either.

Wger is a fairly heavy app, so we’d suggest a Raspberry Pi 4B if you have one available.

Follow our guide to setting up your Raspberry Pi as a web server, then connect to your Pi using Secure Shell (SSH).

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

 git clone https: 

Switch to the new directory, and then use the nano text editor to open the Docker Compose file:

 cd wger
nano docker-compose.yml

As of this writing, the Docker Compose file does not have a version directive at the top of the file. This means if you try to bring up Docker Compose it won’t work and you will get the following errors:

Unsupported network configuration option: “Default”.

Services unsupported configuration option: ‘nginx

Unsupported configuration option for volumes: ‘postgres-data

You will need to select the version of Docker Compose. It is necessary to use a version earlier than version 3, because some of the syntax support used in the Docker Compose wger ​​file was removed in version 3 of the Docker Compose specification and then reintroduced in version 3.9 – it is not currently available for Raspberry PiOS. If you select version 3.7, for example, you’ll see this error message or similar messages:

services.web.depends_on has an invalid type, it should be an array.

We found that the most reliable version of Docker Compose to run wger ​​was 2.2. Insert the following line at the beginning of the Docker Compose file:

 version: '2.2' 

Nginx is included in wger’s Docker Compose file, and wger ​​needs it to work. By default, Nginx listens on port 80. However, if you use your Pi to host other sites and services and you followed our guide to configure it as a server, you already have Apache listening on port 80, scroll down the page to the tab nginx And find the next line Ports: who reads 80:80. Change this to:

 81:80 

Save and exit nano with CTRL+O and then CTRL + X. Show Docker Compose in detached mode:

 docker-compose up -d 

… and wait while Docker Compose downloads the images and configures the necessary containers. When the process is complete, run:

 docker-compose ps 

…to see the condition of the containers. Each of them must have the status “Top (Healthy)”.

docker-compose ps output is in cool retro term

You can now visit your wger ​​instance at Your local IP address: 81. You’ll see an inspiring background image of a group of tightly clenched arms dropping dumbbells in a haze of sweat drops and chalk dust, but you won’t be able to register or log in.

To use the domain name for wger ​​access, visit the 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, go to the file sites available And use nano to create a new configuration file:

 cd /etc/apache2/sites-available
sudo nano wger.conf

In the new file, paste:

 <VirtualHost *:80>
ServerName your-domain.tld
ProxyPass / http:
ProxyPassReverse / http:/127.0.0.1:81/
ProxyPreserveHost On
VirtualHost>

Save and exit nano with CTRL+Oand then CTRL + X. Activate the configuration, then restart Apache:

 sudo a2ensite wger.conf
sudo service apache2 restart

You can now visit your wger ​​instance using your domain name from any browser. Click the button Memorizes at the top of the page, and enter your name, email address, and password. Do nothing else, or you’ll get an error message that reads:

CSRF validation failed. Abandonment request

This is because wger ​​uses Django as its database, and requires trusted sources to be defined in a separate environment file.

wger environment file in nano

Lower your containers, then use nano to open this file:

 docker-compose down
nano config/prod.env

Set the From address for emails, and set your timezone. Now find a line that starts with:

 CSRF_TRUSTED_ORIGINS 

Edit it to contain your web addresses, as well as the Pi’s loopback address, then uncomment the following line:

 X_FORWARDED_PROTO_HEADER_SET=True 

If you don’t want random people on the internet accessing your wger ​​instance to track their workouts, scroll down to the “application” section, and set:

 ALLOW_REGISTRATION=False
ALLOW_GUEST_USERS=False

Save and exit nano with CTRL+Oand then CTRL + X.

The last thing you need to do is configure TLS certificates and encryption keys to ensure that snoopers can’t use a man-in-the-middle (MITM) attack to intercept your traffic.

 sudo certbot 

Select your domain name from the list, and Certbot will fetch and publish your TLS certificates and encryption keys. Restart Apache again 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 your Raspberry Pi to manage your fitness

Woman squatting with dumbbells

After all that hard work on the keyboard, you’re almost ready to hit the gym! Sign into your account using the credentials you provided earlier, and you’ll see a blank dashboard with three sections: “Exercise,” “Nutrition Plan,” and “Weight.” It is up to you to enter the data in each of them, using the green buttons at the bottom of each column.

wger dashboard

You can either create entries manually or click on each category’s menu bar at the top of each page and import a CSV file with your data.

menu exercise It contains everything related to your workouts, including schedules, calendar, gallery, and more. Click on drillsthen Add a training session. Give your workout a name, then check the boxes to mark the days you want to do it. Once you click To maintainYou will be able to add specific exercises to your training program. When you type in the box, you’ll see suggestions that contain that text.

wger suggestions for crunch exercise

When selecting exercises, you can use the slider to set the number of repetitions and add details such as the respective weights. Save the exercise and you will see a summary, with the muscle groups to be trained marked in red. You can add notes to any exercise by clicking on the gear and selecting New Weight Diary.

wger workout example

Under feedYou can check your BMI, create nutrition plans and calculate your daily calories. No need to search for ingredients: you choose your daily meals from over 78,000 products and see the nutritional values. Add meals to the nutrition plan and keep an overview of your diet on the calendar.

Track your workouts on the go

Few people take a laptop to the gym, and while it displays fine in most browsers, it works even better if you use the wger ​​app specifically 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 select Use a dedicated server. Enter your username and password, then enter your server URL.

The wger ​​mobile app works like the web app. You can access your training records, 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 want to plan serious workouts and diets without selling your data to third parties. If this does not apply to you, consider one of the many commercial offers available in mobile app stores.

[ad_2]

Source link


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *