add missing docs

This commit is contained in:
Sam
2020-12-30 11:12:35 +01:00
parent 20a5b9be07
commit 806c333bf5
95 changed files with 34057 additions and 0 deletions

View File

@ -0,0 +1,17 @@
Activities
##########
.. autoflask:: fittrackee:create_app()
:endpoints:
activities.get_activities,
activities.get_activity,
activities.get_activity_gpx,
activities.get_activity_chart_data,
activities.get_segment_chart_data,
activities.get_segment_gpx,
activities.get_map,
activities.get_map_tile,
activities.post_activity,
activities.post_activity_no_gpx,
activities.update_activity,
activities.delete_activity

View File

@ -0,0 +1,14 @@
Authentication
##############
.. autoflask:: fittrackee:create_app()
:endpoints:
auth.register_user,
auth.login_user,
auth.logout_user,
auth.get_authenticated_user_profile,
auth.edit_user,
auth.edit_picture,
auth.del_picture,
auth.request_password_reset,
auth.update_password

View File

@ -0,0 +1,8 @@
Configuration
#############
.. autoflask:: fittrackee:create_app()
:endpoints:
config.get_application_config,
config.update_application_config,
config.health_check

View File

@ -0,0 +1,14 @@
API documentation
#################
.. toctree::
:maxdepth: 2
:caption: Endpoints:
activities
auth
configuration
records
sports
stats
users

View File

@ -0,0 +1,6 @@
Records
#######
.. autoflask:: fittrackee:create_app()
:endpoints:
records.get_records

View File

@ -0,0 +1,8 @@
Sports
######
.. autoflask:: fittrackee:create_app()
:endpoints:
sports.get_sports,
sports.get_sport,
sports.update_sport

View File

@ -0,0 +1,8 @@
Statistics
##########
.. autoflask:: fittrackee:create_app()
:endpoints:
stats.get_activities_by_time,
stats.get_activities_by_sport,
stats.get_application_stats

View File

@ -0,0 +1,10 @@
Users
#####
.. autoflask:: fittrackee:create_app()
:endpoints:
users.get_users,
users.get_single_user,
users.get_picture,
users.update_user,
users.delete_user

View File

@ -0,0 +1,192 @@
# Change log
## Version 0.4.0 - FitTrackee on PyPI (2020/09/19)
This version introduces some major changes:
- Installation becomes more easy. **FitTrackee** can be now be installed from PyPi.
⚠️ Warning: please read [installation documentation](https://samr1.github.io/FitTrackee/installation.html), some environment variables and files have been renamed.
- It's now possible to change the tile provider for maps. The default tile server is now **OpenStreetMap**'s standard tile layer (replacing **ThunderForest Outdoors**),
see [Map tile server in documentation](https://samr1.github.io/FitTrackee/installation.html#map-tile-server).
### Issues Closed
#### New Features
* [#54](https://github.com/SamR1/Fittrackee/issues/54) - Tile server can be changed
* [#53](https://github.com/SamR1/Fittrackee/issues/53) - Simplify FitTrackee installation
In this release 2 issue were closed.
## Version 0.3.0 - Administration (2020/07/15)
This version introduces some major changes:
- FitTrackee administration is now available (see [documentation](https://samr1.github.io/FitTrackee/features.html#administration))
⚠️ Warning: some application parameters move from environment variables to database (see [installation](https://samr1.github.io/FitTrackee/installation.html#environment-variables)).
- in order to send emails, Redis is now a mandatory dependency
### Issues Closed
#### New Features
* [#50](https://github.com/SamR1/Fittrackee/issues/50) - A user can reset his password
* [#17](https://github.com/SamR1/Fittrackee/issues/17) - A user can delete his account
* [#15](https://github.com/SamR1/Fittrackee/issues/15) - Complete the administration
In this release 3 issues were closed.
## Version 0.2.5 - Fix and improvements (2020/01/31)
### Misc
This version contains minor fix and improvements on client side:
* [4c3fc34](https://github.com/SamR1/FitTrackee/commit/4c3fc343d51b9c27d3ebab71df648bcf7d7bae59) - empty user data on logout
* [34614d5](https://github.com/SamR1/FitTrackee/commit/34614d5a6c29f4911d92db33d36fe95721b39f33) - add spinner on loading activities
* [b862a77](https://github.com/SamR1/FitTrackee/commit/b862a77344abbb07d98fe3ce8b157b5cef0e8d1c),
[2e1ee2c](https://github.com/SamR1/FitTrackee/commit/2e1ee2c7a1456eb2fe0c0255959c695cc7908975) -
add URL interceptors to simplify routes definition
## Version 0.2.4 - Minor fix (2020/01/30)
### Issues Closed
#### Bugs Fixed
* [#47](https://github.com/SamR1/Fittrackee/issues/47) - timezone drop-down is not displayed correctly
* [#46](https://github.com/SamR1/Fittrackee/issues/46) - calendar cannot display more than 5 or 6 activities on the same day
In this release 2 issues were closed.
## Version 0.2.3 - FitTrackee available in French (2019/12/29)
### Issues Closed
#### New Features
* [#43](https://github.com/SamR1/Fittrackee/issues/43) - Display weekend days with a different background color on calendar
* [#40](https://github.com/SamR1/Fittrackee/issues/40) - Localize FitTrackee (i18n)
#### Bugs Fixed
* [#44](https://github.com/SamR1/Fittrackee/issues/44) - Cannot edit an activity that does not have a gpx file
In this release 3 issues were closed.
## Version 0.2.2 - Statistics fix (2019/09/23)
### Issues Closed
#### Bugs Fixed
* [#41](https://github.com/SamR1/Fittrackee/issues/41) - User statistics are incorrect
In this release 1 issue was closed.
## Version 0.2.1 - Fix and improvements (2019/09/01)
### Issues Closed
#### New Features
* [#4](https://github.com/SamR1/Fittrackee/issues/4) - Show points on the map when mouse over the chart
* [#14](https://github.com/SamR1/Fittrackee/issues/14) - Display segments informations
* [#21](https://github.com/SamR1/Fittrackee/issues/21) - Document the API
* [#23](https://github.com/SamR1/Fittrackee/issues/23) - The user can choose the first day of the week
* [#36](https://github.com/SamR1/Fittrackee/issues/36) - Disable user registration
* [#33](https://github.com/SamR1/Fittrackee/issues/33) - Add file size limit on file upload
* [#37](https://github.com/SamR1/Fittrackee/issues/37) - Display map on activities list
#### Bugs Fixed
* [#34](https://github.com/SamR1/Fittrackee/issues/34) - Weather is not displayed anymore
### Misc
* **[Poetry](https://poetry.eustace.io/)** replaces **[pipenv](https://docs.pipenv.org)** for Python packages management
In this release 8 issues were closed.
## Version 0.2.0 - Statistics (2019/07/07)
### Issues Closed
#### New Features
* [#13](https://github.com/SamR1/Fittrackee/issues/13) - Detailed statistics
### Misc
* Update dependencies
In this release 1 issue was closed.
## Version 0.1.1 - Fix and improvements (2019/02/07)
### Issues Closed
#### New Features
* [#25](https://github.com/SamR1/FitTrackee/issues/25) - Display records on calendar
* [#22](https://github.com/SamR1/FitTrackee/issues/22) - Add a total on current month statistics
#### Bugs Fixed
* [#31](https://github.com/SamR1/FitTrackee/issues/31) - Use moving duration for stats
* [#29](https://github.com/SamR1/FitTrackee/issues/29) - Pause duration calculation with segments
* [#28](https://github.com/SamR1/FitTrackee/issues/28) - Error on uploading gpx file
* [#26](https://github.com/SamR1/FitTrackee/issues/26) - Total is incorrect in tooltip when duration is displayed
* [#24](https://github.com/SamR1/FitTrackee/issues/24) - Some distances are not displayed correctly on current month statistics
In this release 7 issues were closed.
## Version 0.1.0 - First release 🎉 (2018-07-04)
**Features:**
- Account creation (only standard user, not admin)
- 6 sports supported:
- Cycling (Sport)
- Cycling (Transport)
- Hiking
- Montain Biking
- Running
- Walking
- Activity creation by uploading a gpx file. An activity can even be created without gpx (the user must enter date, time, duration and distance)
- Activity edition and deletion
- An activity can be displayed with map (if with gpx), weather (if the DarkSky API key is provided) and charts (speed and elevation)
- A user can add a note
- Month calendar with activities
- Current month statistics
- Records by sports:
- average speed
- farest distance
- longest duration
- maximum speed
- Activities list and search
**Notes:**
- only activity owner can see his activity
- no administration for now
➡️ more informations: see [documentation](https://samr1.github.io/FitTrackee/) and [current issues](https://github.com/SamR1/FitTrackee/issues)
### Issues Closed
#### New Features
* [#11](https://github.com/SamR1/FitTrackee/issues/11) - Timezone support
* [#10](https://github.com/SamR1/FitTrackee/issues/10) - Add a note to an activity
* [#9](https://github.com/SamR1/FitTrackee/issues/9) - User statistics on dashboard
* [#8](https://github.com/SamR1/FitTrackee/issues/8) - Add weather to activities
* [#3](https://github.com/SamR1/FitTrackee/issues/3) - Search filter for activities
* [#2](https://github.com/SamR1/FitTrackee/issues/2) - Calendar to view activities
In this release 6 issues were closed.

View File

@ -0,0 +1,92 @@
Features
########
List
~~~~
Administration
^^^^^^^^^^^^^^
(*new in 0.3.0*)
- **Application**
The following parameters can be set:
- active users limit (if 0, registration is enabled (no limit defined))
- maximum size of uploaded files
- maximum size of zip archive
- maximum number of files in the zip archive
- **Users**
- display users list and details
- edit a user to add/remove administration rights
- delete a user
- **Sports**
- enable or disable a sport (a sport can be disabled even if activity with this sport exists)
Account
^^^^^^^
- A user can create, update and deleted his account
- A user can reset his password (*new in 0.3.0*)
Activities/Workouts
^^^^^^^^^^^^^^^^^^^
- 6 sports supported:
- Cycling (Sport)
- Cycling (Transport)
- Hiking
- Montain Biking
- Running
- Walking
- Dashboard with month calendar displaying activities and record. The week can start on Sunday or Monday (which can be changed in the user settings)
- Activity creation by uploading a gpx file. An activity can even be created without gpx (the user must enter date, time, duration and distance)
- An activity with a gpx file can be displayed with map, weather (if the DarkSky API key is provided) and charts (speed and elevation). Segments can be displayed
- Activity edition and deletion. User can add a note
- User statistics
- User records by sports:
- average speed
- farest distance
- longest duration
- maximum speed
- Activities list and filter
.. note::
for now, only the owner of the activity can see the activity.
Translations
^^^^^^^^^^^^
FitTrackee is available in English and French (which can be saved in the user settings).
Dashboard
~~~~~~~~~
.. figure:: _images/fittrackee_screenshot-01.png
:alt: FitTrackee Dashboard
Activity/workout detail
~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: _images/fittrackee_screenshot-02.png
:alt: FitTrackee Activity
Activities/workouts list
~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: _images/fittrackee_screenshot-03.png
:alt: FitTrackee Activities
Statistics
~~~~~~~~~~
.. figure:: _images/fittrackee_screenshot-04.png
:alt: FitTrackee Statistics
Administration
~~~~~~~~~~~~~~
.. figure:: _images/fittrackee_screenshot-05.png
:alt: FitTrackee Administration

View File

@ -0,0 +1,42 @@
.. FitTrackee documentation master file, created by
sphinx-quickstart on Sun Jul 14 14:43:43 2019.
FitTrackee
==========
| This web application allows you to track your outdoor activities from
gpx files and keep your data on your own server.
| No mobile app is developed yet, but several existing mobile apps can
store workouts data locally and export them into a gpx file.
| Examples (for Android):
| \* `Runner Up <https://github.com/jonasoreland/runnerup>`_ (GPL v3)
| \* `ForRunners <https://gitlab.com/brvier/ForRunners>`_ (GPL v3)
| \* `OpenTracks <https://github.com/OpenTracksApp/OpenTracks>`_ (Apache License)
| \* `FitoTrack <https://codeberg.org/jannis/FitoTrack>`_ (GPL v3)
| \* `AlpineQuest <https://www.alpinequest.net/>`_ (Proprietary, no
trackers according to `exodus privay
report <https://reports.exodus-privacy.eu.org/en/reports/search/psyberia.alpinequest.free/>`_)
| Maps are displayed using `Open Street
Map <https://www.openstreetmap.org>`__.
| It is also possible to add a workout without a gpx file.
| **Still under heavy development (some features may be unstable).**
| (see `issues <https://github.com/SamR1/FitTrackee/issues>`__ for more information)
.. figure:: _images/fittrackee_screenshot-01.png
:alt: FitTrackee Dashboard
Table of contents
=================
.. toctree::
:maxdepth: 2
installation
features
api/index
troubleshooting/index
changelog

View File

@ -0,0 +1,638 @@
Installation
############
This application is written in Python (API) and Javascript (client):
- API:
- Flask
- `gpxpy <https://github.com/tkrajina/gpxpy>`_ to parse gpx files
- `staticmap <https://github.com/komoot/staticmap>`_ to generate a static map image from gpx coordinates
- `python-forecast.io <https://github.com/ZeevG/python-forecast.io>`_ to fetch weather data from `Dark Sky <https://darksky.net>`__ (former forecast.io)
- `dramatiq <https://flask-dramatiq.readthedocs.io/en/latest/>`_ for task queue
- Client:
- React/Redux
- `Leaflet <https://leafletjs.com/>`__ to display map
- `Recharts <https://github.com/recharts/recharts>`__ to display charts with elevation and speed
Sports and weather icons are made by `Freepik <https://www.freepik.com/>`__ from `www.flaticon.com <https://www.flaticon.com/>`__.
Prerequisites
~~~~~~~~~~~~~
- PostgreSQL database (10+)
- Redis for task queue
- Python 3.7+
- `Poetry <https://poetry.eustace.io>`__ (for installation from sources only)
- API key from `Dark Sky <https://darksky.net/dev>`__ [not mandatory]
- SMTP provider
- `Yarn <https://yarnpkg.com>`__ (for development only)
- Docker (for development only, to start `MailHog <https://github.com/mailhog/MailHog>`__)
.. note::
| The following steps describe an installation on Linux systems (tested
on Debian and Arch).
| On other OS, some issues can be encountered and adaptations may be
necessary.
Environment variables
~~~~~~~~~~~~~~~~~~~~~
.. warning::
| Since FitTrackee 0.4.0, ``Makefile.custom.config`` is replaced by ``.env``
The following environment variables are used by **FitTrackee** web application
or the task processing library. They are not all mandatory depending on
deployment method.
.. envvar:: FLASK_APP
| Name of the module to import at flask run.
| ``FLASK_APP`` should contain ``$(PWD)/fittrackee/__main__.py`` with installation from sources, else ``fittrackee``.
.. envvar:: HOST
**FitTrackee** host.
:default: 0.0.0.0
.. envvar:: PORT
**FitTrackee** port.
:default: 5000
.. envvar:: APP_SETTINGS
**FitTrackee** configuration.
:default: fittrackee.config.ProductionConfig
.. envvar:: APP_SECRET_KEY
**FitTrackee** secret key, must be initialized in production environment.
.. envvar:: APP_WORKERS
Number of workers spawned by **Gunicorn**.
:default: 1
.. envvar:: APP_LOG 🆕
.. versionadded:: 0.4.0
Path to log file
.. envvar:: UPLOAD_FOLDER 🆕
.. versionadded:: 0.4.0
Directory containing uploaded files.
:default: `fittrackee/uploads/`
.. danger::
| With installation from PyPI, the directory will be located in
**virtualenv** directory if the variable is not initialized.
.. envvar:: DATABASE_URL
| Database URL with username and password, must be initialized in production environment.
| For example in dev environment : ``postgres://fittrackee:fittrackee@localhost:5432/fittrackee``
.. envvar:: DATABASE_DISABLE_POOLING 🆕
.. versionadded:: 0.4.0
Disable pooling if needed (when starting application with **FitTrackee** entry point and not directly with **Gunicorn**),
see `SqlAlchemy documentation <https://docs.sqlalchemy.org/en/13/core/pooling.html#using-connection-pools-with-multiprocessing-or-os-fork>`__.
:default: false
.. envvar:: UI_URL
**FitTrackee** URL, needed for links in emails.
.. envvar:: EMAIL_URL
.. versionadded:: 0.3.0
Email URL with credentials, see `Emails <installation.html#emails>`__.
.. envvar:: SENDER_EMAIL
.. versionadded:: 0.3.0
**FitTrackee** sender email address.
.. envvar:: REDIS_URL
.. versionadded:: 0.3.0
Redis instance used by **Dramatiq**.
:default: local Redis instance (``redis://``)
.. envvar:: WORKERS_PROCESSES
.. versionadded:: 0.3.0
Number of processes used by **Dramatiq**.
.. envvar:: TILE_SERVER_URL 🆕
.. versionadded:: 0.4.0
Tile server URL (with api key if needed), see `Map tile server <installation.html#map-tile-server>`__.
:default: `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`
.. envvar:: MAP_ATTRIBUTION 🆕
.. versionadded:: 0.4.0
Map attribution (if using another tile server), see `Map tile server <installation.html#map-tile-server>`__.
:default: `&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors`
.. envvar:: WEATHER_API_KEY
.. versionchanged:: 0.4.0 ⚠️ replaces ``WEATHER_API``
**Dark Sky** API key for weather data (not mandatory).
.. envvar:: REACT_APP_API_URL
**FitTrackee** API URL, only needed in dev environment.
Deprecated variables
^^^^^^^^^^^^^^^^^^^^
.. envvar:: REACT_APP_GPX_LIMIT_IMPORT
.. deprecated:: 0.3.0 now stored in database
Maximum number of gpx file in zip archive.
:default: 10
.. envvar:: REACT_APP_MAX_SINGLE_FILE_SIZE
.. deprecated:: 0.3.0 now stored in database
Maximum size of a gpx or picture file.
:default: 1MB
.. envvar:: REACT_APP_MAX_ZIP_FILE_SIZE
.. deprecated:: 0.3.0 now stored in database
Maximum size of a zip archive.
:default: 10MB
.. envvar:: REACT_APP_ALLOW_REGISTRATION
.. deprecated:: 0.3.0 now stored in database
Allows users to register.
:default: true
.. envvar:: REACT_APP_THUNDERFOREST_API_KEY
.. deprecated:: 0.4.0 see `TILE_SERVER_URL <installation.html#envvar-TILE_SERVER_URL>`__
ThunderForest API key.
.. warning::
| Since FitTrackee 0.3.0, some applications parameters are now stored in database.
| Related environment variables are needed to initialize database when upgrading from version prior 0.3.0.
Emails
^^^^^^
.. versionadded:: 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
^^^^^^^^^^^^^^^
.. versionadded:: 0.4.0
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 <https://wiki.openstreetmap.org/wiki/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 key
- ``MAP_ATTRIBUTION=&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors``
.. note::
| Check the terms of service of tile provider for map attribution
From PyPI
~~~~~~~~~
.. note::
| Recommended way on production.
.. warning::
| Note that FitTrackee is under heavy development, some features may be unstable.
Installation
^^^^^^^^^^^^
- Create and activate a virtualenv
- Install **FitTrackee** with pip
.. code-block:: bash
$ pip install fittrackee
- Create ``fittrackee`` database
Example :
.. code-block:: sql
CREATE DATABASE fittrackee;
CREATE USER fittrackee WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE fittrackee TO fittrackee;
- Initialize environment variables, see `Environment variables <installation.html#environment-variables>`__
For instance, copy and update ``.env`` file from ``.env.example`` and source the file.
.. code-block:: bash
$ nano .env
$ source .env
- Upgrade database schema
.. code-block:: bash
$ fittrackee_upgrade_db
- Initialize database
.. code-block:: bash
$ fittrackee_init_data
- Start the application
.. code-block:: bash
$ fittrackee
- Start task queue workers
.. code-block:: bash
$ fittrackee_worker --processes 2
.. note::
| To start application and workers with **systemd** service, see `Deployment <installation.html#deployment>`__
Upgrade
^^^^^^^
.. warning::
| Before upgrading, make a backup of all data:
| - database (with `pg_dump <https://www.postgresql.org/docs/11/app-pgdump.html>`__ for instance)
| - upload directory (see `Environment variables <installation.html#environment-variables>`__)
- Activate the virtualenv
- Upgrade with pip
.. code-block:: bash
$ pip install -U fittrackee
- Update environment variables if needed and source environment variables file
.. code-block:: bash
$ nano .env
$ source .env
- Upgrade database if needed
.. code-block:: bash
$ fittrackee_upgrade_db
- Restart the application and task queue workers.
From sources
~~~~~~~~~~~~~
.. warning::
| Since FitTrackee 0.2.1, Python packages installation needs Poetry.
| To install it on ArchLinux:
.. code-block:: bash
$ yay poetry
$ poetry --version
Poetry 1.0.10
# optional
$ poetry config virtualenvs.in-project true
For other OS, see `Poetry Documentation <https://python-poetry.org/docs/#installation>`__
Installation
^^^^^^^^^^^^
Dev environment
"""""""""""""""
- Clone this repo:
.. code:: bash
$ git clone https://github.com/SamR1/FitTrackee.git
$ cd FitTrackee
- Create **Makefile.custom.config** from example and update it
(see `Environment variables <installation.html#environment-variables>`__).
- Install Python virtualenv, React and all related packages and
initialize the database:
.. code:: bash
$ make install-dev
$ make install-db
- Start the server and the client:
.. code:: bash
$ make serve
- Run dramatiq workers:
.. code:: bash
$ make run-workers
Open http://localhost:3000 and log in (the email is ``admin@example.com``
and the password ``mpwoadmin``) or register
Production environment
""""""""""""""""""""""
.. warning::
| Note that FitTrackee is under heavy development, some features may be unstable.
- Download the last release (for now, it is the release v0.4.0):
.. code:: bash
$ wget https://github.com/SamR1/FitTrackee/archive/v0.4.0.tar.gz
$ tar -xzf v0.4.0.tar.gz
$ mv FitTrackee-0.4.0 FitTrackee
$ cd FitTrackee
- Create **Makefile.custom.config** from example and update it
(see `Environment variables <installation.html#environment-variables>`__).
- Install Python virtualenv and all related packages:
.. code:: bash
$ make install-python
- Initialize the database (**after updating** ``db/create.sql`` **to change
database credentials**):
.. code:: bash
$ make install-db
- Start the server and dramatiq workers:
.. code:: bash
$ make run
Open http://localhost:5000, log in as admin (the email is
``admin@example.com`` and the password ``mpwoadmin``) and change the
password
Upgrade
^^^^^^^
.. warning::
| Before upgrading, make a backup of all data:
| - database (with `pg_dump <https://www.postgresql.org/docs/11/app-pgdump.html>`__ for instance)
| - upload directory (see `Environment variables <installation.html#environment-variables>`__)
Dev environment
"""""""""""""""
- Stop the application and pull the repository:
.. code:: bash
$ git pull
- Update **.env** if needed
- Upgrade packages and database:
.. code:: bash
$ make install-dev
$ make upgrade-db
- Restart the server:
.. code:: bash
$ make serve
- Run dramatiq workers:
.. code:: bash
$ make run-workers
Prod environment
""""""""""""""""
- Stop the application and pull the repository:
.. code:: bash
$ git pull
- Update **Makefile.custom.config** if needed
- Upgrade packages and database:
.. code:: bash
$ make install
$ make upgrade-db
- Restart the server and dramatiq workers:
.. code:: bash
$ make run
Deployment
~~~~~~~~~~~~~
There are several ways to start **FitTrackee** web application and task queue
library.
One way is to use a **systemd** services and **Nginx** to proxy pass to **Gunicorn**.
Examples (to update depending on your application configuration and given distribution):
- for application: ``fittrackee.service``
.. code-block::
[Unit]
Description=FitTrackee service
After=network.target
After=postgresql.service
After=redis.service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=<USER>
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=fittrackee
Environment="APP_SECRET_KEY="
Environment="APP_LOG="
Environment="UPLOAD_FOLDER="
Environment="DATABASE_URL="
Environment="UI_URL="
Environment="EMAIL_URL="
Environment="SENDER_EMAIL="
Environment="REDIS_URL="
Environment="TILE_SERVER_URL="
Environment="MAP_ATTRIBUTION="
Environment="WEATHER_API_KEY="
WorkingDirectory=/home/<USER>/<FITTRACKEE DIRECTORY>
ExecStart=/home/<USER>/<FITTRACKEE DIRECTORY>/.venv/bin/gunicorn -b 127.0.0.1:5000 "fittrackee:create_app()" --error-logfile /home/<USER>/<FITTRACKEE DIRECTORY>/gunicorn.log
Restart=always
[Install]
WantedBy=multi-user.target
- for task queue workers: ``fittrackee_workers.service``
.. code-block::
[Unit]
Description=FitTrackee task queue service
After=network.target
After=postgresql.service
After=redis.service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=<USER>
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=fittrackee_workers
Environment="FLASK_APP=fittrackee"
Environment="APP_SECRET_KEY="
Environment="APP_LOG="
Environment="UPLOAD_FOLDER="
Environment="DATABASE_URL="
Environment="UI_URL="
Environment="EMAIL_URL="
Environment="SENDER_EMAIL="
Environment="REDIS_URL="
WorkingDirectory=/home/<USER>/<FITTRACKEE DIRECTORY>
ExecStart=/home/<USER>/<FITTRACKEE DIRECTORY>/.venv/bin/flask worker --processes <NUMBER OF PROCESSES>
Restart=always
[Install]
WantedBy=multi-user.target
- **Nginx** configuration:
.. code-block::
server {
listen 443 ssl;
server_name example.com;
ssl_certificate fullchain.pem;
ssl_certificate_key privkey.pem;
location / {
proxy_pass http://127.0.0.1:5000;
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;
}
}
server {
listen 80;
server_name example.com;
location / {
return 301 https://example.com$request_uri;
}
}
.. note::
More information on `Gunicorn documentation <https://docs.gunicorn.org/en/stable/deploy.html>`__

View File

@ -0,0 +1,10 @@
Administrator
#############
`JSON.parse: unexpected character at line 1 column 1 of the JSON data`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
On the **Network Tab**, if the requests are made to `http://localhost:3000/undefined/api`, that means the environnement variable **REACT_APP_API_URL** is not initialized.
Check if **Makefile.custom.config** file exists and **REACT_APP_API_URL** is correctly initialized (see `example <https://github.com/SamR1/FitTrackee/blob/master/Makefile.custom.config.example>`__), and rebuild the client.

View File

@ -0,0 +1,9 @@
Troubleshooting
#################
.. toctree::
:maxdepth: 2
:caption: Endpoints:
administrator
user

View File

@ -0,0 +1,5 @@
User
####
``TODO``