Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
services:fittrackee [2025/05/21 08:21] – [FitTrackee] willy | services:fittrackee [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | ||
- | |||
- | [[https:// | ||
- | |||
- | The main factor that made me abandon FitTrackee in favor of [[services: | ||
- | |||
- | ===== Installation ===== | ||
- | |||
- | Detailed instructions can be found [[https:// | ||
- | |||
- | 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 / | ||
- | mkdir / | ||
- | chown fittrackee: | ||
- | </ | ||
- | |||
- | uploads will be stored under **/ | ||
- | |||
- | === Using containers === | ||
- | |||
- | Download the example docker-compose.yml from [[https:// | ||
- | <file - docker-compose.yaml> | ||
- | services: | ||
- | fittrackee-db: | ||
- | container_name: | ||
- | image: postgres: | ||
- | env_file: | ||
- | - .env | ||
- | volumes: | ||
- | - ${DATABASE_DIR: | ||
- | networks: | ||
- | - fittrackee-network | ||
- | |||
- | fittrackee: | ||
- | container_name: | ||
- | env_file: | ||
- | - .env | ||
- | image: fittrackee/ | ||
- | volumes: | ||
- | - ${UPLOAD_DIR: | ||
- | - ${LOG_DIR: | ||
- | post_start: | ||
- | - command: chown -R fittrackee: | ||
- | user: root | ||
- | ports: | ||
- | - " | ||
- | command: 'sh docker-entrypoint.sh' | ||
- | depends_on: | ||
- | fittrackee-db: | ||
- | networks: | ||
- | - fittrackee-network | ||
- | |||
- | networks: | ||
- | fittrackee-network: | ||
- | </ | ||
- | |||
- | Populate the env file (/ | ||
- | <file - .env> | ||
- | # Docker volumes | ||
- | export UPLOAD_DIR=/ | ||
- | export LOG_DIR=/ | ||
- | export DATABASE_DIR=/ | ||
- | |||
- | # Application | ||
- | export FLASK_APP=fittrackee | ||
- | export FLASK_SKIP_DOTENV=1 | ||
- | export APP_PORT=5123 | ||
- | export APP_SECRET_KEY=<< | ||
- | export APP_LOG=/ | ||
- | export UPLOAD_FOLDER=/ | ||
- | export UI_URL=https:// | ||
- | |||
- | # PostgreSQL | ||
- | export POSTGRES_USER=fittrackee | ||
- | export POSTGRES_PASSWORD=<< | ||
- | export POSTGRES_DB=fittrackee | ||
- | export DATABASE_URL=postgresql:// | ||
- | </ | ||
- | |||
- | Now start the stuff: | ||
- | <code bash> | ||
- | podman compose up | ||
- | </ | ||
- | |||
- | 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: | ||
- | |||
- | <code bash> | ||
- | python -m venv venv_ft | ||
- | source venv_ft/ | ||
- | pip install fittrackee | ||
- | </ | ||
- | |||
- | Populate the following **/ | ||
- | <file - .env> | ||
- | export PORT=5123 | ||
- | export APP_SECRET_KEY=< | ||
- | export APP_LOG=/ | ||
- | export UPLOAD_FOLDER=/ | ||
- | export DATABASE_URL=postgresql:// | ||
- | export UI_URL=https:// | ||
- | export FLASK_APP=fittrackee | ||
- | </ | ||
- | |||
- | Ensure this **.env** file is sourced in your **~/ | ||
- | |||
- | As a reference: | ||
- | <file - .bashrc> | ||
- | (only last lines shown) | ||
- | export PATH=$PATH: | ||
- | source venv_ft/ | ||
- | source .env | ||
- | </ | ||
- | |||
- | Now, FitTrackee requires PostgreSQL, so you need to install and start it. For reference, and [[https:// | ||
- | |||
- | 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 | ||
- | </ | ||
- | |||
- | type in the following SQL statements: | ||
- | <code sql> | ||
- | CREATE USER fittrackee WITH PASSWORD '< | ||
- | CREATE SCHEMA fittrackee AUTHORIZATION fittrackee; | ||
- | CREATE DATABASE fittrackee OWNER fittrackee; | ||
- | </ | ||
- | |||
- | 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: | ||
- | |||
- | <file - fittrackee.conf> | ||
- | server { | ||
- | server_name train.mydomain.com; | ||
- | listen 443 ssl; | ||
- | listen 8443 ssl; | ||
- | |||
- | access_log / | ||
- | error_log / | ||
- | |||
- | location / { | ||
- | proxy_pass http:// | ||
- | proxy_redirect | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | } | ||
- | |||
- | client_max_body_size 100M; | ||
- | include com.mydomain/ | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Autostart with containers ===== | ||
- | |||
- | To start it, and set it up on boot, as usual follow my indications [[gentoo: | ||
- | < | ||
- | ln -s / | ||
- | </ | ||
- | |||
- | and create the following config file: | ||
- | <file - / | ||
- | USER=fittrackee | ||
- | DESCRIPTION=" | ||
- | </ | ||
- | |||
- | 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 | ||
- | </ | ||
- | |||
- | ===== Autostart without containers ===== | ||
- | |||
- | Since i use OpenRC, simply drop the following script to / | ||
- | <file - / | ||
- | # | ||
- | # Copyright 1999-2021 Gentoo Authors | ||
- | # Distributed under the terms of the GNU General Public License v2 | ||
- | |||
- | description=" | ||
- | pidfile="/ | ||
- | command_background=true | ||
- | command="/ | ||
- | command_args="" | ||
- | command_user=" | ||
- | |||
- | depend() { | ||
- | need net | ||
- | } | ||
- | </ | ||
- | |||
- | Make it executable and add to the proper runlevel: | ||
- | <code bash> | ||
- | chmod +x / | ||
- | rc-update add fittrackee default | ||
- | </ | ||
- | |||
- | You will also need to create the script **/ | ||
- | <file - fittrackee_start.sh> | ||
- | #!/bin/bash | ||
- | cd ~ | ||
- | export PATH=$PATH: | ||
- | source venv_ft/ | ||
- | source .env | ||
- | # Workers are not really needed on very small instances. Uncomment if you need them | ||
- | # flask worker --processes 2& | ||
- | fittrackee | ||
- | </ | ||
- | 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 < | ||
- | </ | ||
- | |||
- | To run the CLI (without container installation): | ||
- | <code bash> | ||
- | ftcli users update < | ||
- | </ | ||
- | |||
- | To create users: | ||
- | <code bash> | ||
- | ftcli users create --password < | ||
- | </ | ||
- | |||
- | To set an user as admin: | ||
- | <code bash> | ||
- | ftcli users update myuser --set-admin true | ||
- | </ | ||
- | |||
- | 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 **/ | ||
- | <file - fittrackee> | ||
- | / | ||
- | missingok | ||
- | notifempty | ||
- | } | ||
- | </ | ||
- | |||
- | ===== 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 | ||
- | </ | ||
- | |||
- | 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:// | ||
- | |||
- | 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: | ||
- | |||
- | Only if you have done a Fittrackee containerized installation, | ||
- | <code bash> | ||
- | python -m venv venv_ft | ||
- | source venv_ft/ | ||
- | </ | ||
- | |||
- | and enable it in fittrackee' | ||
- | <file - .bashrc> | ||
- | (only last lines shown) | ||
- | export PATH=$PATH: | ||
- | source venv_ft/ | ||
- | source .env | ||
- | </ | ||
- | |||
- | ===== bridge installation | ||
- | |||
- | First of all, as the same **fittrackee** user, install the bridge: | ||
- | <code bash> | ||
- | pip install --upgrade --index-url https:// | ||
- | </ | ||
- | |||
- | 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 " | ||
- | In the "Add a new OAuth2 application" | ||
- | As " | ||
- | Enable all the scopes. | ||
- | |||
- | After submit your application, | ||
- | |||
- | At this point, setup the link to Garmin, from your fittrackee user terminal: | ||
- | <code bash> | ||
- | garmin2fittrackee setup config-tool | ||
- | </ | ||
- | |||
- | Link to Garmin: | ||
- | <code bash> | ||
- | | ||
- | </ | ||
- | 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 | ||
- | </ | ||
- | |||
- | 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> | ||
- | | ||
- | </ | ||
- | |||
- | **NOTE:** ensure your FitTrackee has //no activities// | ||
- | |||
- | 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: | ||
- | source venv_ft/ | ||
- | source .env | ||
- | garmin2fittrackee sync | ||
- | </ | ||
- | and make it executable. | ||
- | |||
- | Then schedule it as many times per day as you like in your crontab: | ||
- | < | ||
- | 0 0 * * * / | ||
- | 6 0 * * * / | ||
- | 12 0 * * * / | ||
- | 18 0 * * * / | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | crontab -e | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||