User Tools

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
services:fittrackee [2024/06/20 17:36] 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 acvities. 
- 
-===== Installation ===== 
- 
-Detailed instructions can be found [[https://samr1.github.io/FitTrackee/en/installation.html|here]]. There is no container for FitTrackee, so i will show you how to install on bare-metal. 
- 
-<code bash> 
-useradd -d /data/daemons/fittrackee -m fittrackee 
-</code> 
- 
-FitTrackee uses Python, so check out [[gentoo:pip|PIP on Gentoo]] page to enable virtual environments and PIP for the fittrackee user. 
- 
-python -m venv venv_ft 
-source venv_ft/bin/activate 
- pip install fittrackee 
- 
-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> 
- 
-<file - .env> 
-export PORT=5123 
-export APP_SECRET_KEY=<my secret> 
-export APP_LOG=/data/daemons/fittrackee/log.txt 
-export UPLOAD_FOLDER=/data/daemons/fittrackee/uploads 
-export DATABASE_URL=postgresql://fittrackee:xxxxxxx@127.0.0.1:5432/ 
-export UI_URL=https://train.mydomain.com 
-export EMAIL_URL=smtp://xxxx:xxxx@smtp.mydomain.com:587/?tls=True 
-export SENDER_EMAIL=xxx@mydomain.com 
-export FLASK_APP=fittrackee 
-</file> 
- 
-Ensure this **.env** file is sourced in your **~/.bashrc**. 
- 
-As a reference: 
-<file - .bashrc> 
-(only last lines shown) 
-export PATH=$PATH:~/.local/bin 
-source venv_ft/bin/activate 
-source .env 
-</file> 
- 
-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.gardiol.org; 
-        listen 443 ssl; 
-        listen 8443 ssl; 
- 
-        access_log /var/log/nginx/train.gardiol.org_access_log main; 
-        error_log /var/log/nginx/train.gardiol.org_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 org.gardiol/certbot.conf; 
-} 
-</file> 
- 
-===== Autostart ===== 
- 
-If you follow my [[gentoo:locald|Custom User Services]] approach... 
- 
-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 .env7 
-# Workers are not really needed on very small instances. Uncomment if you need them 
-# flask worker --processes 2& 
-fittrackee 
-</file> 
-and make it executable. 
- 
-Then add the links (as root): 
-<code bash> 
- ln -s _servicer.sh 65-fittrackee--script.start 
-server /etc/local.d # ln -s _servicer.sh 65-fittrackee--script.stop 
-</code> 
- 
-and run the start link now to start it. 
- 
-===== User management ===== 
- 
-If you do not require generating and managing many users, you can manually create them: 
-<code bash> 
-ftcli users create --password <password> --lang en --email xxx@mydomain.com myuser 
-ftcli users update myuser --set-admin true 
-</code> 
- 
-and then disable user registration from the admin panel in theweb GUI, set the number of active users to a fixed quantity instead of zero. 
-===== TODO ===== 
- 
-fix log path 
- 
-fix email sending 
- 
-===== Garmin Integration ===== 
- 
-A Garmin bridge for FitTrackee exist [[https://git.dryusdan.fr/Dryusdan/garmin-to-fittrackee|here]]. 
- 
-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, y ou 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> 
- 
-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,  add the following line: 
-<code> 
-0 0 * * * garmin2fittrackee sync 
-6 0 * * * garmin2fittrackee sync 
-12 0 * * * garmin2fittrackee sync 
-18 0 * * * garmin2fittrackee sync 
-</code> 
- 
-to your fittrackee user crontab: 
-<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