Installation¶
This application is written in Python (API) and Javascript (client):
- API:
Flask
gpxpy to parse gpx files
staticmap to generate a static map image from gpx coordinates
python-forecast.io to fetch weather data from Dark Sky (former forecast.io)
dramatiq for task queue
Sports and weather icons are made by Freepik from www.flaticon.com.
Prerequisites¶
Installation¶
Warning
Since FitTrackee 0.2.1, Python packages installation needs Poetry. To install it on ArchLinux:
$ yay poetry
$ poetry --version
Poetry 1.0.5
# optional
$ poetry config virtualenvs.in-project true
For other OS, see Poetry Documentation
Dev environment¶
Clone this repo:
$ git clone https://github.com/SamR1/FitTrackee.git
$ cd FitTrackee
Update Makefile.config file if needed and copy/paste the ThunderForest and Dark Sky API keys value in Makefile.custom.config file (see Environment variables).
Install Python virtualenv, React and all related packages and initialize the database:
$ make install-dev
$ make install-db
Start the server and the client:
$ make serve
Run dramatiq workers:
$ make run-workers
Open http://localhost:3000 and login (the email is admin@example.com
and the password mpwoadmin
) or register
Prod environment¶
Warning
Note that FitTrackee is not production-ready yet
Download the last release (for now, it is the beta release v0.3.0):
$ wget https://github.com/SamR1/FitTrackee/archive/v0.3.0-beta.tar.gz
$ tar -xzf v0.3.0-beta.tar.gz
$ mv FitTrackee-0.3.0-beta FitTrackee
$ cd FitTrackee
Update Makefile.config file if needed and copy/paste the ThunderForest and Dark Sky API keys value in Makefile.custom.config file (see Environment variables).
Install Python virtualenv, React and all related packages and initialize the database:
$ make install
$ make install-db
Build the client:
$ make build-client
Start the server and the client:
$ make run
Run dramatiq workers:
$ make run-workers
Open http://localhost:3000, log in as admin (the email is
admin@example.com
and the password mpwoadmin
) and change the
password
Upgrade¶
Warning
Dev environment¶
Stop the application and pull the repository:
$ git pull
Update Makefile.config and Makefile.custom.config file if needed
Upgrade packages and database:
$ make install-dev
$ make upgrade-db
Restart the server and the client:
$ make serve
Prod environment¶
TODO
Environment variables¶
The following environment variables must be defined in Makefile.custom.config:
variable |
description |
app default value |
---|---|---|
|
Fittrackee API URL |
no default value, must be initialized |
|
max. number of gpx file in zip archive |
10 (deprecated in 0.3.0) |
|
max. size of a gpx or picture file |
1MB (deprecated in 0.3.0) |
|
max. size of a zip archive |
10MB (deprecated in 0.3.0) |
|
allows users to register |
true (deprecated in 0.3.0) |
|
ThunderForest API key |
(deprecated in 0.x.x, use |
|
Tile server URL (with api key if needed) |
|
|
Map attribution (if using another tile server) |
|
|
application URL |
no default value, must be initialized |
|
email URL with credentials |
no default value, must be initialized (see below) |
|
application sender email address |
no default value, must be initialized |
|
Redis instance used by Dramatiq |
local Redis instance |
|
number of process used by Dramatiq |
no default value, must be initialized |
Warning
Since FitTrackee 0.3.0, some applications parameters are now stored in database. Related environment variables are needed to initialize database.
Emails¶
new in 0.3.0
To send emails, a valid EMAIL_URL
must be provided:
with an unencrypted SMTP server:
smtp://username:password@smtp.example.com:25
with SSL:
smtp://username:password@smtp.example.com:465/?ssl=True
with STARTTLS:
smtp://username:password@smtp.example.com:587/?tls=True
Map tile server¶
new in 0.x.x
Default tile server is now OpenStreetMap’s standard tile layer (if environment variables are not initialized).
The tile server can be changed by updating TILE_SERVER_URL
and MAP_ATTRIBUTION
variables (list of tile servers).
To keep using ThunderForest Outdoors, the configuration is:
TILE_SERVER_URL=https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=XXXX
where XXXX is ThunderForest API keyMAP_ATTRIBUTION=© <a href="http://www.thunderforest.com/">Thunderforest</a>, © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors
Note
Check the terms of service of tile provider for map attribution