-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New Script: wger #2574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Script: wger #2574
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env bash | ||
source <(curl -s https://raw.githubusercontent.com/tremor021/ProxmoxVE/refs/heads/wger/misc/build.func) | ||
# Copyright (c) 2021-2025 community-scripts ORG | ||
# Author: Slaviša Arežina (tremor021) | ||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||
# Source: https://github.com/wger-project/wger | ||
|
||
APP="wger" | ||
var_tags="management;fitness" | ||
var_cpu="1" | ||
var_ram="1024" | ||
var_disk="6" | ||
var_os="debian" | ||
var_version="12" | ||
var_unprivileged="1" | ||
|
||
header_info "$APP" | ||
variables | ||
color | ||
catch_errors | ||
|
||
function update_script() { | ||
header_info | ||
check_container_storage | ||
check_container_resources | ||
if [[ ! -d /home/wger ]]; then | ||
msg_error "No ${APP} Installation Found!" | ||
exit | ||
fi | ||
RELEASE=$(curl -s https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') | ||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then | ||
msg_info "Stopping $APP" | ||
systemctl stop wger | ||
msg_ok "Stopped $APP" | ||
|
||
msg_info "Updating $APP to v${RELEASE}" | ||
temp_file=$(mktemp) | ||
cd $temp_file | ||
wget -q "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -O $temp_file | ||
tar xzf $temp_file | ||
cp -rf wger-$RELEASE/* /home/wger/src | ||
cd /home/wger/src | ||
python3 manage.py migrate &>/dev/null | ||
yarn install &>/dev/null | ||
yarn build:css:sass &>/dev/null | ||
python3 manage.py collectstatic --noinput &>/dev/null | ||
echo "${RELEASE}" >/opt/${APP}_version.txt | ||
msg_ok "Updated $APP to v${RELEASE}" | ||
|
||
msg_info "Starting $APP" | ||
systemctl start wger | ||
msg_ok "Started $APP" | ||
|
||
msg_info "Cleaning Up" | ||
rm -rf $temp_file | ||
msg_ok "Cleanup Completed" | ||
|
||
msg_ok "Update Successful" | ||
else | ||
msg_ok "No update required. ${APP} is already at v${RELEASE}" | ||
fi | ||
exit | ||
} | ||
|
||
start | ||
build_container | ||
description | ||
|
||
msg_ok "Completed Successfully!\n" | ||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" | ||
echo -e "${INFO}${YW} Access it using the following URL:${CL}" | ||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2021-2025 community-scripts ORG | ||
# Author: Slaviša Arežina (tremor021) | ||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||
# Source: https://github.com/wger-project/wger | ||
|
||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" | ||
color | ||
verb_ip6 | ||
catch_errors | ||
setting_up_container | ||
network_check | ||
update_os | ||
|
||
msg_info "Installing Dependencies" | ||
$STD apt-get install -y \ | ||
curl \ | ||
sudo \ | ||
mc \ | ||
git \ | ||
gnupg \ | ||
apache2 \ | ||
libapache2-mod-wsgi-py3 | ||
msg_ok "Installed Dependencies" | ||
|
||
msg_info "Installing Python" | ||
$STD apt-get install -y python3-pip | ||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED | ||
msg_ok "Installed Python" | ||
|
||
msg_info "Setting up Node.js Repository" | ||
mkdir -p /etc/apt/keyrings | ||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
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 | ||
msg_ok "Set up Node.js Repository" | ||
|
||
msg_info "Installing Node.js" | ||
$STD apt-get update | ||
$STD apt-get install -y nodejs | ||
$STD npm install -g yarn sass | ||
msg_ok "Installed Node.js" | ||
|
||
msg_info "Setting up wger" | ||
$STD adduser wger --disabled-password --gecos "" | ||
cat <<EOF >/etc/apache2/sites-available/wger.conf | ||
<Directory /home/wger/src> | ||
<Files wsgi.py> | ||
Require all granted | ||
</Files> | ||
</Directory> | ||
|
||
<VirtualHost *:80> | ||
WSGIApplicationGroup %{GLOBAL} | ||
WSGIDaemonProcess wger python-path=/home/wger/src python-home=/home/wger | ||
WSGIProcessGroup wger | ||
WSGIScriptAlias / /home/wger/src/wger/wsgi.py | ||
WSGIPassAuthorization On | ||
|
||
Alias /static/ /home/wger/static/ | ||
<Directory /home/wger/static> | ||
Require all granted | ||
</Directory> | ||
|
||
Alias /media/ /home/wger/media/ | ||
<Directory /home/wger/media> | ||
Require all granted | ||
</Directory> | ||
|
||
ErrorLog /var/log/apache2/wger-error.log | ||
CustomLog /var/log/apache2/wger-access.log combined | ||
</VirtualHost> | ||
EOF | ||
$STD a2dissite 000-default.conf | ||
$STD a2ensite wger | ||
systemctl restart apache2 | ||
tremor021 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mkdir /home/wger/db | ||
touch /home/wger/db/database.sqlite | ||
chown :www-data -R /home/wger/db | ||
chmod g+w /home/wger/db /home/wger/db/database.sqlite | ||
mkdir /home/wger/{static,media} | ||
chmod o+w /home/wger/media | ||
temp_dir=$(mktemp -d) | ||
cd $temp_dir | ||
RELEASE=$(curl -s https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') | ||
wget -q "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" | ||
tar xzf $RELEASE.tar.gz | ||
mv wger-$RELEASE /home/wger/src | ||
cd /home/wger/src | ||
$STD pip install -r requirements_prod.txt | ||
$STD pip install -e . | ||
$STD wger create-settings --database-path /home/wger/db/database.sqlite | ||
sed -i "s#home/wger/src/media#home/wger/media#g" /home/wger/src/settings.py | ||
sed -i "/MEDIA_ROOT = '\/home\/wger\/media'/a STATIC_ROOT = '/home/wger/static'" /home/wger/src/settings.py | ||
$STD wger bootstrap | ||
$STD python3 manage.py collectstatic | ||
echo "${RELEASE}" >/opt/wger_version.txt | ||
msg_ok "Finished setting up wger" | ||
|
||
msg_info "Creating Service" | ||
tremor021 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cat <<EOF >/etc/systemd/system/wger.service | ||
[Unit] | ||
Description=wger Service | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
ExecStart=/usr/local/bin/wger start -a 0.0.0.0 -p 3000 | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
systemctl enable -q --now wger | ||
msg_ok "Created Service" | ||
|
||
motd_ssh | ||
customize | ||
|
||
msg_info "Cleaning up" | ||
rm -rf $temp_dir | ||
$STD apt-get -y autoremove | ||
$STD apt-get -y autoclean | ||
msg_ok "Cleaned" | ||
|
||
motd_ssh | ||
customize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "wger", | ||
"slug": "wger", | ||
"categories": [ | ||
24 | ||
], | ||
"date_created": "2025-02-23", | ||
"type": "ct", | ||
"updateable": true, | ||
"privileged": false, | ||
"interface_port": 3000, | ||
"documentation": "https://wger.readthedocs.io/en/latest/index.html#", | ||
"website": "https://wger.de", | ||
"logo": "https://avatars.githubusercontent.com/u/17430347?s=48&v=4", | ||
"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.", | ||
"install_methods": [ | ||
{ | ||
"type": "default", | ||
"script": "ct/wger.sh", | ||
"resources": { | ||
"cpu": 1, | ||
"ram": 1024, | ||
"hdd": 6, | ||
"os": "debian", | ||
"version": "12" | ||
} | ||
} | ||
], | ||
"default_credentials": { | ||
"username": "admin", | ||
"password": "adminadmin" | ||
}, | ||
"notes": [] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.