cmc/cleberg.net
My personal web garden & blog.
clone: git clone https://gitbay.org/cmc/cleberg.net.git
main: content/blog/2023-01-28-self-hosting-wger.org · raw
1#+date: [2023-01-28 Sat 00:00:00]
2#+title: Self-Hosting Guide: wger
3#+description: How to self-host wger, an open-source workout manager.
4#+slug: self-hosting-wger
5#+filetags: :linux:self-hosting:
6
7* Wger: The Self-Hosted Workout Manager
8
9[[https://wger.de][Wger Workout Manager]] is a fitness tracking tool for
10those who enjoy self-hosting their data. You can also register an
11account on their main website if you'd prefer to try without
12self-hosting.
13
14** Features
15
16I didn't see a full listing of features anywhere, so I compiled this
17list of my own after installing wger:
18
191. Dashboard
20
21 - Dashboard view of Workout Schedule, Nutrition Plan, Weight Graph, &
22 last 5 Weight Logs
23
242. Training
25
26 - Workout Log
27 - Workout Schedule
28 - Calendar (shows weight logs and Bad/Neutral/Good days)
29 - Gallery (shows images you upload)
30 - Workout templates
31 - Public templates
32 - Exercises
33
343. Nutrition
35
36 - Nutrition plans
37 - BMI calculator
38 - Daily calories calculator
39 - Ingredient overview
40
414. Body Weight
42
43 - Weight overview
44
45** Documentation
46
47In order to self-host wger, I opted to use the Docker version of the
48application. You can read the README within the
49[[https://github.com/wger-project/docker][wger-project/docker]] project
50on GitHub for information and installation instructions.
51
52** Installation
53
54To start the installation, I created a folder for wger and started
55creating the three necessary files:
56
57#+begin_src sh
58mkdir ~/wger && mkdir ~/wger/config
59touch ~/wger/docker-compose.yml && \
60touch ~/wger/config/prod.env && \
61touch ~/wger/config/nginx.conf
62#+end_src
63
64Once you have the folders and files created, you will need to copy the
65contents of the =docker-compose.yml=, =prod.env=, and =nginx.conf= from
66the GitHub link above.
67
68A few notes to explain the changes I made to the default files:
69
70- I updated the =ALLOW_REGISTRAION= variable in =prod.env= to =False=
71 after I created an account via my LAN connection, *before* I connected
72 this app to a publicly-available domain.
73- I uncommented and updated =CSRF_TRUSTED_ORIGINS= to be equal to the
74 public version of this app: =https://wger.example.com=.
75- I updated the port within =docker-compose.yml=, within the =nginx=
76 block. The port I updated this to will be reflected in my nginx
77 configuration file on the server (NOT the wger nginx.conf file).
78
79** Deploy
80
81Once all files are created and modified to your needs, simply start the
82container.
83
84#+begin_src sh
85docker-compose up -d
86#+end_src
87
88You can now visit the website on your LAN by going to
89=localhost:YOUR_PORT= or by the server's IP, if you're not on the same
90machine that is running the container.
91
92If you wish to connect this app to a public domain name, you'll need to
93point an =A= DNS record from the domain to your server's public IP.
94You'll then need to create a configuration file for whichever web server
95or reverse proxy you're using.
96
97Wger's README suggests the following reverse proxy configuration for
98Nginx:
99
100#+begin_src conf
101upstream wger {
102 # This port should match the port in the `nginx` block of docker-compose.yml
103 # If the container is running on this same machine, replace this with
104 # server 127.0.0.1:8080
105 server 123.456.789.0:8080;
106}
107
108server {
109 listen 80;
110 listen [::]:443 ssl;
111 listen 443 ssl;
112
113 location / {
114 proxy_pass http://wger;
115 proxy_set_header Host $http_host;
116 proxy_set_header X-Real-IP $remote_addr;
117 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
118 proxy_set_header X-Forwarded-Proto $scheme;
119 proxy_redirect off;
120 }
121
122 server_name my.domain.example.com;
123
124 ssl_certificate /path/to/https/certificate.crt;
125 ssl_certificate_key /path/to/https/certificate.key;
126}
127#+end_src
128
129* Thoughts on Wger
130
131I'm still playing around with the app itself, but it seems to be a solid
132all-around workout manager, weight log, and food log.
133
134I like that the weight log graph is fluid and updates quickly. You can
135also import or export data in CSV format if you'd like to move your data
136elsewhere.
137
138The workout manager is slightly odd, as it requires you to enter sets
139and reps for each exercise when you enter it into the plan. Then, when
140you add a log entry for performing a workout, you then add what you
141actually performed, in terms of reps and weight.
142
143I haven't tried the food log yet and I likely will not, at least for a
144while. I have no need for a food log or calorie tracker at the moment.