Skip to content

Commit 00ccef6

Browse files
push-app-to-main[bot]MickLesktremor021
authored
Endurain (#9681)
* 'Add new script' * Remove explicit exit code from endurain.sh * Apply suggestion from @tremor021 * Use LOCAL_IP for Endurain host configuration --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Slaviša Arežina <[email protected]>
1 parent e0dc02a commit 00ccef6

File tree

3 files changed

+244
-0
lines changed

3 files changed

+244
-0
lines changed

ct/endurain.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: johanngrobe
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/joaovitoriasilva/endurain
7+
8+
APP="Endurain"
9+
var_tags="${var_tags:-sport;social-media}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-5}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/endurain ]]; then
28+
msg_error "No ${APP} installation found!"
29+
exit 1
30+
fi
31+
if check_for_gh_release "endurain" "joaovitoriasilva/endurain"; then
32+
msg_info "Stopping Service"
33+
systemctl stop endurain
34+
msg_ok "Stopped Service"
35+
36+
msg_info "Creating Backup"
37+
cp /opt/endurain/.env /opt/endurain.env
38+
cp /opt/endurain/frontend/app/dist/env.js /opt/endurain.env.js
39+
msg_ok "Created Backup"
40+
41+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain"
42+
43+
msg_info "Preparing Update"
44+
cd /opt/endurain
45+
rm -rf \
46+
/opt/endurain/{docs,example.env,screenshot_01.png} \
47+
/opt/endurain/docker* \
48+
/opt/endurain/*.yml
49+
cp /opt/endurain.env /opt/endurain/.env
50+
rm /opt/endurain.env
51+
msg_ok "Prepared Update"
52+
53+
msg_info "Updating Frontend"
54+
cd /opt/endurain/frontend/app
55+
$STD npm ci
56+
$STD npm run build
57+
cp /opt/endurain.env.js /opt/endurain/frontend/app/dist/env.js
58+
rm /opt/endurain.env.js
59+
msg_ok "Updated Frontend"
60+
61+
msg_info "Updating Backend"
62+
cd /opt/endurain/backend
63+
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
64+
$STD uv venv
65+
$STD uv pip install -r requirements.txt
66+
msg_ok "Backend Updated"
67+
68+
msg_info "Starting Service"
69+
systemctl start endurain
70+
msg_ok "Started Service"
71+
msg_ok "Update Completed Successfully!"
72+
fi
73+
exit
74+
}
75+
76+
start
77+
build_container
78+
description
79+
80+
msg_ok "Completed Successfully!\n"
81+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
82+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
83+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}"

frontend/public/json/endurain.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Endurain",
3+
"slug": "endurain",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-11-23",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8080,
12+
"documentation": "https://docs.endurain.com/",
13+
"website": "https://github.com/joaovitoriasilva/endurain",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/endurain.webp",
15+
"config_path": "/opt/endurain/.env",
16+
"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",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/endurain.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 5,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "admin",
32+
"password": "admin"
33+
},
34+
"notes": [
35+
{
36+
"text": "When using a reverse proxy, edit `/opt/endurain/frontend/app/dist/env.js`.",
37+
"type": "info"
38+
}
39+
]
40+
}

install/endurain-install.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: johanngrobe
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/joaovitoriasilva/endurain
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
default-libmysqlclient-dev \
19+
build-essential \
20+
pkg-config
21+
msg_ok "Installed Dependencies"
22+
23+
PYTHON_VERSION="3.13" setup_uv
24+
NODE_VERSION="24" setup_nodejs
25+
PG_VERSION="17" PG_MODULES="postgis" setup_postgresql
26+
PG_DB_NAME="enduraindb" PG_DB_USER="endurain" setup_postgresql_db
27+
import_local_ip
28+
fetch_and_deploy_gh_release "endurain" "joaovitoriasilva/endurain" "tarball" "latest" "/opt/endurain"
29+
30+
msg_info "Setting up Endurain"
31+
cd /opt/endurain
32+
rm -rf \
33+
/opt/endurain/{docs,example.env,screenshot_01.png} \
34+
/opt/endurain/docker* \
35+
/opt/endurain/*.yml
36+
mkdir -p /opt/endurain_data/{data,logs}
37+
SECRET_KEY=$(openssl rand -hex 32)
38+
FERNET_KEY=$(openssl rand -base64 32)
39+
ENDURAIN_HOST=http://${LOCAL_IP}:8080
40+
cat <<EOF >/opt/endurain/.env
41+
DB_PASSWORD=${PG_DB_PASS}
42+
43+
SECRET_KEY=${SECRET_KEY}
44+
FERNET_KEY=${FERNET_KEY}
45+
46+
TZ=Europe/Berlin
47+
ENDURAIN_HOST=${ENDURAIN_HOST}
48+
BEHIND_PROXY=false
49+
50+
POSTGRES_DB=${PG_DB_NAME}
51+
POSTGRES_USER=${PG_DB_USER}
52+
PGDATA=/var/lib/postgresql/${PG_DB_NAME}
53+
54+
DB_DATABASE=${PG_DB_NAME}
55+
DB_USER=${PG_DB_USER}
56+
DB_PORT=5432
57+
DB_HOST=localhost
58+
59+
DATABASE_URL=postgresql+psycopg://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
60+
61+
BACKEND_DIR="/opt/endurain/backend/app"
62+
FRONTEND_DIR="/opt/endurain/frontend/app/dist"
63+
DATA_DIR="/opt/endurain_data/data"
64+
LOGS_DIR="/opt/endurain_data/logs"
65+
66+
#SMTP_HOST=smtp.protonmail.ch
67+
#SMTP_PORT=587
68+
69+
#SMTP_PASSWORD=your-app-password
70+
#SMTP_SECURE=true
71+
#SMTP_SECURE_TYPE=starttls
72+
EOF
73+
msg_ok "Setup Endurain"
74+
75+
msg_info "Building Frontend"
76+
cd /opt/endurain/frontend/app
77+
$STD npm ci --prefer-offline
78+
$STD npm run build
79+
cat <<EOF >/opt/endurain/frontend/app/dist/env.js
80+
window.env = {
81+
ENDURAIN_HOST: "${ENDURAIN_HOST}"
82+
}
83+
EOF
84+
msg_ok "Built Frontend"
85+
86+
msg_info "Setting up Backend"
87+
cd /opt/endurain/backend
88+
$STD uv tool install poetry
89+
$STD uv tool update-shell
90+
export PATH="/root/.local/bin:$PATH"
91+
$STD poetry self add poetry-plugin-export
92+
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
93+
$STD uv venv
94+
$STD uv pip install -r requirements.txt
95+
msg_ok "Setup Backend"
96+
97+
msg_info "Creating Service"
98+
cat <<EOF >/etc/systemd/system/endurain.service
99+
[Unit]
100+
Description=Endurain FastAPI Backend
101+
After=network.target postgresql.service
102+
103+
[Service]
104+
WorkingDirectory=/opt/endurain/backend/app
105+
EnvironmentFile=/opt/endurain/.env
106+
ExecStart=/opt/endurain/backend/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 8080
107+
Restart=always
108+
RestartSec=5
109+
User=root
110+
StandardOutput=journal
111+
StandardError=journal
112+
113+
[Install]
114+
WantedBy=multi-user.target
115+
EOF
116+
systemctl enable -q --now endurain
117+
msg_ok "Created Service"
118+
119+
motd_ssh
120+
customize
121+
cleanup_lxc

0 commit comments

Comments
 (0)