This is an old revision of the document!
Endurain
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.
It is similar to FitTrackee and i am currently testing both. The current limit with FitTrackee is the lack of an easy and scalable Garmin Integration.
Installation
Endurain is provided with a docker-compose. Installation instructions are here.
As usual, create a dadicated user with proper folders for data storage:
useradd -m -d /data/daemons/endurain endurain mkdir /data/endurain /var/log/endurain chown endurain:endurain /data/endurain /var/log/endurain
Then grab the example docker-compose.yml here, put it under /data/daemons/enbdurain/docker-compose.yml and customize like the following:
- docker-compose.yml
services: endurain: container_name: endurain image: ghcr.io/joaovitoriasilva/endurain:latest environment: - TZ=Europe/Rome - DB_PASSWORD=<< random password for the database >> - SECRET_KEY=<< see below >> - FERNET_KEY=<< see below >> - GEOCODES_MAPS_API= - ENDURAIN_HOST=https://train.mydomain.com - UID=0 - GID=0 - BEHIND_PROXY=true volumes: - /data/endurain/backend/user_images:/app/backend/user_images # necessary for user image persistence on container image updates - /data/endurain/backend/files/bulk_import:/app/backend/files/bulk_import # necessary to enable bulk import of activities. Place here your activities files - /data/endurain/backend/files/processed:/app/backend/files/processed # necessary for processed original files persistence on container image updates - /var/log/endurain:/app/backend/logs # log files for the backend ports: - "5123:8080" depends_on: postgres: networks: - endurain-network postgres: image: postgres:latest container_name: postgres environment: - POSTGRES_PASSWORD=<< same password as above database password >> - POSTGRES_DB=endurain - POSTGRES_USER=endurain - PGDATA=/var/lib/postgresql/data/pgdata ports: - "5432:5432" volumes: - /data/endurain/postgres:/var/lib/postgresql/data networks: - endurain-network networks: endurain-network: {}
To generate the SECRET_KEY run the following command:
openssl rand -hex 32
To generate the FERNET_KEY go to this page or issue the following command, if you have the relevant modules installed:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
The GEOCODES_MAPS_API is not needed if the 1request/second, 5000 request/day limit is enough for you. Otherwise, you need to upgrade to a paid plan on Geocode.
Volumes will be mounted under /data/endurain.
Pick an available port.
UID and GID are set to 0 because i use rootless podman, in this case 0 means to run the container as the endurain host user, not root, and this is what we want.
Now run as usual:
podman compose pull
Reverse Proxy
I have deployed Endurain on a subdomain, because i already had one set up for it. Check The Reverse Proxy concept for more details:
- endurain.conf
server { server_name train.mydomain.com; listen 443 ssl; listen 8443 ssl; access_log /var/log/nginx/train.mydomain.com_access_log main; error_log /var/log/nginx/train.mydomain.com_error_log info; location / { proxy_pass http://127.0.0.1:5123; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Proto $scheme; } client_max_body_size 100M; include com.mydomain/certbot.conf; }
Autostart
To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:
ln -s /etc/init.d/user-containers /etc/init.d/user-containers.endurain
and create the following config file:
- /etc/conf.d/user-containers.endurain
USER=endurain DESCRIPTION="Fitness tracker"
Add the service to the default runlevel and start it now:
rc-update add user-containers.endurain default rc-service user-containers.endurain start
Configuration
Go to the web UI and do the first login as user admin with password admin, then immediately change the password.
You can now start adding users and using the tool!
Log rotation
Create the following /etc/logrotate.d/endurain file:
- endurain
/var/log/endurain/* { missingok notifempty }