ref. wger
This commit is contained in:
parent
2c7a4cf8ba
commit
a58dfb0993
@ -1,71 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: hoholms
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/grafana/loki
|
|
||||||
|
|
||||||
APP="Alpine-Loki"
|
|
||||||
var_tags="${var_tags:-alpine;monitoring}"
|
|
||||||
var_cpu="${var_cpu:-1}"
|
|
||||||
var_ram="${var_ram:-256}"
|
|
||||||
var_disk="${var_disk:-1}"
|
|
||||||
var_os="${var_os:-alpine}"
|
|
||||||
var_version="${var_version:-3.22}"
|
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
|
||||||
|
|
||||||
header_info "$APP"
|
|
||||||
variables
|
|
||||||
color
|
|
||||||
catch_errors
|
|
||||||
|
|
||||||
function update_script() {
|
|
||||||
if ! apk -e info newt >/dev/null 2>&1; then
|
|
||||||
apk add -q newt
|
|
||||||
fi
|
|
||||||
LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
|
|
||||||
while true; do
|
|
||||||
CHOICE=$(
|
|
||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 3 \
|
|
||||||
"1" "Check for Loki Updates" \
|
|
||||||
"2" "Allow 0.0.0.0 for listening" \
|
|
||||||
"3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3
|
|
||||||
)
|
|
||||||
exit_status=$?
|
|
||||||
if [ $exit_status == 1 ]; then
|
|
||||||
clear
|
|
||||||
exit-script
|
|
||||||
fi
|
|
||||||
header_info
|
|
||||||
case $CHOICE in
|
|
||||||
1)
|
|
||||||
$STD apk -U upgrade
|
|
||||||
msg_ok "Updated successfully!"
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/loki
|
|
||||||
service loki restart
|
|
||||||
msg_ok "Allowed listening on all interfaces!"
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
3)
|
|
||||||
sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/loki
|
|
||||||
service loki restart
|
|
||||||
msg_ok "Allowed listening only on ${LXCIP}!"
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
start
|
|
||||||
build_container
|
|
||||||
description
|
|
||||||
|
|
||||||
msg_ok "Completed Successfully!\n"
|
|
||||||
echo -e "${APP} should be reachable by going to the following URL.
|
|
||||||
${BL}http://${IP}:3100${CL} \n"
|
|
||||||
echo -e "Promtail should be reachable by going to the following URL.
|
|
||||||
${BL}http://${IP}:9080${CL} \n"
|
|
||||||
65
ct/wger.sh
65
ct/wger.sh
@ -2,14 +2,14 @@
|
|||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: Slaviša Arežina (tremor021)
|
# Author: Slaviša Arežina (tremor021)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/wger-project/wger
|
# Source: https://github.com/wger-project/wger
|
||||||
|
|
||||||
APP="wger"
|
APP="wger"
|
||||||
var_tags="${var_tags:-management;fitness}"
|
var_tags="${var_tags:-management;fitness}"
|
||||||
var_cpu="${var_cpu:-1}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-1024}"
|
var_ram="${var_ram:-2048}"
|
||||||
var_disk="${var_disk:-6}"
|
var_disk="${var_disk:-8}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
@ -23,38 +23,45 @@ function update_script() {
|
|||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -d /home/wger ]]; then
|
|
||||||
|
if [[ ! -d /opt/wger ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -fsSL 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
|
if check_for_gh_release "wger" "wger-project/wger"; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop wger
|
systemctl stop apache2
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Updating $APP to v${RELEASE}"
|
msg_info "Backing up Data"
|
||||||
temp_file=$(mktemp)
|
cp -r /opt/wger/db /opt/wger_db_backup
|
||||||
curl -fsSL "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -o "$temp_file"
|
cp -r /opt/wger/media /opt/wger_media_backup
|
||||||
tar xzf "$temp_file"
|
cp -r /opt/wger/settings /opt/wger_settings_backup
|
||||||
cp -rf wger-"$RELEASE"/* /home/wger/src
|
msg_ok "Backed up Data"
|
||||||
cd /home/wger/src
|
|
||||||
$STD pip install -r requirements_prod.txt --ignore-installed
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "wger" "wger-project/wger" "tarball" "latest" "/opt/wger"
|
||||||
$STD pip install -e .
|
|
||||||
$STD python3 manage.py migrate
|
msg_info "Restoring Data"
|
||||||
$STD python3 manage.py collectstatic --no-input
|
cp -r /opt/wger_db_backup/. /opt/wger/db
|
||||||
$STD yarn install
|
cp -r /opt/wger_media_backup/. /opt/wger/media
|
||||||
$STD yarn build:css:sass
|
cp -r /opt/wger_settings_backup/. /opt/wger/settings
|
||||||
rm -rf "$temp_file"
|
rm -rf /opt/wger_db_backup /opt/wger_media_backup /opt/wger_settings_backup
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
msg_ok "Restored Data"
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
|
||||||
|
msg_info "Updating wger"
|
||||||
|
cd /opt/wger
|
||||||
|
$STD uv sync --no-dev
|
||||||
|
export DJANGO_SETTINGS_MODULE=settings.main
|
||||||
|
export PYTHONPATH=/opt/wger
|
||||||
|
$STD uv run python manage.py migrate
|
||||||
|
$STD uv run python manage.py collectstatic --no-input
|
||||||
|
msg_ok "Updated wger"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start wger
|
systemctl start apache2
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated Successfully"
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -63,7 +70,7 @@ start
|
|||||||
build_container
|
build_container
|
||||||
description
|
description
|
||||||
|
|
||||||
msg_ok "Completed successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||||
|
|||||||
@ -1,90 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: hoholms
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/grafana/loki
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Loki"
|
|
||||||
$STD apk add loki
|
|
||||||
$STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/loki
|
|
||||||
|
|
||||||
mkdir -p /var/lib/loki/{chunks,boltdb-shipper-active,boltdb-shipper-cache}
|
|
||||||
chown -R loki:grafana /var/lib/loki
|
|
||||||
mkdir -p /var/log/loki
|
|
||||||
chown -R loki:grafana /var/log/loki
|
|
||||||
|
|
||||||
cat <<EOF >/etc/loki/loki-local-config.yaml
|
|
||||||
auth_enabled: false
|
|
||||||
|
|
||||||
server:
|
|
||||||
http_listen_port: 3100
|
|
||||||
log_level: info
|
|
||||||
|
|
||||||
common:
|
|
||||||
instance_addr: 127.0.0.1
|
|
||||||
path_prefix: /var/lib/loki
|
|
||||||
storage:
|
|
||||||
filesystem:
|
|
||||||
chunks_directory: /var/lib/loki/chunks
|
|
||||||
rules_directory: /var/lib/loki/rules
|
|
||||||
replication_factor: 1
|
|
||||||
ring:
|
|
||||||
kvstore:
|
|
||||||
store: inmemory
|
|
||||||
|
|
||||||
schema_config:
|
|
||||||
configs:
|
|
||||||
- from: 2020-10-24
|
|
||||||
store: tsdb
|
|
||||||
object_store: filesystem
|
|
||||||
schema: v13
|
|
||||||
index:
|
|
||||||
prefix: index_
|
|
||||||
period: 24h
|
|
||||||
|
|
||||||
query_range:
|
|
||||||
results_cache:
|
|
||||||
cache:
|
|
||||||
embedded_cache:
|
|
||||||
enabled: true
|
|
||||||
max_size_mb: 100
|
|
||||||
|
|
||||||
limits_config:
|
|
||||||
metric_aggregation_enabled: true
|
|
||||||
|
|
||||||
ruler:
|
|
||||||
alertmanager_url: http://localhost:9093
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chown loki:grafana /etc/loki/loki-local-config.yaml
|
|
||||||
chmod 644 /etc/loki/loki-local-config.yaml
|
|
||||||
|
|
||||||
echo "output_log=\"\${output_log:-/var/log/loki/output.log}\"" >> /etc/init.d/loki
|
|
||||||
echo "error_log=\"\${error_log:-/var/log/loki/error.log}\"" >> /etc/init.d/loki
|
|
||||||
echo "start_stop_daemon_args=\"\${SSD_OPTS} -1 \${output_log} -2 \${error_log}\"" >> /etc/init.d/loki
|
|
||||||
|
|
||||||
$STD rc-update add loki default
|
|
||||||
$STD rc-service loki start
|
|
||||||
msg_ok "Installed Loki"
|
|
||||||
|
|
||||||
read -rp "Would you like to install Promtail? (y/N): " INSTALL_PROMTAIL
|
|
||||||
if [[ "${INSTALL_PROMTAIL,,}" =~ ^(y|yes)$ ]]; then
|
|
||||||
msg_info "Installing Promtail"
|
|
||||||
$STD apk add loki-promtail
|
|
||||||
$STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/loki-promtail
|
|
||||||
$STD rc-update add loki-promtail default
|
|
||||||
$STD rc-service loki-promtail start
|
|
||||||
msg_ok "Installed Promtail"
|
|
||||||
fi
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
# Author: Slaviša Arežina (tremor021)
|
# Author: Slaviša Arežina (tremor021)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/wger-project/wger
|
# Source: https://github.com/wger-project/wger
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
@ -14,48 +14,48 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt-get install -y \
|
||||||
git \
|
|
||||||
apache2 \
|
apache2 \
|
||||||
libapache2-mod-wsgi-py3
|
libapache2-mod-wsgi-py3
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Python"
|
|
||||||
$STD apt install -y python3-pip
|
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
|
||||||
msg_ok "Installed Python"
|
|
||||||
|
|
||||||
NODE_VERSION="22" NODE_MODULE="yarn,sass" setup_nodejs
|
NODE_VERSION="22" NODE_MODULE="yarn,sass" setup_nodejs
|
||||||
|
setup_uv
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "wger" "wger-project/wger" "tarball" "latest" "/opt/wger"
|
||||||
|
|
||||||
msg_info "Setting up wger"
|
msg_info "Setting up wger"
|
||||||
$STD adduser wger --disabled-password --gecos ""
|
mkdir -p /opt/wger/{db,static,media}
|
||||||
mkdir /home/wger/db
|
touch /opt/wger/db/database.sqlite
|
||||||
touch /home/wger/db/database.sqlite
|
chown :www-data -R /opt/wger/db
|
||||||
chown :www-data -R /home/wger/db
|
chmod g+w /opt/wger/db /opt/wger/db/database.sqlite
|
||||||
chmod g+w /home/wger/db /home/wger/db/database.sqlite
|
chmod o+w /opt/wger/media
|
||||||
mkdir /home/wger/{static,media}
|
cd /opt/wger
|
||||||
chmod o+w /home/wger/media
|
$STD uv sync --no-dev
|
||||||
temp_dir=$(mktemp -d)
|
mkdir -p /opt/wger/settings
|
||||||
cd "$temp_dir"
|
cat <<EOF >/opt/wger/settings/main.py
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
|
from wger.settings_global import *
|
||||||
curl -fsSL "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -o "$RELEASE.tar.gz"
|
|
||||||
tar xzf "$RELEASE".tar.gz
|
DATABASES = {
|
||||||
mv wger-"$RELEASE" /home/wger/src
|
'default': {
|
||||||
cd /home/wger/src
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
$STD pip install -r requirements_prod.txt --ignore-installed
|
'NAME': '/opt/wger/db/database.sqlite',
|
||||||
$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
|
MEDIA_ROOT = '/opt/wger/media'
|
||||||
$STD wger bootstrap
|
STATIC_ROOT = '/opt/wger/static'
|
||||||
$STD python3 manage.py collectstatic
|
EOF
|
||||||
rm -rf "$temp_dir"
|
touch /opt/wger/settings/__init__.py
|
||||||
echo "${RELEASE}" >/opt/wger_version.txt
|
export DJANGO_SETTINGS_MODULE=settings.main
|
||||||
msg_ok "Finished setting up wger"
|
export PYTHONPATH=/opt/wger
|
||||||
|
$STD uv run python manage.py migrate
|
||||||
|
$STD uv run python manage.py collectstatic --no-input
|
||||||
|
msg_ok "Set up wger"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/apache2/sites-available/wger.conf
|
cat <<EOF >/etc/apache2/sites-available/wger.conf
|
||||||
<Directory /home/wger/src>
|
<Directory /opt/wger>
|
||||||
<Files wsgi.py>
|
<Files wsgi.py>
|
||||||
Require all granted
|
Require all granted
|
||||||
</Files>
|
</Files>
|
||||||
@ -63,18 +63,20 @@ cat <<EOF >/etc/apache2/sites-available/wger.conf
|
|||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
WSGIApplicationGroup %{GLOBAL}
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
WSGIDaemonProcess wger python-path=/home/wger/src python-home=/home/wger
|
WSGIDaemonProcess wger python-path=/opt/wger python-home=/opt/wger/.venv
|
||||||
WSGIProcessGroup wger
|
WSGIProcessGroup wger
|
||||||
WSGIScriptAlias / /home/wger/src/wger/wsgi.py
|
WSGIScriptAlias / /opt/wger/wger/wsgi.py
|
||||||
WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
|
SetEnv DJANGO_SETTINGS_MODULE settings.main
|
||||||
|
SetEnv PYTHONPATH /opt/wger
|
||||||
|
|
||||||
Alias /static/ /home/wger/static/
|
Alias /static/ /opt/wger/static/
|
||||||
<Directory /home/wger/static>
|
<Directory /opt/wger/static>
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
Alias /media/ /home/wger/media/
|
Alias /media/ /opt/wger/media/
|
||||||
<Directory /home/wger/media>
|
<Directory /opt/wger/media>
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
@ -85,21 +87,6 @@ EOF
|
|||||||
$STD a2dissite 000-default.conf
|
$STD a2dissite 000-default.conf
|
||||||
$STD a2ensite wger
|
$STD a2ensite wger
|
||||||
systemctl restart apache2
|
systemctl restart apache2
|
||||||
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"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user