From 0dd4243cfd21c9128115d1c9cb7e8b46a29d90a5 Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Sun, 23 Nov 2025 14:27:26 +0100 Subject: [PATCH 01/28] add endurain scripts --- ct/endurain.sh | 89 ++++++++++++++++++++ frontend/public/json/endurain.json | 40 +++++++++ install/endurain-install.sh | 129 +++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+) create mode 100644 ct/endurain.sh create mode 100644 frontend/public/json/endurain.json create mode 100644 install/endurain-install.sh diff --git a/ct/endurain.sh b/ct/endurain.sh new file mode 100644 index 0000000000..4f07ff8daa --- /dev/null +++ b/ct/endurain.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/johanngrobe/ProxmoxVE/endurain/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 Defaults +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" + mv /opt/endurain/.env /opt/env.backup + mv /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup + msg_ok "Backup Created" + + msg_info "Fetching Latest Release" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" + msg_ok "Release Updated" + + msg_info "Preparing Update" + cd /opt/endurain || exit + rm -rf \ + /opt/endurain/{docs,example.env,screenshot_01.png} \ + /opt/endurain/docker* \ + /opt/endurain/*.yml + mv /opt/env.backup /opt/endurain/.env + msg_ok "Update prepared" + + msg_info "Updating Frontend" + cd /opt/endurain/frontend/app || exit 1 + $STD npm ci + $STD npm run build + mv /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js + msg_ok "Frontend Updated" + + msg_info "Updating Backend" + cd /opt/endurain/backend || exit + $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 "Endurain Service Started" + + 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}" diff --git a/frontend/public/json/endurain.json b/frontend/public/json/endurain.json new file mode 100644 index 0000000000..6b9b57f411 --- /dev/null +++ b/frontend/public/json/endurain.json @@ -0,0 +1,40 @@ +{ + "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" + } + ] +} diff --git a/install/endurain-install.sh b/install/endurain-install.sh new file mode 100644 index 0000000000..18db2137a1 --- /dev/null +++ b/install/endurain-install.sh @@ -0,0 +1,129 @@ +#!/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-get install -y default-libmysqlclient-dev build-essential pkg-config +msg_ok "Installed Dependencies" + +PYTHON_VERSION="3.13" setup_uv +NODE_VERSION="22" NODE_MODULE="npm@latest" setup_nodejs +PG_VERSION="17" PG_MODULES="postgis,contrib" setup_postgresql + +fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" + +msg_info "Setting up Endurain" +DB_NAME=enduraindb +DB_USER=endurain +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +DB_PORT=5432 +DB_HOST=localhost + +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" + +cd /opt/endurain || exit +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 < /opt/endurain/.env + +DB_PASSWORD=${DB_PASS} + +SECRET_KEY=${SECRET_KEY} +FERNET_KEY=${FERNET_KEY} + +TZ=Europe/Berlin +ENDURAIN_HOST=${ENDURAIN_HOST} +BEHIND_PROXY=false + +POSTGRES_DB=${DB_NAME} +POSTGRES_USER=${DB_USER} +PGDATA=/var/lib/postgresql/${DB_NAME} + +DB_DATABASE=${DB_NAME} +DB_USER=${DB_USER} +DB_PORT=${DB_PORT} +DB_HOST=${DB_HOST} + +DATABASE_URL=postgresql+psycopg://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${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 || exit +$STD npm ci --prefer-offline +$STD npm run build +cat < /opt/endurain/frontend/app/dist/env.js +window.env = { + ENDURAIN_HOST: "${ENDURAIN_HOST}" +} +EOF +msg_ok "Build Frontend" + +msg_info "Setting up Backend" +cd /opt/endurain/backend || exit +$STD uv tool install poetry +$STD uv tool update-shell +$STD 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 </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 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now endurain +msg_ok "Service Created & Started" + +motd_ssh +customize +cleanup_lxc From 15db0620e3645f7501d413948edb3700767e0638 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:20:05 +0100 Subject: [PATCH 02/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 18db2137a1..2ff14e2e4d 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -36,7 +36,7 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8' $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" -cd /opt/endurain || exit +cd /opt/endurain rm -rf \ /opt/endurain/{docs,example.env,screenshot_01.png} \ /opt/endurain/docker* \ From f3b25f27995fc071936fc798baf779690966d54b Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:20:27 +0100 Subject: [PATCH 03/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 2ff14e2e4d..88110b17ee 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -83,7 +83,7 @@ EOF msg_ok "Setup Endurain" msg_info "Building Frontend" -cd /opt/endurain/frontend/app || exit +cd /opt/endurain/frontend/app $STD npm ci --prefer-offline $STD npm run build cat < /opt/endurain/frontend/app/dist/env.js From cead5c36345b64744e38be85c81a0ec55f8d59b4 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:20:39 +0100 Subject: [PATCH 04/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 88110b17ee..b30ec7af80 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -91,7 +91,7 @@ window.env = { ENDURAIN_HOST: "${ENDURAIN_HOST}" } EOF -msg_ok "Build Frontend" +msg_ok "Built Frontend" msg_info "Setting up Backend" cd /opt/endurain/backend || exit From 390d7484baf952852ca3ccbcf9051f60ba5c86a8 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:21:00 +0100 Subject: [PATCH 05/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index b30ec7af80..1913423123 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -94,7 +94,7 @@ EOF msg_ok "Built Frontend" msg_info "Setting up Backend" -cd /opt/endurain/backend || exit +cd /opt/endurain/backend $STD uv tool install poetry $STD uv tool update-shell $STD export PATH="/root/.local/bin:$PATH" From 84bf44ad0b0051f58239ab7ee4185978f42b8be2 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:21:09 +0100 Subject: [PATCH 06/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 4f07ff8daa..3da7ba8be1 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -46,7 +46,7 @@ function update_script() { msg_ok "Release Updated" msg_info "Preparing Update" - cd /opt/endurain || exit + cd /opt/endurain rm -rf \ /opt/endurain/{docs,example.env,screenshot_01.png} \ /opt/endurain/docker* \ From 043c23dae3f71ecaea056f70a4956fdddec6d497 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:21:19 +0100 Subject: [PATCH 07/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 3da7ba8be1..fa052704d6 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -41,9 +41,7 @@ function update_script() { mv /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup msg_ok "Backup Created" - msg_info "Fetching Latest Release" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" - msg_ok "Release Updated" msg_info "Preparing Update" cd /opt/endurain From 1e06be29eb464326ebe364c3a3046b7d8304e0d2 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:21:42 +0100 Subject: [PATCH 08/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index fa052704d6..9e2d9c5ebc 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -5,7 +5,6 @@ source <(curl -fsSL https://raw.githubusercontent.com/johanngrobe/ProxmoxVE/endu # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://github.com/joaovitoriasilva/endurain -# App Defaults APP="Endurain" var_tags="${var_tags:-sport;social-media}" var_cpu="${var_cpu:-2}" From e07b79d46028707802f3d3f9173973c39efa27d4 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:21:51 +0100 Subject: [PATCH 09/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 9e2d9c5ebc..c2e58e0209 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/johanngrobe/ProxmoxVE/endurain/misc/build.func) +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 From 057d7e844a26ad8a51af2a2eb585cc522b08798a Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:35:15 +0100 Subject: [PATCH 10/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index c2e58e0209..b395d38371 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -67,7 +67,7 @@ function update_script() { msg_info "Starting Service" systemctl start endurain - msg_ok "Endurain Service Started" + msg_ok "Started Service" msg_ok "Update Completed Successfully!" From 1b8870456847e0d690d087410a71b5c4d0133dc8 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:35:28 +0100 Subject: [PATCH 11/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index b395d38371..7b65266425 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -59,7 +59,7 @@ function update_script() { msg_ok "Frontend Updated" msg_info "Updating Backend" - cd /opt/endurain/backend || exit + 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 From 76fff5df23e7943ddc07f7b19bf44f9d147123ce Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:35:38 +0100 Subject: [PATCH 12/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 7b65266425..e4191f4eba 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -52,7 +52,7 @@ function update_script() { msg_ok "Update prepared" msg_info "Updating Frontend" - cd /opt/endurain/frontend/app || exit 1 + cd /opt/endurain/frontend/app $STD npm ci $STD npm run build mv /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js From c976d30e4132d817791d2cf5741f6e151ec1180d Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:35:56 +0100 Subject: [PATCH 13/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index e4191f4eba..70cd812f21 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -49,7 +49,7 @@ function update_script() { /opt/endurain/docker* \ /opt/endurain/*.yml mv /opt/env.backup /opt/endurain/.env - msg_ok "Update prepared" + msg_ok "Prepared Update" msg_info "Updating Frontend" cd /opt/endurain/frontend/app From 88f45ee18ba5f70f54745eeb16b870739f2a76ca Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Sun, 23 Nov 2025 16:43:01 +0100 Subject: [PATCH 14/28] setup_postgressql_db and cp instead of mv --- ct/endurain.sh | 14 ++++++++++--- install/endurain-install.sh | 42 +++++++++++++++---------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 70cd812f21..fcc300648b 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -36,8 +36,8 @@ function update_script() { msg_ok "Stopped Service" msg_info "Creating Backup" - mv /opt/endurain/.env /opt/env.backup - mv /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup + cp /opt/endurain/.env /opt/env.backup + cp /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup msg_ok "Backup Created" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" @@ -48,14 +48,22 @@ function update_script() { /opt/endurain/{docs,example.env,screenshot_01.png} \ /opt/endurain/docker* \ /opt/endurain/*.yml +<<<<<<< HEAD mv /opt/env.backup /opt/endurain/.env msg_ok "Prepared Update" +======= + cp /opt/env.backup /opt/endurain/.env + rm /opt/env.backup + + msg_ok "Update prepared" +>>>>>>> 5fbe83a8 (setup_postgressql_db and cp instead of mv) msg_info "Updating Frontend" cd /opt/endurain/frontend/app $STD npm ci $STD npm run build - mv /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js + cp /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js + rm /opt/env.js.backup msg_ok "Frontend Updated" msg_info "Updating Backend" diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 1913423123..ff014c8c22 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -14,7 +14,7 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y default-libmysqlclient-dev build-essential pkg-config +$STD apt install -y default-libmysqlclient-dev build-essential pkg-config msg_ok "Installed Dependencies" PYTHON_VERSION="3.13" setup_uv @@ -24,17 +24,9 @@ PG_VERSION="17" PG_MODULES="postgis,contrib" setup_postgresql fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" msg_info "Setting up Endurain" -DB_NAME=enduraindb -DB_USER=endurain -DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -DB_PORT=5432 -DB_HOST=localhost - -$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" -$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" +PG_DB_NAME="enduraindb" PG_DB_USER="endurain" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db +PG_DB_HOST=localhost +PG_DB_PORT=5432 cd /opt/endurain rm -rf \ @@ -48,7 +40,7 @@ IP=$(hostname -I | awk '{print $1}') ENDURAIN_HOST=http://${IP}:8080 cat < /opt/endurain/.env -DB_PASSWORD=${DB_PASS} +DB_PASSWORD=${PG_DB_PASS} SECRET_KEY=${SECRET_KEY} FERNET_KEY=${FERNET_KEY} @@ -57,16 +49,16 @@ TZ=Europe/Berlin ENDURAIN_HOST=${ENDURAIN_HOST} BEHIND_PROXY=false -POSTGRES_DB=${DB_NAME} -POSTGRES_USER=${DB_USER} -PGDATA=/var/lib/postgresql/${DB_NAME} +POSTGRES_DB=${PG_DB_NAME} +POSTGRES_USER=${PG_DB_USER} +PGDATA=/var/lib/postgresql/${PG_DB_NAME} -DB_DATABASE=${DB_NAME} -DB_USER=${DB_USER} -DB_PORT=${DB_PORT} -DB_HOST=${DB_HOST} +DB_DATABASE=${PG_DB_NAME} +DB_USER=${PG_DB_USER} +DB_PORT=${PG_DB_PORT} +DB_HOST=${PG_DB_HOST} -DATABASE_URL=postgresql+psycopg://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME} +DATABASE_URL=postgresql+psycopg://${PG_DB_USER}:${PG_DB_PASS}@${PG_DB_HOST}:${PG_DB_PORT}/${PG_DB_NAME} BACKEND_DIR="/opt/endurain/backend/app" FRONTEND_DIR="/opt/endurain/frontend/app/dist" @@ -95,10 +87,10 @@ msg_ok "Built Frontend" msg_info "Setting up Backend" cd /opt/endurain/backend -$STD uv tool install poetry -$STD uv tool update-shell -$STD export PATH="/root/.local/bin:$PATH" -$STD poetry self add poetry-plugin-export +uv tool install poetry +uv tool update-shell +export PATH="/root/.local/bin:$PATH" +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 From c905fe35336e757d6e59124c4ba3a9d3c270dd46 Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Sun, 23 Nov 2025 16:47:45 +0100 Subject: [PATCH 15/28] cp instead of mv --- ct/endurain.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index fcc300648b..7bbb8a5b8b 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -48,15 +48,12 @@ function update_script() { /opt/endurain/{docs,example.env,screenshot_01.png} \ /opt/endurain/docker* \ /opt/endurain/*.yml -<<<<<<< HEAD - mv /opt/env.backup /opt/endurain/.env - msg_ok "Prepared Update" -======= cp /opt/env.backup /opt/endurain/.env rm /opt/env.backup + msg_ok "Prepared Update" + msg_ok "Update prepared" ->>>>>>> 5fbe83a8 (setup_postgressql_db and cp instead of mv) msg_info "Updating Frontend" cd /opt/endurain/frontend/app From 3188c2adaa7bb0cff5a32ce78d554ee7d57da071 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:14:09 +0100 Subject: [PATCH 16/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 7bbb8a5b8b..b943dfbcb9 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -38,7 +38,7 @@ function update_script() { msg_info "Creating Backup" cp /opt/endurain/.env /opt/env.backup cp /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup - msg_ok "Backup Created" + msg_ok "Created Backup" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" From cf51ea8d8e7e5379e709c1c1514f37c4fb8e5119 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:14:36 +0100 Subject: [PATCH 17/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index b943dfbcb9..c3a8019227 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -36,7 +36,7 @@ function update_script() { msg_ok "Stopped Service" msg_info "Creating Backup" - cp /opt/endurain/.env /opt/env.backup + cp /opt/endurain/.env /opt/endurain.env cp /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup msg_ok "Created Backup" From 2ed2e7ed3423d2d86ab857380600a56fceee2998 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:14:53 +0100 Subject: [PATCH 18/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index c3a8019227..293ca81606 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -37,7 +37,7 @@ function update_script() { msg_info "Creating Backup" cp /opt/endurain/.env /opt/endurain.env - cp /opt/endurain/frontend/app/dist/env.js /opt/env.js.backup + 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" From 42e8506d0c7c11cf68c823b4bda1d53c4c3bb78f Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:15:03 +0100 Subject: [PATCH 19/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 293ca81606..2fd0254c57 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -52,8 +52,7 @@ function update_script() { rm /opt/env.backup msg_ok "Prepared Update" - - msg_ok "Update prepared" + msg_ok "Prepared Update" msg_info "Updating Frontend" cd /opt/endurain/frontend/app From 622de96963f78e51dc1ec77e2f60c0f8c9995656 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:15:25 +0100 Subject: [PATCH 20/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 2fd0254c57..089c741565 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -72,7 +72,6 @@ function update_script() { msg_info "Starting Service" systemctl start endurain msg_ok "Started Service" - msg_ok "Update Completed Successfully!" fi From 6042ba1d9581c10e008e831204d53881bcb73df7 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:15:32 +0100 Subject: [PATCH 21/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 089c741565..e3ffbc35a3 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -73,7 +73,6 @@ function update_script() { systemctl start endurain msg_ok "Started Service" msg_ok "Update Completed Successfully!" - fi exit 0 From f5a1dd4c40bf1331213d5a31d4081ffd5c8f94a5 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:15:40 +0100 Subject: [PATCH 22/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index e3ffbc35a3..93e16cbab2 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -74,7 +74,6 @@ function update_script() { msg_ok "Started Service" msg_ok "Update Completed Successfully!" fi - exit 0 } From b16d688a1bba8ad0b09e94e5b63cf16c11656dbe Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:16:14 +0100 Subject: [PATCH 23/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index ff014c8c22..6096ba6557 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -39,7 +39,6 @@ FERNET_KEY=$(openssl rand -base64 32) IP=$(hostname -I | awk '{print $1}') ENDURAIN_HOST=http://${IP}:8080 cat < /opt/endurain/.env - DB_PASSWORD=${PG_DB_PASS} SECRET_KEY=${SECRET_KEY} From 4d4df281f0ac1a85c1ac0da8c1bd42600b1ed14c Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:16:22 +0100 Subject: [PATCH 24/28] Update install/endurain-install.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- install/endurain-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 6096ba6557..0370398f29 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -113,7 +113,7 @@ User=root WantedBy=multi-user.target EOF systemctl enable -q --now endurain -msg_ok "Service Created & Started" +msg_ok "Created Service" motd_ssh customize From 0336d279da36d81c20899976612878b8427928e1 Mon Sep 17 00:00:00 2001 From: Johann Grobe <123082619+johanngrobe@users.noreply.github.com> Date: Sun, 23 Nov 2025 20:16:39 +0100 Subject: [PATCH 25/28] Update ct/endurain.sh Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/endurain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 93e16cbab2..c9e3ab105a 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -60,7 +60,7 @@ function update_script() { $STD npm run build cp /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js rm /opt/env.js.backup - msg_ok "Frontend Updated" + msg_ok "Updated Frontend" msg_info "Updating Backend" cd /opt/endurain/backend From 72eef4d08b7fad9588af370ffa225a0baccedd55 Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Sun, 23 Nov 2025 20:20:07 +0100 Subject: [PATCH 26/28] update naming of backup files --- ct/endurain.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index c9e3ab105a..0dd2111cef 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -48,8 +48,8 @@ function update_script() { /opt/endurain/{docs,example.env,screenshot_01.png} \ /opt/endurain/docker* \ /opt/endurain/*.yml - cp /opt/env.backup /opt/endurain/.env - rm /opt/env.backup + cp /opt/endurain.env /opt/endurain/.env + rm /opt/endurain.env msg_ok "Prepared Update" msg_ok "Prepared Update" @@ -58,8 +58,8 @@ function update_script() { cd /opt/endurain/frontend/app $STD npm ci $STD npm run build - cp /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js - rm /opt/env.js.backup + 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" From 23d4954854c2f302bc8f4c9915e96c92249bcf03 Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Mon, 24 Nov 2025 11:31:28 +0100 Subject: [PATCH 27/28] script improvements --- ct/endurain.sh | 4 ---- install/endurain-install.sh | 15 ++++++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ct/endurain.sh b/ct/endurain.sh index 0dd2111cef..244f59dee9 100644 --- a/ct/endurain.sh +++ b/ct/endurain.sh @@ -28,9 +28,7 @@ function update_script() { 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" @@ -52,8 +50,6 @@ function update_script() { rm /opt/endurain.env msg_ok "Prepared Update" - msg_ok "Prepared Update" - msg_info "Updating Frontend" cd /opt/endurain/frontend/app $STD npm ci diff --git a/install/endurain-install.sh b/install/endurain-install.sh index 0370398f29..dfc652a73e 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -14,7 +14,10 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt install -y default-libmysqlclient-dev build-essential pkg-config +$STD apt install -y \ + default-libmysqlclient-dev \ + build-essential \ + pkg-config msg_ok "Installed Dependencies" PYTHON_VERSION="3.13" setup_uv @@ -24,9 +27,7 @@ PG_VERSION="17" PG_MODULES="postgis,contrib" setup_postgresql fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" msg_info "Setting up Endurain" -PG_DB_NAME="enduraindb" PG_DB_USER="endurain" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db -PG_DB_HOST=localhost -PG_DB_PORT=5432 +PG_DB_NAME="enduraindb" PG_DB_USER="endurain" setup_postgresql_db cd /opt/endurain rm -rf \ @@ -54,10 +55,10 @@ PGDATA=/var/lib/postgresql/${PG_DB_NAME} DB_DATABASE=${PG_DB_NAME} DB_USER=${PG_DB_USER} -DB_PORT=${PG_DB_PORT} -DB_HOST=${PG_DB_HOST} +DB_PORT=5432 +DB_HOST=localhost -DATABASE_URL=postgresql+psycopg://${PG_DB_USER}:${PG_DB_PASS}@${PG_DB_HOST}:${PG_DB_PORT}/${PG_DB_NAME} +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" From a9a9445a1ff4283d25e8dd45e9843ff5b2ac1485 Mon Sep 17 00:00:00 2001 From: Johann Grobe Date: Fri, 28 Nov 2025 00:01:52 +0100 Subject: [PATCH 28/28] fix endurain.service because the app kept freezing --- install/endurain-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/endurain-install.sh b/install/endurain-install.sh index dfc652a73e..84c0ce6655 100644 --- a/install/endurain-install.sh +++ b/install/endurain-install.sh @@ -109,6 +109,8 @@ ExecStart=/opt/endurain/backend/.venv/bin/uvicorn main:app --host 0.0.0.0 --port Restart=always RestartSec=5 User=root +StandardOutput=journal +StandardError=journal [Install] WantedBy=multi-user.target