User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
services:fittrackee [2025/05/21 08:21] – [FitTrackee] willyservices:fittrackee [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-======   FitTrackee ====== 
- 
-[[https://samr1.github.io/FitTrackee/en/index.html|FitTrackee]] is an open-source fitness tracker selfhosted application that can also sync with Garmin and Strava. It is aimed at outdoor activities. 
- 
-The main factor that made me abandon FitTrackee in favor of [[services:endurain|Endurain]] is that Endurain provides a better and easier Garmin integration built-in. 
- 
-===== Installation ===== 
- 
-Detailed instructions can be found [[https://samr1.github.io/FitTrackee/en/installation.html|here]]. Since version 0.8 there is also a container image and a docker compose example file.  Initially i had installed on bare metal, but since that time i prefer to move to the containerized installation because i do not want to manage myself a PostgreSQL installation on my server for various reasons. 
- 
-For historical reasons, i will keep the original non containerized installation instructions too for reference, but keep in mind they might be outdated. 
- 
-As usual, create the dedicated user: 
-<code bash> 
-useradd -d /data/daemons/fittrackee -m fittrackee 
-mkdir /data/fittrackee /data/fittrackee/upload /data/fittrackee/database /var/log/fittrackee 
-chown fittrackee:fittrackee /data/fittrackee /data/fittrackee/upload /data/fittrackee/database /var/log/fittrackee 
-</code> 
- 
-uploads will be stored under **/data/fittrackee/upload** and similarly the database. Logs will be located under **/var/log/fittrackee** remember to logrotate it. 
- 
-=== Using containers === 
- 
-Download the example docker-compose.yml from [[https://github.com/SamR1/FitTrackee/blob/master/docker-compose.yml|here]] and adapt it to your needs: 
-<file - docker-compose.yaml> 
-services: 
-  fittrackee-db: 
-    container_name: fittrackee-db 
-    image: postgres:17-alpine 
-    env_file: 
-      - .env 
-    volumes: 
-      - ${DATABASE_DIR:-./data/db}:/var/lib/postgresql/data 
-    networks: 
-      - fittrackee-network 
- 
-  fittrackee: 
-    container_name: fittrackee 
-    env_file: 
-      - .env 
-    image: fittrackee/fittrackee:v0.9.11 
-    volumes: 
-      - ${UPLOAD_DIR:-./data/uploads}:/usr/src/app/uploads 
-      - ${LOG_DIR:-./data/logs}:/usr/src/app/logs 
-    post_start: 
-      - command: chown -R fittrackee:fittrackee /usr/src/app/uploads 
-        user: root 
-    ports: 
-      - "${APP_PORT:-5000}:5000" 
-    command: 'sh docker-entrypoint.sh' 
-    depends_on: 
-      fittrackee-db: 
-    networks: 
-      - fittrackee-network 
- 
-networks: 
-  fittrackee-network: {} 
-</file> 
- 
-Populate the env file (/data/daemons/fittrackee/.env): 
-<file - .env> 
-# Docker volumes 
-export UPLOAD_DIR=/data/fittrackee/uploads 
-export LOG_DIR=/var/log/fittrackee 
-export DATABASE_DIR=/data/fittrackee/database 
- 
-# Application 
-export FLASK_APP=fittrackee 
-export FLASK_SKIP_DOTENV=1 
-export APP_PORT=5123 
-export APP_SECRET_KEY=<< custom key >> 
-export APP_LOG=/usr/src/app/logs/fittrackee.log 
-export UPLOAD_FOLDER=/usr/src/app/uploads 
-export UI_URL=https://train.mydomain.com 
- 
-# PostgreSQL 
-export POSTGRES_USER=fittrackee 
-export POSTGRES_PASSWORD=<< some password >> 
-export POSTGRES_DB=fittrackee 
-export DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@fittrackee-db:5432/${POSTGRES_DB} 
-</file> 
- 
-Now start the stuff: 
-<code bash> 
-podman compose up 
-</code> 
- 
-you might have to stop and start again, since the first start of the database takes some time and the main app might crash. Just wait for the database to be up and running, then restart. 
- 
-=== Without using containers === 
- 
-FitTrackee uses Python, so check out [[gentoo:pip|PIP on Gentoo]] page to enable virtual environments and PIP for the fittrackee user. 
- 
-<code bash> 
-python -m venv venv_ft 
-source venv_ft/bin/activate 
-pip install fittrackee 
-</code> 
- 
-Populate the following **/data/daemons/fittrackee/.env** file: 
-<file - .env> 
-export PORT=5123 
-export APP_SECRET_KEY=<my secret> 
-export APP_LOG=/va/log/fittrackee/log.txt 
-export UPLOAD_FOLDER=/data/fittrackee/upload 
-export DATABASE_URL=postgresql://fittrackee:xxxxxxx@127.0.0.1:5432/ 
-export UI_URL=https://train.mydomain.com 
-export FLASK_APP=fittrackee 
-</file> 
- 
-Ensure this **.env** file is sourced in your **~/.bashrc**, this is needed for non-container users, and also required for the Garmin bridge, even if using containers. 
- 
-As a reference: 
-<file - .bashrc> 
-(only last lines shown) 
-export PATH=$PATH:~/.local/bin 
-source venv_ft/bin/activate 
-source .env 
-</file> 
- 
-Now, FitTrackee requires PostgreSQL, so you need to install and start it. For reference, and [[https://wiki.gentoo.org/wiki/PostgreSQL/QuickStart|this]] and [[https://wiki.gentoo.org/wiki/PostgreSQL|this]] are the Gentoo wiki pages on PostgreSQL. These two pages are very well written and will let you setup your postgres in a few moments.  
- 
-From now on i assume PostgreSQL is installed and ready. 
- 
-Now access your postgres as admin user and create the database: 
-<code bash> 
-psql -U postgres 
-</code> 
- 
-type in the following SQL statements: 
-<code sql> 
-CREATE USER fittrackee WITH PASSWORD '<PASSWORD>'; 
-CREATE SCHEMA fittrackee AUTHORIZATION fittrackee; 
-CREATE DATABASE fittrackee OWNER fittrackee; 
-</code> 
- 
-Now, initialize the database: 
- ftcli db upgrade 
- 
-To start FitTrackee see the autostart script below. 
- 
- 
-===== Reverse Proxy ===== 
- 
-I have deployed FitTrackee on a subdomain, because i already had one set up for it. Check [[selfhost:nginx|The Reverse Proxy concept]] for more details: 
- 
-<file - fittrackee.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; 
-} 
-</file> 
- 
-===== Autostart with containers ===== 
- 
-To start it, and set it up on boot, as usual follow my indications [[gentoo:containers|Using Containers on Gentoo]], so link the **user-containers** init script: 
-<code> 
-ln -s /etc/init.d/user-containers /etc/init.d/user-containers.fittrackee 
-</code> 
- 
-and create the following config file: 
-<file - /etc/conf.d/user-containers.fittrackee> 
-USER=fittrackee 
-DESCRIPTION="The sport and train solution" 
-</file> 
- 
-Add the service to the default runlevel and start it now: 
-<code bash> 
-rc-update add user-containers.fittrackee default 
-rc-service user-containers.fittrackee start 
-</code> 
- 
-===== Autostart without containers ===== 
- 
-Since i use OpenRC, simply drop the following script to /etc/init.d: 
-<file - /etc/init.d/fittrackee> 
-#!/sbin/openrc-run 
-# Copyright 1999-2021 Gentoo Authors 
-# Distributed under the terms of the GNU General Public License v2 
- 
-description="Open Source Fit Tracker" 
-pidfile="/run/fittrackee.pid" 
-command_background=true 
-command="/deposito/daemons/fittrackee/fittrackee_start.sh" 
-command_args="" 
-command_user="fittrackee:fittrackee" 
- 
-depend() { 
-        need net 
-} 
-</file> 
- 
-Make it executable and add to the proper runlevel: 
-<code bash> 
-chmod +x /etc/init.d/fittrackee 
-rc-update add fittrackee default 
-</code> 
- 
-You will also need to create the script **/data/daemons/fittrackee_start.sh**: 
-<file - fittrackee_start.sh> 
-#!/bin/bash 
-cd ~ 
-export PATH=$PATH:~/.local/bin 
-source venv_ft/bin/activate 
-source .env 
-# Workers are not really needed on very small instances. Uncomment if you need them 
-# flask worker --processes 2& 
-fittrackee 
-</file> 
-and make it executable. 
- 
-===== User management ===== 
- 
-You can create users from the web UI, but users will be disabled. I suggest you go ahead and create one user, then use the CLI to set it as admin, you can then login and manage users with that login. 
- 
-To run the CLI (container installation): 
-<code bash> 
-podman compose exec fittrackee ftcli users update <username> --set-role admin 
-</code> 
- 
-To run the CLI (without container installation): 
-<code bash> 
-ftcli users update <username> --set-role admin 
-</code> 
- 
-To create users: 
-<code bash> 
-ftcli users create --password <password> --lang en --email xxx@mydomain.com myuser 
-</code> 
- 
-To set an user as admin: 
-<code bash> 
-ftcli users update myuser --set-admin true 
-</code> 
- 
-You can also disable user registration from the admin panel in the web GUI, set the number of active users to a fixed quantity instead of zero. 
- 
-===== Log rotation ===== 
- 
-If you use **logrotate** (you should), create a new file under **/etc/logrotate.d/fittrackee**: 
-<file - fittrackee> 
-/var/log/fittrackee/* { 
-    missingok 
-    notifempty 
-} 
-</file> 
- 
-===== Sending emails ===== 
- 
-Work in progress. 
- 
-===== Updates for non-container install ===== 
- 
-Stop the service, then run, as **fitrackee** user: 
-<code bash> 
-pip install fittrackee -U 
- ftcli db upgrade 
-</code> 
- 
-and make sure that you are in the venv.  
- 
-Also note, if you installed the Garmin bridge, that you might want to run again that installation command as well. 
- 
- 
-===== Garmin Integration ===== 
- 
-A Garmin bridge for FitTrackee exist [[https://git.dryusdan.fr/Dryusdan/garmin-to-fittrackee|here]]. 
- 
-There is no containerized version, so you need to install on bare metal.  
- 
-===== setup for container-based Fittrackee installation  ===== 
- 
-Garmin integration uses Python, so check out [[gentoo:pip|PIP on Gentoo]] page to enable virtual environments and PIP for the fittrackee user. 
- 
-Only if you have done a Fittrackee containerized installation, do the following: 
-<code bash> 
-python -m venv venv_ft 
-source venv_ft/bin/activate 
-</code> 
- 
-and enable it in fittrackee' user **.bashrc**, as a reference: 
-<file - .bashrc> 
-(only last lines shown) 
-export PATH=$PATH:~/.local/bin 
-source venv_ft/bin/activate 
-source .env 
-</file> 
- 
-===== bridge installation  ===== 
- 
-First of all, as the same **fittrackee** user, install the bridge: 
-<code bash> 
-pip install --upgrade --index-url https://git.dryusdan.fr/api/packages/Dryusdan/pypi/simple/ --extra-index-url https://pypi.python.org/simple garmin-to-fittrackee 
-</code> 
- 
-Now, citing the documentation in the above link, you need to create an application in your Fittrackee instance so go to you're fittrackee account, then go to "apps", then "Add an application". 
-In the "Add a new OAuth2 application" section; chose your Application name (let's put **GarminConnect** as an example). 
-As "application URL" and "Redirect URL" set your FitTrackee URL, so for example **https://train.mydomain.com**.  
-Enable all the scopes. 
- 
-After submit your application, an **application ID** and **secret** are displayed: note those down as you will NEVER see them again inside FitTrackee! 
- 
-At this point, setup the link to Garmin, from your fittrackee user terminal: 
-<code bash> 
-garmin2fittrackee setup config-tool 
-</code> 
- 
-Link to Garmin: 
-<code bash> 
- garmin2fittrackee sync 
-</code> 
-You will need to provide your garmin credentials for login. 
- 
-And, last, connect to FitTrackee: 
-<code bash> 
-garmin2fittrackee setup fittrackee --client-id <the client ID above> --client-secret <the secret above> --fittrackee-domain train.mydomain.com 
-</code> 
- 
-You will be prompted an URL, **carefully** copy it and paste to your browser (it's a multi-line link, so be careful). After clicking on authorize in FitTrackee web page, **copy carefully** the browser URL (again, make sure you copy ALL of it) back to the terminal window. 
- 
- At last, start the actual sync: 
-<code bash> 
- garmin2fittrackee sync 
-</code> 
- 
-**NOTE:** ensure your FitTrackee has //no activities// already logged, or GarminConnect will only fetch starting from today. If you want to export __all__ garmin activities from the past, your FitTrackee user __must__ have no activities logged. 
- 
-This will take a while. You will want to run this as a cron task every 6 hours or so,  create the following script: 
-<file - sync_garmin.sh> 
-#!/bin/bash 
-cd ~ 
-export PATH=$PATH:~/.local/bin 
-source venv_ft/bin/activate 
-source .env 
-garmin2fittrackee sync 
-</file> 
-and make it executable. 
- 
-Then schedule it as many times per day as you like in your crontab: 
-<code> 
-0 0 * * * /data/daemons/fittrackee/sync_garmin.sh &> ~/cron.log 
-6 0 * * * /data/daemons/fittrackee/sync_garmin.sh &> ~/cron.log 
-12 0 * * * /data/daemons/fittrackee/sync_garmin.sh &> ~/cron.log 
-18 0 * * * /data/daemons/fittrackee/sync_garmin.sh &> ~/cron.log 
-</code> 
- 
-<code bash> 
-crontab -e 
-</code> 
- 
- 
- 
- 
- 
  

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information