Skip to content

Commit 1887129

Browse files
authored
New Script: wger (#2574)
* Add wger script * fixes * fixes v2 * fix json * Moved Apache config
1 parent 0e5be84 commit 1887129

File tree

3 files changed

+234
-0
lines changed

3 files changed

+234
-0
lines changed

ct/wger.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/tremor021/ProxmoxVE/refs/heads/wger/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/wger-project/wger
7+
8+
APP="wger"
9+
var_tags="management;fitness"
10+
var_cpu="1"
11+
var_ram="1024"
12+
var_disk="6"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /home/wger ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
RELEASE=$(curl -s https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
31+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
32+
msg_info "Stopping $APP"
33+
systemctl stop wger
34+
msg_ok "Stopped $APP"
35+
36+
msg_info "Updating $APP to v${RELEASE}"
37+
temp_file=$(mktemp)
38+
cd $temp_file
39+
wget -q "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -O $temp_file
40+
tar xzf $temp_file
41+
cp -rf wger-$RELEASE/* /home/wger/src
42+
cd /home/wger/src
43+
python3 manage.py migrate &>/dev/null
44+
yarn install &>/dev/null
45+
yarn build:css:sass &>/dev/null
46+
python3 manage.py collectstatic --noinput &>/dev/null
47+
echo "${RELEASE}" >/opt/${APP}_version.txt
48+
msg_ok "Updated $APP to v${RELEASE}"
49+
50+
msg_info "Starting $APP"
51+
systemctl start wger
52+
msg_ok "Started $APP"
53+
54+
msg_info "Cleaning Up"
55+
rm -rf $temp_file
56+
msg_ok "Cleanup Completed"
57+
58+
msg_ok "Update Successful"
59+
else
60+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
61+
fi
62+
exit
63+
}
64+
65+
start
66+
build_container
67+
description
68+
69+
msg_ok "Completed Successfully!\n"
70+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
71+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
72+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/wger-install.sh

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/wger-project/wger
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
git \
22+
gnupg \
23+
apache2 \
24+
libapache2-mod-wsgi-py3
25+
msg_ok "Installed Dependencies"
26+
27+
msg_info "Installing Python"
28+
$STD apt-get install -y python3-pip
29+
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
30+
msg_ok "Installed Python"
31+
32+
msg_info "Setting up Node.js Repository"
33+
mkdir -p /etc/apt/keyrings
34+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
35+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
36+
msg_ok "Set up Node.js Repository"
37+
38+
msg_info "Installing Node.js"
39+
$STD apt-get update
40+
$STD apt-get install -y nodejs
41+
$STD npm install -g yarn sass
42+
msg_ok "Installed Node.js"
43+
44+
msg_info "Setting up wger"
45+
$STD adduser wger --disabled-password --gecos ""
46+
mkdir /home/wger/db
47+
touch /home/wger/db/database.sqlite
48+
chown :www-data -R /home/wger/db
49+
chmod g+w /home/wger/db /home/wger/db/database.sqlite
50+
mkdir /home/wger/{static,media}
51+
chmod o+w /home/wger/media
52+
temp_dir=$(mktemp -d)
53+
cd $temp_dir
54+
RELEASE=$(curl -s https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
55+
wget -q "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz"
56+
tar xzf $RELEASE.tar.gz
57+
mv wger-$RELEASE /home/wger/src
58+
cd /home/wger/src
59+
$STD pip install -r requirements_prod.txt
60+
$STD pip install -e .
61+
$STD wger create-settings --database-path /home/wger/db/database.sqlite
62+
sed -i "s#home/wger/src/media#home/wger/media#g" /home/wger/src/settings.py
63+
sed -i "/MEDIA_ROOT = '\/home\/wger\/media'/a STATIC_ROOT = '/home/wger/static'" /home/wger/src/settings.py
64+
$STD wger bootstrap
65+
$STD python3 manage.py collectstatic
66+
echo "${RELEASE}" >/opt/wger_version.txt
67+
msg_ok "Finished setting up wger"
68+
69+
msg_info "Creating Service"
70+
cat <<EOF >/etc/apache2/sites-available/wger.conf
71+
<Directory /home/wger/src>
72+
<Files wsgi.py>
73+
Require all granted
74+
</Files>
75+
</Directory>
76+
77+
<VirtualHost *:80>
78+
WSGIApplicationGroup %{GLOBAL}
79+
WSGIDaemonProcess wger python-path=/home/wger/src python-home=/home/wger
80+
WSGIProcessGroup wger
81+
WSGIScriptAlias / /home/wger/src/wger/wsgi.py
82+
WSGIPassAuthorization On
83+
84+
Alias /static/ /home/wger/static/
85+
<Directory /home/wger/static>
86+
Require all granted
87+
</Directory>
88+
89+
Alias /media/ /home/wger/media/
90+
<Directory /home/wger/media>
91+
Require all granted
92+
</Directory>
93+
94+
ErrorLog /var/log/apache2/wger-error.log
95+
CustomLog /var/log/apache2/wger-access.log combined
96+
</VirtualHost>
97+
EOF
98+
$STD a2dissite 000-default.conf
99+
$STD a2ensite wger
100+
systemctl restart apache2
101+
cat <<EOF >/etc/systemd/system/wger.service
102+
[Unit]
103+
Description=wger Service
104+
After=network.target
105+
106+
[Service]
107+
Type=simple
108+
User=root
109+
ExecStart=/usr/local/bin/wger start -a 0.0.0.0 -p 3000
110+
Restart=always
111+
112+
[Install]
113+
WantedBy=multi-user.target
114+
EOF
115+
systemctl enable -q --now wger
116+
msg_ok "Created Service"
117+
118+
motd_ssh
119+
customize
120+
121+
msg_info "Cleaning up"
122+
rm -rf $temp_dir
123+
$STD apt-get -y autoremove
124+
$STD apt-get -y autoclean
125+
msg_ok "Cleaned"
126+
127+
motd_ssh
128+
customize

json/wger.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "wger",
3+
"slug": "wger",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-02-23",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3000,
12+
"documentation": "https://wger.readthedocs.io/en/latest/index.html#",
13+
"website": "https://wger.de",
14+
"logo": "https://avatars.githubusercontent.com/u/17430347?s=48&v=4",
15+
"description": "wger (ˈvɛɡɐ) Workout Manager is a free, open source web application that helps you manage your personal workouts, weight and diet plans and can also be used as a simple gym management utility. It offers a REST API as well, for easy integration with other projects and tools.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/wger.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 1024,
23+
"hdd": 6,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "admin",
31+
"password": "adminadmin"
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)