diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..afc8be29 --- /dev/null +++ b/.env.example @@ -0,0 +1,28 @@ +# Custom variables initialisation +# (can overwrite variables present in Makefile.config) + +# Application +# export FLASK_APP=fittrackee +# export HOST= +# export PORT= +# export APP_SETTINGS=fittrackee.config.ProductionConfig +export APP_SECRET_KEY= +# export APP_WORKERS= +export APP_LOG=fittrackee.log +export UPLOAD_FOLDER= + +# Database +# export DATABASE_URL=postgres://fittrackee:fittrackee@${HOST}:5432/fittrackee +export DATABASE_DISABLE_POOLING= + +# Emails +export UI_URL= +export EMAIL_URL= +export SENDER_EMAIL= +export REDIS_URL= +# export WORKERS_PROCESSES= + +# Activities +export TILE_SERVER_URL= +export MAP_ATTRIBUTION= +export WEATHER_API_KEY= diff --git a/.flake8 b/.flake8 index f8b7f348..0ca5d880 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,6 @@ [flake8] per-file-ignores = fittrackee/activities/stats.py:E501 + fittrackee/application/app_config.py:E501 fittrackee/tests/test_email.py:E501 fittrackee/tests/test_email_template_password_request.py:E501 diff --git a/.gitignore b/.gitignore index fbd1fc83..a017eab0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ uploads .cache .coverage coverage.xml +.env .pytest_cache .venv /fittrackee.egg-info/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 189058d3..72a6fd2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,21 @@ # Change log -## Version 0.x.x (unreleased) +## Version 0.4.0 (unreleased) + +This version introduces some major changes: +- Installation becomes more easy. +⚠️ 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 1 issue weas closed. +In this release 2 issue were closed. ## Version 0.3.0 - Administration (2020/07/15) diff --git a/Makefile b/Makefile index c24e3cdf..ff4ff8ea 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ include Makefile.config --include Makefile.custom.config +-include .env .SILENT: make-p: @@ -12,6 +12,9 @@ build-client: lint-client clean-install: rm -fr $(NODE_MODULES) rm -fr $(VENV) + rm -rf *.egg-info + rm -rf .pytest_cache + rm -rf dist/ html: rm -rf docsrc/build @@ -43,7 +46,8 @@ install-client: cd fittrackee_client && $(NPM) install --prod install-client-dev: - cd fittrackee_client && $(NPM) install + # https://github.com/facebook/create-react-app/issues/8688 + cd fittrackee_client && $(NPM) install && sed -i '/process.env.CI/ s/isInteractive [|]*//' node_modules/react-scripts/scripts/start.js install-dev: install-client-dev install-python-dev @@ -88,10 +92,10 @@ run-workers: $(FLASK) worker --processes=$(WORKERS_PROCESSES) >> dramatiq.log 2>&1 serve-python: - $(FLASK) run --with-threads -h $(HOST) -p $(API_PORT) + $(FLASK) run --with-threads -h $(HOST) -p $(PORT) serve-python-dev: - $(FLASK) run --with-threads -h $(HOST) -p $(API_PORT) --cert=adhoc + $(FLASK) run --with-threads -h $(HOST) -p $(PORT) --cert=adhoc serve-client: cd fittrackee_client && $(NPM) start diff --git a/Makefile.config b/Makefile.config index 600747ca..ae3ecb9d 100644 --- a/Makefile.config +++ b/Makefile.config @@ -1,12 +1,20 @@ -HOST = 0.0.0.0 -API_PORT = 5000 -CLIENT_PORT = 3000 +export HOST = 0.0.0.0 +export PORT = 5000 +export CLIENT_PORT = 3000 export FLASK_APP = $(PWD)/fittrackee/__main__.py -export FLASK_ENV=development -export TEST_APP_URL = http://$(HOST):$(API_PORT) -export TEST_CLIENT_URL = http://$(HOST):$(CLIENT_PORT) export MIGRATIONS = $(PWD)/fittrackee/migrations +export APP_WORKERS = 1 +export WORKERS_PROCESSES = 1 + +# for dev env +export FLASK_ENV = development +export APP_SETTINGS = fittrackee.config.DevelopmentConfig +export DATABASE_URL = postgres://fittrackee:fittrackee@$(HOST):5432/fittrackee +export DATABASE_TEST_URL = postgres://fittrackee:fittrackee@$(HOST):5432/fittrackee_test +export TEST_APP_URL = http://$(HOST):$(PORT) +export TEST_CLIENT_URL = http://$(HOST):$(CLIENT_PORT) +export REACT_APP_API_URL= $(TEST_APP_URL) # Python env PYTHON_VERSION ?= python diff --git a/Makefile.custom.config.example b/Makefile.custom.config.example deleted file mode 100644 index e060d517..00000000 --- a/Makefile.custom.config.example +++ /dev/null @@ -1,19 +0,0 @@ -# dramatiq (task queue) -WORKERS_PROCESSES = 1 - -export DATABASE_URL = postgres://fittrackee:fittrackee@$(HOST):5432/fittrackee -export DATABASE_TEST_URL = postgres://fittrackee:fittrackee@$(HOST):5432/fittrackee_test -export APP_SETTINGS=fittrackee.config.DevelopmentConfig -export APP_LOG=fittrackee.log -export DATABASE_DISABLE_POOLING=True -export TILE_SERVER_URL= -export MAP_ATTRIBUTION= -export WEATHER_API= -export UI_URL= -export EMAIL_URL= -export SENDER_EMAIL= -export REDIS_URL= -export UPLOAD_FOLDER= - -# for dev env -export REACT_APP_API_URL= diff --git a/README.md b/README.md index 59098a11..f8d7b050 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ [![React Version](https://img.shields.io/badge/react-16.13-brightgreen.svg)](https://reactjs.org/) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/290a285f22e94132904dc13b4dd19d1d)](https://www.codacy.com/app/SamR1/FitTrackee) -[![Codacy Coverage Badge](https://api.codacy.com/project/badge/Coverage/290a285f22e94132904dc13b4dd19d1d)](https://www.codacy.com/app/SamR1/FitTrackee)1 -[![Build Status](https://travis-ci.org/SamR1/FitTrackee.svg?branch=master)](https://travis-ci.org/SamR1/FitTrackee) +[![pipeline status](https://gitlab.com/SamR1/FitTrackee/badges/master/pipeline.svg)](https://gitlab.com/SamR1/FitTrackee/-/commits/master) 1 +[![coverage report](https://gitlab.com/SamR1/FitTrackee/badges/master/coverage.svg)](https://gitlab.com/SamR1/FitTrackee/-/commits/master) --- @@ -24,10 +24,10 @@ Examples (for Android): 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 development (not ready for production).** +**Still under heavy development (some features may be unstable).** (see [issues](https://github.com/SamR1/FitTrackee/issues) and [documentation](https://samr1.github.io/FitTrackee) for more information) -![FitTrackee Dashboard](docsrc/source/_images/fittrackee_screenshot-01.png) +![FitTrackee Dashboard Screenshot](https://samr1.github.io/FitTrackee/_images/fittrackee_screenshot-01.png) --- diff --git a/VERSION b/VERSION index 578dca39..1d0ba9ea 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0-beta +0.4.0 diff --git a/docs/.buildinfo b/docs/.buildinfo index e366c7d8..ed0f9702 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: a3a1209a3cacde0f31b654185a93ca76 +config: 3bbd9f6e4f2cf4ec861ef46913ee1f93 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_images/fittrackee_screenshot-01.png b/docs/_images/fittrackee_screenshot-01.png index 9a6f4e7f..710e01e3 100644 Binary files a/docs/_images/fittrackee_screenshot-01.png and b/docs/_images/fittrackee_screenshot-01.png differ diff --git a/docs/_images/fittrackee_screenshot-02.png b/docs/_images/fittrackee_screenshot-02.png index 16df2a1a..c90ee136 100644 Binary files a/docs/_images/fittrackee_screenshot-02.png and b/docs/_images/fittrackee_screenshot-02.png differ diff --git a/docs/_images/fittrackee_screenshot-03.png b/docs/_images/fittrackee_screenshot-03.png index 80a31501..30448c2e 100644 Binary files a/docs/_images/fittrackee_screenshot-03.png and b/docs/_images/fittrackee_screenshot-03.png differ diff --git a/docs/_images/fittrackee_screenshot-04.png b/docs/_images/fittrackee_screenshot-04.png index a5bd089b..3c883bfe 100644 Binary files a/docs/_images/fittrackee_screenshot-04.png and b/docs/_images/fittrackee_screenshot-04.png differ diff --git a/docs/_images/fittrackee_screenshot-05.png b/docs/_images/fittrackee_screenshot-05.png index fe63fe7e..55f96c4a 100644 Binary files a/docs/_images/fittrackee_screenshot-05.png and b/docs/_images/fittrackee_screenshot-05.png differ diff --git a/docs/_sources/changelog.md.txt b/docs/_sources/changelog.md.txt index 189058d3..72a6fd2c 100644 --- a/docs/_sources/changelog.md.txt +++ b/docs/_sources/changelog.md.txt @@ -1,14 +1,21 @@ # Change log -## Version 0.x.x (unreleased) +## Version 0.4.0 (unreleased) + +This version introduces some major changes: +- Installation becomes more easy. +⚠️ 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 1 issue weas closed. +In this release 2 issue were closed. ## Version 0.3.0 - Administration (2020/07/15) diff --git a/docs/_sources/features.rst.txt b/docs/_sources/features.rst.txt index 326541eb..b10b3f46 100644 --- a/docs/_sources/features.rst.txt +++ b/docs/_sources/features.rst.txt @@ -4,13 +4,10 @@ Features List ~~~~ -Account -^^^^^^^ -- A user can create, update and deleted his account -- Password reset is now available - Administration ^^^^^^^^^^^^^^ +(*new in 0.3.0*) + - **Application** The following parameters can be set: @@ -30,6 +27,12 @@ Administration - 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: diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index aef1f88c..8c1f30b3 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -22,7 +22,7 @@ FitTrackee Map `__. | It is also possible to add a workout without a gpx file. -| **Still under development (not ready for production).** +| **Still under heavy development (some features may be unstable).** | (see `issues `__ for more information) .. figure:: _images/fittrackee_screenshot-01.png diff --git a/docs/_sources/installation.rst.txt b/docs/_sources/installation.rst.txt index f885c9af..c48a453f 100644 --- a/docs/_sources/installation.rst.txt +++ b/docs/_sources/installation.rst.txt @@ -22,194 +22,221 @@ Prerequisites - PostgreSQL database (10+) - Redis for task queue - Python 3.7+ -- `Poetry `__ -- `Yarn `__ and - `serve `__ +- `Poetry `__ (for installation from sources only) - API key from `Dark Sky `__ [not mandatory] - SMTP provider +- `Yarn `__ (for development only) +- Docker (for development only, to start `MailHog `__) - -Installation -~~~~~~~~~~~~ - -| 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. - -.. 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.5 - - # optional - $ poetry config virtualenvs.in-project true - - For other OS, see `Poetry Documentation `__ - - -Dev environment -^^^^^^^^^^^^^^^ - -- Clone this repo: - -.. code:: bash - - $ 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: - -.. 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 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): - -.. code:: bash - - $ 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: - -.. code:: bash - - $ make install - $ make install-db - -- Build the client: - -.. code:: bash - - $ make build-client - -- Start the server and the client: - -.. code:: bash - - $ make run - -- Run dramatiq workers: - -.. code:: bash - - $ 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:: - | Before upgrading, make a backup of all data: - | - database (with `pg_dump `__ for instance) - | - upload directory: **FitTrackee/fittrackee/fittrackee_api/uploads/** - - -Dev environment -^^^^^^^^^^^^^^^ - -- Stop the application and pull the repository: - -.. code:: bash - - $ git pull - -- Update **Makefile.config** and **Makefile.custom.config** file if needed - -- Upgrade packages and database: - -.. code:: bash - - $ make install-dev - $ make upgrade-db - -- Restart the server and the client: - -.. code:: bash - - $ make serve - - -Prod environment -^^^^^^^^^^^^^^^^ - -``TODO`` +.. 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 ~~~~~~~~~~~~~~~~~~~~~ -The following environment variables must be defined in **Makefile.custom.config**: +.. warning:: + | Since FitTrackee 0.4.0, ``Makefile.custom.config`` is replaced by ``.env`` -.. cssclass:: table-bordered table-striped +The following environment variables are used by **FitTrackee** web application +or the task processing library. They are not all mandatory depending on +deployment method. -===================================== ============================================== ==================================== -variable description app default value -===================================== ============================================== ==================================== -``REACT_APP_API_URL`` Fittrackee API URL no default value, must be initialized -``REACT_APP_GPX_LIMIT_IMPORT`` max. number of gpx file in zip archive 10 (*deprecated in 0.3.0*) -``REACT_APP_MAX_SINGLE_FILE_SIZE`` max. size of a gpx or picture file 1MB (*deprecated in 0.3.0*) -``REACT_APP_MAX_ZIP_FILE_SIZE`` max. size of a zip archive 10MB (*deprecated in 0.3.0*) -``REACT_APP_ALLOW_REGISTRATION`` allows users to register true (*deprecated in 0.3.0*) -``REACT_APP_THUNDERFOREST_API_KEY`` ThunderForest API key (*deprecated in 0.x.x*, use ``TILE_SERVER_URL`` **and** ``MAP_ATTRIBUTION`` instead) -``TILE_SERVER_URL`` Tile server URL (with api key if needed) ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` -``MAP_ATTRIBUTION`` Map attribution (if using another tile server) ``© OpenStreetMap contributors`` -``UI_URL`` application URL no default value, must be initialized -``EMAIL_URL`` email URL with credentials no default value, must be initialized (see below) -``SENDER_EMAIL`` application sender email address no default value, must be initialized -``REDIS_URL`` Redis instance used by Dramatiq local Redis instance -``WORKERS_PROCESSES`` number of process used by Dramatiq no default value, must be initialized -===================================== ============================================== ==================================== +.. 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 `__. + + :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 `__. + + +.. 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 `__. + + :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 `__. + + :default: `© OpenStreetMap 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 `__ + + 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. + | 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 ^^^^^^ -*new in 0.3.0* +.. versionadded:: 0.3.0 To send emails, a valid ``EMAIL_URL`` must be provided: @@ -220,15 +247,392 @@ To send emails, a valid ``EMAIL_URL`` must be provided: Map tile server ^^^^^^^^^^^^^^^ -*new in 0.x.x* +.. 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 `__). -To keep using ThunderForest Outdoors, the configuration is: +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 +- ``TILE_SERVER_URL=https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=XXXX`` where **XXXX** is **ThunderForest** API key - ``MAP_ATTRIBUTION=© Thunderforest, © OpenStreetMap contributors`` .. note:: - Check the terms of service of tile provider for map attribution \ No newline at end of file + | 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 ''; + GRANT ALL PRIVILEGES ON DATABASE fittrackee TO fittrackee; + +- Initialize environment variables, see `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 `__ + + +Upgrade +^^^^^^^ + +.. warning:: + | Before upgrading, make a backup of all data: + | - database (with `pg_dump `__ for instance) + | - upload directory (see `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 `__ + + +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 `__). + +- 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 `__). + +- 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 `__ for instance) + | - upload directory (see `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= + 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// + ExecStart=/home///.venv/bin/gunicorn -b 127.0.0.1:5000 "fittrackee:create_app()" --error-logfile /home///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= + 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// + ExecStart=/home///.venv/bin/flask worker --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 `__ \ No newline at end of file diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 1eff1713..92180c3d 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -54,18 +54,37 @@ body { } .alert-danger { - background-color: #dc6460; - border-color: transparent; + background-color: #f2dede; + border-color: #dca7a7; + color: #a94442; } .alert-info { - background-color: #3eb3e3; - border-color: transparent; + background-color: #d9edf7; + border-color: #9acfea; + color: #31708f; } .alert-warning { - background-color: #f5894f; - border-color: transparent; + background-color: #fcf8e3; + border-color: #f5e79e; + color: #8a6d3b; +} + +.descname { + border-top: solid 3px #a18bac; + border-radius: unset; + padding: 6px; +} + +dl.field-list > dt { + background: #f0f0f0; + border-left: solid 3px #ccc; + color: #555; +} + +.envvar { + margin-top: 30px; } .footer { diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index cadf7bec..b6159af3 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.4.0-beta', + VERSION: '0.4.0', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/api/activities.html b/docs/api/activities.html index 35267dc0..7aa0682a 100644 --- a/docs/api/activities.html +++ b/docs/api/activities.html @@ -4,7 +4,7 @@ - Activities — FitTrackee 0.4.0-beta + <title>Activities — FitTrackee 0.4.0 documentation @@ -40,7 +40,8 @@ FitTrackee - 0.4.0 + 0.4.0 + -
-

Installation

+
+

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.
-
-

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

-
-
Before upgrading, make a backup of all data:
-
- database (with pg_dump for instance)
-
- upload directory: FitTrackee/fittrackee/fittrackee_api/uploads/
-
-
-
-

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

REACT_APP_API_URL

Fittrackee API URL

no default value, must be initialized

REACT_APP_GPX_LIMIT_IMPORT

max. number of gpx file in zip archive

10 (deprecated in 0.3.0)

REACT_APP_MAX_SINGLE_FILE_SIZE

max. size of a gpx or picture file

1MB (deprecated in 0.3.0)

REACT_APP_MAX_ZIP_FILE_SIZE

max. size of a zip archive

10MB (deprecated in 0.3.0)

REACT_APP_ALLOW_REGISTRATION

allows users to register

true (deprecated in 0.3.0)

REACT_APP_THUNDERFOREST_API_KEY

ThunderForest API key

(deprecated in 0.x.x, use TILE_SERVER_URL and MAP_ATTRIBUTION instead)

TILE_SERVER_URL

Tile server URL (with api key if needed)

https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

MAP_ATTRIBUTION

Map attribution (if using another tile server)

&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors

UI_URL

application URL

no default value, must be initialized

EMAIL_URL

email URL with credentials

no default value, must be initialized (see below)

SENDER_EMAIL

application sender email address

no default value, must be initialized

REDIS_URL

Redis instance used by Dramatiq

local Redis instance

WORKERS_PROCESSES

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.

+
+
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.

+
+
+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.
+
+
+ +
+
+HOST
+

FitTrackee host.

+
+
Default
+

0.0.0.0

+
+
+
+ +
+
+PORT
+

FitTrackee port.

+
+
Default
+

5000

+
+
+
+ +
+
+APP_SETTINGS
+

FitTrackee configuration.

+
+
Default
+

fittrackee.config.ProductionConfig

+
+
+
+ +
+
+APP_SECRET_KEY
+

FitTrackee secret key, must be initialized in production environment.

+
+ +
+
+APP_WORKERS
+

Number of workers spawned by Gunicorn.

+
+
Default
+

1

+
+
+
+ +
+
+APP_LOG 🆕
+
+

New in version 0.4.0.

+
+

Path to log file

+
+ +
+
+UPLOAD_FOLDER 🆕
+
+

New in version 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.
+
+
+
+ +
+
+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
+
+
+ +
+
+DATABASE_DISABLE_POOLING 🆕
+
+

New in version 0.4.0.

+
+

Disable pooling if needed (when starting application with FitTrackee entry point and not directly with Gunicorn), +see SqlAlchemy documentation.

+
+
Default
+

false

+
+
+
+ +
+
+UI_URL
+

FitTrackee URL, needed for links in emails.

+
+ +
+
+EMAIL_URL
+
+

New in version 0.3.0.

+
+

Email URL with credentials, see Emails.

+
+ +
+
+SENDER_EMAIL
+
+

New in version 0.3.0.

+
+

FitTrackee sender email address.

+
+ +
+
+REDIS_URL
+
+

New in version 0.3.0.

+
+

Redis instance used by Dramatiq.

+
+
Default
+

local Redis instance (redis://)

+
+
+
+ +
+
+WORKERS_PROCESSES
+
+

New in version 0.3.0.

+
+

Number of processes used by Dramatiq.

+
+ +
+
+TILE_SERVER_URL 🆕
+
+

New in version 0.4.0.

+
+

Tile server URL (with api key if needed), see Map tile server.

+
+
Default
+

https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

+
+
+
+ +
+
+MAP_ATTRIBUTION 🆕
+
+

New in version 0.4.0.

+
+

Map attribution (if using another tile server), see Map tile server.

+
+
Default
+

&copy; <a href=”http://www.openstreetmap.org/copyright” target=”_blank” rel=”noopener noreferrer”>OpenStreetMap</a> contributors

+
+
+
+ +
+
+WEATHER_API_KEY
+
+

Changed in version 0.4.0: ⚠️ replaces WEATHER_API

+
+

Dark Sky API key for weather data (not mandatory).

+
+ +
+
+REACT_APP_API_URL
+

FitTrackee API URL, only needed in dev environment.

+
+ +
+

Deprecated variables

+
+
+REACT_APP_GPX_LIMIT_IMPORT
+
+

Deprecated since version 0.3.0: now stored in database

+
+

Maximum number of gpx file in zip archive.

+
+
Default
+

10

+
+
+
+ +
+
+REACT_APP_MAX_SINGLE_FILE_SIZE
+
+

Deprecated since version 0.3.0: now stored in database

+
+

Maximum size of a gpx or picture file.

+
+
Default
+

1MB

+
+
+
+ +
+
+REACT_APP_MAX_ZIP_FILE_SIZE
+
+

Deprecated since version 0.3.0: now stored in database

+
+

Maximum size of a zip archive.

+
+
Default
+

10MB

+
+
+
+ +
+
+REACT_APP_ALLOW_REGISTRATION
+
+

Deprecated since version 0.3.0: now stored in database

+
+

Allows users to register.

+
+
Default
+

true

+
+
+
+ +
+
+REACT_APP_THUNDERFOREST_API_KEY
+
+

Deprecated since version 0.4.0: see 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

-

new in 0.3.0

+
+

New in version 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

  • @@ -411,20 +504,402 @@ Related environment variables are needed to initialize database.

Map tile server

-

new in 0.x.x

+
+

New in version 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).

-

To keep using ThunderForest Outdoors, the configuration is:

+

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

  • +
  • 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

+
+
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

  • +
+
$ pip install fittrackee
+
+
+
    +
  • Create fittrackee database

  • +
+

Example :

+
CREATE DATABASE fittrackee;
+CREATE USER fittrackee WITH PASSWORD '<PASSWORD>';
+GRANT ALL PRIVILEGES ON DATABASE fittrackee TO fittrackee;
+
+
+ +

For instance, copy and update .env file from .env.example and source the file.

+
$ nano .env
+$ source .env
+
+
+
    +
  • Upgrade database schema

  • +
+
$ fittrackee_upgrade_db
+
+
+
    +
  • Initialize database

  • +
+
$ fittrackee_init_data
+
+
+
    +
  • Start the application

  • +
+
$ fittrackee
+
+
+
    +
  • Start task queue workers

  • +
+
$ fittrackee_worker --processes 2
+
+
+
+

Note

+
+
To start application and workers with systemd service, see Deployment
+
+
+
+
+

Upgrade

+
+

Warning

+
+
Before upgrading, make a backup of all data:
+
- database (with pg_dump for instance)
+
- upload directory (see Environment variables)
+
+
+
    +
  • Activate the virtualenv

  • +
  • Upgrade with pip

  • +
+
$ pip install -U fittrackee
+
+
+
    +
  • Update environment variables if needed and source environment variables file

  • +
+
$ nano .env
+$ source .env
+
+
+
    +
  • Upgrade database if needed

  • +
+
$ 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:
+
+
$ yay poetry
+$ poetry --version
+Poetry 1.0.10
+
+# optional
+$ poetry config virtualenvs.in-project true
+
+
+

For other OS, see Poetry Documentation

+
+
+

Installation

+
+

Dev environment

+
    +
  • Clone this repo:

  • +
+
$ git clone https://github.com/SamR1/FitTrackee.git
+$ cd FitTrackee
+
+
+
    +
  • Create Makefile.custom.config from example and update it +(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 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):

  • +
+
$ 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).

  • +
  • Install Python virtualenv and all related packages:

  • +
+
$ make install-python
+
+
+
    +
  • Initialize the database (after updating db/create.sql to change +database credentials):

  • +
+
$ make install-db
+
+
+
    +
  • Start the server and dramatiq workers:

  • +
+
$ 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 for instance)
+
- upload directory (see Environment variables)
+
+
+
+

Dev environment

+
    +
  • Stop the application and pull the repository:

  • +
+
$ git pull
+
+
+
    +
  • Update .env if needed

  • +
  • Upgrade packages and database:

  • +
+
$ make install-dev
+$ make upgrade-db
+
+
+
    +
  • Restart the server:

  • +
+
$ make serve
+
+
+
    +
  • Run dramatiq workers:

  • +
+
$ make run-workers
+
+
+
+
+

Prod environment

+
    +
  • Stop the application and pull the repository:

  • +
+
$ git pull
+
+
+
    +
  • Update Makefile.custom.config if needed

  • +
  • Upgrade packages and database:

  • +
+
$ make install
+$ make upgrade-db
+
+
+
    +
  • Restart the server and dramatiq workers:

  • +
+
$ 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

  • +
+
[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

  • +
+
[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:

  • +
+
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

+
+
diff --git a/docs/objects.inv b/docs/objects.inv index 71396824..ab61ea66 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/search.html b/docs/search.html index e5daae17..19f0af01 100644 --- a/docs/search.html +++ b/docs/search.html @@ -4,7 +4,7 @@ - Search — FitTrackee 0.4.0-beta + <title>Search — FitTrackee 0.4.0 documentation @@ -44,7 +44,8 @@ FitTrackee - 0.4.0 + 0.4.0 +