Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Latest commit

 

History

History
152 lines (105 loc) · 4.24 KB

README.md

File metadata and controls

152 lines (105 loc) · 4.24 KB

Build Status MIT License

OpenMoves

An open source alternative to Movescount.

Key features

  • Free and open-source software
  • OpenStreetMap integration
  • Strava import
  • Plots with curve smoothing

Requirements

Setup

# cp openmoves.cfg.default openmoves.cfg
# virtualenv virtualenv
# source virtualenv/bin/activate
# pip install -r requirements.txt
# ./openmoves.py add-user -u <your_username> [-p <your_password]

Configuration

Configurations and parameters of openmoves.cfg

Required:

  • SQLALCHEMY_DATABASE_URI Database URL to be used

Optional:

  • BING_MAPS_API_KEY Bing maps API key. If not configured the Bing maps layers are disabled. Get your own key at https://www.bingmapsportal.com
  • STRAVA_CLIENT_ID The client ID of the Strava application (example: 12345)
  • STRAVA_CLIENT_SECRET The client secret of the Strava application (example: 'ea01c8e942fd68a98d47ad96adb936a564089e2e')

Setting up with PostgreSQL

Start a Postgres database which stores all data in ./postgres-data/

$ docker-compose up -d

Adjust the SQLALCHEMY_DATABASE_URI in the openmoves.cfg

SQLALCHEMY_DATABASE_URI = 'postgresql://openmoves:openmoves@localhost:5432/openmoves'

Initialize the database schema

$ ./openmoves.py db upgrade

Running

# ./openmoves.py runserver
* Running on http://127.0.0.1:5000/

Open http://127.0.0.1:5000/ in your browser.

Testing

We use py.test to test server side code. Tests are executed with the following command given that your virtualenv is activated:

# py.test

If a test fails it might help to run in verbose mode and stop on the first failure:

# py.test -vsx

Note that the majority of unit tests write the latest HTML response to a local tempfile in /tmp/pytest-<your-username>/response.html using py.test's tmpdir mechansism.

JavaScript unit tests are written with QUnit and are not yet automated in the build and need to be run in a browser by browsing to:

http://127.0.0.1:5000/_tests

Hints or pull requests how to automate the qunit tests are welcome.

Deployment

We ship the openmoves.wsgi script to deploy OpenMoves in a Apache HTTP server with mod_wsgi.

Example configuration

<VirtualHost 127.0.0.1:80>
    ServerAlias your.domain
    ServerName your.domain

    DocumentRoot /var/www/openmoves

    AddDefaultCharset utf-8

    WSGIDaemonProcess openmoves user=openmoves group=openmoves processes=1 threads=5 python-home=/var/www/openmoves/virtualenv python-path=/var/www/openmoves lang='en_US.UTF-8' locale='en_US.UTF-8'
    WSGIScriptAlias   / /var/www/openmoves/openmoves.wsgi

    <Directory /var/www/openmoves>
        WSGIProcessGroup openmoves
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    </Directory>

    ServerAdmin [email protected]
</VirtualHost>

PostgreSQL

While OpenMoves uses an on-disk SQLite database by default, we recommend to deploy OpenMoves on a proper database such as PostgreSQL.

First create a database and login role. Then overwrite the openmoves default database url in the openmoves.cfg file:

SQLALCHEMY_DATABASE_URI = 'postgresql://<user>:<password>@localhost:5432/<database>'

Then create/upgrade the database schema with:

# ./openmoves.py db upgrade

Create an initial user:

# ./openmoves.py add-user -u <your_username>