-
-
Notifications
You must be signed in to change notification settings - Fork 143
New script: endurain #1142
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
Open
johanngrobe
wants to merge
28
commits into
community-scripts:main
Choose a base branch
from
johanngrobe:endurain
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New script: endurain #1142
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
0dd4243
add endurain scripts
15db062
Update install/endurain-install.sh
johanngrobe f3b25f2
Update install/endurain-install.sh
johanngrobe cead5c3
Update install/endurain-install.sh
johanngrobe 390d748
Update install/endurain-install.sh
johanngrobe 84bf44a
Update ct/endurain.sh
johanngrobe 043c23d
Update ct/endurain.sh
johanngrobe 1e06be2
Update ct/endurain.sh
johanngrobe e07b79d
Update ct/endurain.sh
johanngrobe 057d7e8
Update ct/endurain.sh
johanngrobe 1b88704
Update ct/endurain.sh
johanngrobe 76fff5d
Update ct/endurain.sh
johanngrobe c976d30
Update ct/endurain.sh
johanngrobe 88f45ee
setup_postgressql_db and cp instead of mv
c905fe3
cp instead of mv
3188c2a
Update ct/endurain.sh
johanngrobe cf51ea8
Update ct/endurain.sh
johanngrobe 2ed2e7e
Update ct/endurain.sh
johanngrobe 42e8506
Update ct/endurain.sh
johanngrobe 622de96
Update ct/endurain.sh
johanngrobe 6042ba1
Update ct/endurain.sh
johanngrobe f5a1dd4
Update ct/endurain.sh
johanngrobe b16d688
Update install/endurain-install.sh
johanngrobe 4d4df28
Update install/endurain-install.sh
johanngrobe 0336d27
Update ct/endurain.sh
johanngrobe 72eef4d
update naming of backup files
23d4954
script improvements
a9a9445
fix endurain.service because the app kept freezing
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,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 | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
|
|
||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| msg_ok "Backup Created" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| msg_info "Fetching Latest Release" | ||
| CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain" | ||
| msg_ok "Release Updated" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| msg_info "Preparing Update" | ||
| cd /opt/endurain || exit | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| msg_info "Updating Frontend" | ||
| cd /opt/endurain/frontend/app || exit 1 | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $STD npm ci | ||
| $STD npm run build | ||
| mv /opt/env.js.backup /opt/endurain/frontend/app/dist/env.js | ||
| msg_ok "Frontend Updated" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| msg_info "Updating Backend" | ||
| cd /opt/endurain/backend || exit | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $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" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| msg_ok "Update Completed Successfully!" | ||
|
|
||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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}" | ||
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,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" | ||
| } | ||
| ] | ||
| } |
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,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 | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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';" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| cd /opt/endurain || exit | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
|
|
||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $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 "Build Frontend" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| msg_info "Setting up Backend" | ||
| cd /opt/endurain/backend || exit | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $STD uv tool install poetry | ||
| $STD uv tool update-shell | ||
| $STD export PATH="/root/.local/bin:$PATH" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $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 | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| EOF | ||
| systemctl enable -q --now endurain | ||
| msg_ok "Service Created & Started" | ||
johanngrobe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| motd_ssh | ||
| customize | ||
| cleanup_lxc | ||
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.