Merge branch 'main' into bug/fix_DiscoPanelUpdate

This commit is contained in:
DragoQC 2025-12-05 15:49:41 -05:00 committed by GitHub
commit 14c255ea51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 299 additions and 742 deletions

View File

@ -29,6 +29,8 @@ function update_script() {
exit
fi
setup_docker
if check_for_gh_release "discopanel" "nickheyer/discopanel"; then
msg_info "Stopping Service"
systemctl stop discopanel
@ -45,6 +47,7 @@ function update_script() {
msg_ok "Created Backup"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "discopanel" "nickheyer/discopanel" "tarball" "latest" "/opt/discopanel"
msg_info "Setting up DiscoPanel"
cd /opt/discopanel/web/discopanel
$STD npm install

View File

@ -1,83 +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: johanngrobe
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/joaovitoriasilva/endurain
APP="Endurain"
var_tags="${var_tags:-sport;social-media}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-5}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/endurain ]]; then
msg_error "No ${APP} installation found!"
exit 1
fi
if check_for_gh_release "endurain" "joaovitoriasilva/endurain"; then
msg_info "Stopping Service"
systemctl stop endurain
msg_ok "Stopped Service"
msg_info "Creating Backup"
cp /opt/endurain/.env /opt/endurain.env
cp /opt/endurain/frontend/app/dist/env.js /opt/endurain.env.js
msg_ok "Created Backup"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain"
msg_info "Preparing Update"
cd /opt/endurain
rm -rf \
/opt/endurain/{docs,example.env,screenshot_01.png} \
/opt/endurain/docker* \
/opt/endurain/*.yml
cp /opt/endurain.env /opt/endurain/.env
rm /opt/endurain.env
msg_ok "Prepared Update"
msg_info "Updating Frontend"
cd /opt/endurain/frontend/app
$STD npm ci
$STD npm run build
cp /opt/endurain.env.js /opt/endurain/frontend/app/dist/env.js
rm /opt/endurain.env.js
msg_ok "Updated Frontend"
msg_info "Updating Backend"
cd /opt/endurain/backend
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
$STD uv venv
$STD uv pip install -r requirements.txt
msg_ok "Backend Updated"
msg_info "Starting Service"
systemctl start endurain
msg_ok "Started Service"
msg_ok "Update Completed Successfully!"
fi
exit 0
}
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}:8080${CL}"

View File

@ -1,40 +0,0 @@
{
"name": "Endurain",
"slug": "endurain",
"categories": [
24
],
"date_created": "2025-11-23",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8080,
"documentation": "https://docs.endurain.com/",
"website": "https://github.com/joaovitoriasilva/endurain",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/endurain.webp",
"config_path": "/opt/endurain/.env",
"description": "Endurain is a self-hosted fitness tracking service designed to give users full control over their data and hosting environment. It's similar to Strava but focused on privacy and customization",
"install_methods": [
{
"type": "default",
"script": "ct/endurain.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 5,
"os": "debian",
"version": "13"
}
}
],
"default_credentials": {
"username": "admin",
"password": "admin"
},
"notes": [
{
"text": "When using a reverse proxy, edit `/opt/endurain/frontend/app/dist/env.js`.",
"type": "info"
}
]
}

View File

@ -19,13 +19,7 @@ msg_ok "Installed Dependencies"
NODE_VERSION="22" setup_nodejs
setup_go
fetch_and_deploy_gh_release "discopanel" "nickheyer/discopanel" "tarball" "latest" "/opt/discopanel"
msg_info "Installing Docker"
DOCKER_CONFIG_PATH='/etc/docker/daemon.json'
mkdir -p $(dirname $DOCKER_CONFIG_PATH)
echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json
$STD sh <(curl -fsSL https://get.docker.com)
msg_ok "Installed Docker"
setup_docker
msg_info "Setting up DiscoPanel"
cd /opt/discopanel/web/discopanel

View File

@ -1,122 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: johanngrobe
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/joaovitoriasilva/endurain
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
default-libmysqlclient-dev \
build-essential \
pkg-config
msg_ok "Installed Dependencies"
PYTHON_VERSION="3.13" setup_uv
NODE_VERSION="24" setup_nodejs
PG_VERSION="17" PG_MODULES="postgis" setup_postgresql
PG_DB_NAME="enduraindb" PG_DB_USER="endurain" setup_postgresql_db
fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain"
msg_info "Setting up Endurain"
cd /opt/endurain
rm -rf \
/opt/endurain/{docs,example.env,screenshot_01.png} \
/opt/endurain/docker* \
/opt/endurain/*.yml
mkdir -p /opt/endurain_data/{data,logs}
SECRET_KEY=$(openssl rand -hex 32)
FERNET_KEY=$(openssl rand -base64 32)
IP=$(hostname -I | awk '{print $1}')
ENDURAIN_HOST=http://${IP}:8080
cat <<EOF >/opt/endurain/.env
DB_PASSWORD=${PG_DB_PASS}
SECRET_KEY=${SECRET_KEY}
FERNET_KEY=${FERNET_KEY}
TZ=Europe/Berlin
ENDURAIN_HOST=${ENDURAIN_HOST}
BEHIND_PROXY=false
POSTGRES_DB=${PG_DB_NAME}
POSTGRES_USER=${PG_DB_USER}
PGDATA=/var/lib/postgresql/${PG_DB_NAME}
DB_DATABASE=${PG_DB_NAME}
DB_USER=${PG_DB_USER}
DB_PORT=5432
DB_HOST=localhost
DATABASE_URL=postgresql+psycopg://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
BACKEND_DIR="/opt/endurain/backend/app"
FRONTEND_DIR="/opt/endurain/frontend/app/dist"
DATA_DIR="/opt/endurain_data/data"
LOGS_DIR="/opt/endurain_data/logs"
#SMTP_HOST=smtp.protonmail.ch
#SMTP_PORT=587
#SMTP_USERNAME=your-email@example.com
#SMTP_PASSWORD=your-app-password
#SMTP_SECURE=true
#SMTP_SECURE_TYPE=starttls
EOF
msg_ok "Setup Endurain"
msg_info "Building Frontend"
cd /opt/endurain/frontend/app
$STD npm ci --prefer-offline
$STD npm run build
cat <<EOF >/opt/endurain/frontend/app/dist/env.js
window.env = {
ENDURAIN_HOST: "${ENDURAIN_HOST}"
}
EOF
msg_ok "Built Frontend"
msg_info "Setting up Backend"
cd /opt/endurain/backend
$STD uv tool install poetry
$STD uv tool update-shell
export PATH="/root/.local/bin:$PATH"
$STD poetry self add poetry-plugin-export
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
$STD uv venv
$STD uv pip install -r requirements.txt
msg_ok "Setup Backend"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/endurain.service
[Unit]
Description=Endurain FastAPI Backend
After=network.target postgresql.service
[Service]
WorkingDirectory=/opt/endurain/backend/app
EnvironmentFile=/opt/endurain/.env
ExecStart=/opt/endurain/backend/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 8080
Restart=always
RestartSec=5
User=root
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now endurain
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc

View File

@ -904,7 +904,9 @@ EOF
fi
# Create update script
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/${app}.sh)\"" >/usr/bin/update
# Use var_os for OS-based containers, otherwise use app name
local update_script_name="${var_os:-$app}"
echo "bash -c \"\$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/ct/${update_script_name}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update
# Inject SSH authorized keys if provided

View File

@ -4805,7 +4805,6 @@ function setup_docker() {
# Cleanup old repository configurations
if [ -f /etc/apt/sources.list.d/docker.list ]; then
msg_info "Migrating from old Docker repository format"
rm -f /etc/apt/sources.list.d/docker.list
rm -f /etc/apt/keyrings/docker.asc
fi
@ -4819,6 +4818,7 @@ function setup_docker() {
"$(get_os_info codename)" \
"stable" \
"$(dpkg --print-architecture)"
msg_ok "Set up Docker Repository"
# Install or upgrade Docker
if [ "$docker_installed" = true ]; then
@ -4826,7 +4826,8 @@ function setup_docker() {
DOCKER_LATEST_VERSION=$(apt-cache policy docker-ce | grep Candidate | awk '{print $2}' | cut -d':' -f2 | cut -d'-' -f1)
if [ "$DOCKER_CURRENT_VERSION" != "$DOCKER_LATEST_VERSION" ]; then
msg_info "Updating Docker $DOCKER_CURRENT_VERSION → $DOCKER_LATEST_VERSION"
msg_ok "Docker update available ($DOCKER_CURRENT_VERSION → $DOCKER_LATEST_VERSION)"
msg_info "Updating Docker"
$STD apt install -y --only-upgrade \
docker-ce \
docker-ce-cli \
@ -4872,7 +4873,8 @@ EOF
PORTAINER_LATEST=$(curl -fsSL https://registry.hub.docker.com/v2/repositories/portainer/portainer-ce/tags?page_size=100 | grep -oP '"name":"\K[0-9]+\.[0-9]+\.[0-9]+"' | head -1 | tr -d '"')
if [ "$PORTAINER_CURRENT" != "$PORTAINER_LATEST" ]; then
read -r -p "${TAB3}Update Portainer $PORTAINER_CURRENT → $PORTAINER_LATEST? <y/N> " prompt
msg_ok "Portainer update available ($PORTAINER_CURRENT → $PORTAINER_LATEST)"
read -r -p "${TAB3}Update Portainer? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Updating Portainer"
docker stop portainer
@ -4887,6 +4889,8 @@ EOF
-v portainer_data:/data \
portainer/portainer-ce:latest
msg_ok "Updated Portainer to $PORTAINER_LATEST"
else
msg_ok "Skipped Portainer update"
fi
else
msg_ok "Portainer is up-to-date ($PORTAINER_CURRENT)"
@ -4934,6 +4938,7 @@ EOF
done < <(docker ps --format '{{.Names}} {{.Image}}')
if [ ${#containers_with_updates[@]} -gt 0 ]; then
msg_ok "Found ${#containers_with_updates[@]} container(s) with updates"
echo ""
echo "${TAB3}Container updates available:"
for info in "${container_info[@]}"; do
@ -4962,6 +4967,8 @@ EOF
msg_ok "Stopped and removed $container (please recreate with updated image)"
fi
done
else
msg_ok "Skipped container updates"
fi
else
msg_ok "All containers are up-to-date"

File diff suppressed because it is too large Load Diff

6
vm/headers/docker-vm Normal file
View File

@ -0,0 +1,6 @@
____ __ _ ____ ___
/ __ \____ _____/ /_____ _____ | | / / |/ /
/ / / / __ \/ ___/ //_/ _ \/ ___/ | | / / /|_/ /
/ /_/ / /_/ / /__/ ,< / __/ / | |/ / / / /
/_____/\____/\___/_/|_|\___/_/ |___/_/ /_/