FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
12 stars 17 forks source link

Unit_Tests Actions Status

FAI Airscore

This was originally a fork of Geoff Wong's airScore. It has been ported to python 3.7, it's structure has been completely redesigned and many additional features added.

Web middle layer & front end has been ported to flask/jquery using flask cookie cutter template.

Features:

GAP based Paragliding and Hang Gliding scoring from IGC files.

The GAP rules have changed over the years. Here are the features that airscore includes or not.

Installation:

Airscore is setup to be installed and run inside Docker containers. For production use, Airscore needs a MySQL database to connect to. You will need to setup or use a hosted mysql server. For development use, there is the choice of using an hosted database as above in production or a MySQL database that is in a docker container on the same system as Airscore.


Hosted Database option (Production and Development)

Database setup

The database is not included in the docker containers. Once you have the DB server, use the file airscore.sql to create the table and views. Database credentials should be saved in the .env file (see below)

Environment and configuration variables

defines.yaml.example and .env.example should be renamed or copied without ".example" to create the two config files.

If you wish to develop on the host system and run airscore code outside of the docker containers, use the file dev.yaml (rename it from dev.yaml example) to set the variables that would otherwise be environment variables inside the docker containers (and therefore inaccessible to the host system). If the file is present these settings will override what is in the .env file

Application start

This app should be run completely using Docker and docker-compose. Using Docker is recommended, as it guarantees the application is run using compatible versions of Python and Node. You may need to install docker and docker-compose on your system.

There are 2 options to run the app. One is the production configuration and one development. If you are developing you may still want to run the production version as some features of Airscore are incompatible with the flask development web server. Airscore will still work, however some features will not display. If you are running the development configuration the flask development server will provide useful debugging info in the browser.

To run the development configuration of the app

docker-compose -f docker-compose-dev.yml up

To run the production configuration of the app

docker-compose up

Once the app is running you can navigate to localhost port 5000 (typically http://0.0.0.0:5000 or http://127.0.0.1:5000 or htttp://http://localhost:5000) in your browser to use Airscore.

The production version uses several containers running together:

A docker volume node-modules is created to store NPM packages and is reused across the dev and prod versions of the application. For the purposes of DB testing with sqlite, the file dev.db is mounted to all containers. This volume mount should be removed from docker-compose.yml if a production DB server is used.


Local Development Database option

The database is included in the docker containers. The first time the containers run, the database will be setup from the included airscore.sql file. The data will persist when the containers are stopped or rebuilt as it is stored in the dev.db directory on the host system. If you wish to reset the database (delete and recreate) simply delete the contents of the dev.db directory and restart the docker-compose.

As well as the database, the setup also includes Adminer which is browser based DB admin utility. You can access this by navigating to http://localhost:8080/ and logging in with the credentials in the docker-compose file (defaults are: server:db, username:root, password:airscore, database:airscore)

Environment and configuration variables

defines.yaml.example and .env.example should be renamed or copied without ".example" to create the two config files.

If you wish to develop on the host system and run Airscore code outside of the docker containers, use the file dev.yaml (rename it from dev.yaml example) to set the variables that would otherwise be environment variables inside the docker containers (and therefore inaccessible to the host system). If the file is present these settings will override what is in the .env file

Application start

This app should be run completely using Docker and docker-compose. Using Docker is recommended, as it guarantees the application is run using compatible versions of Python and Node.

Again there are 2 options to run the app. If you are developing you may still want to run the production version as some features of Airscore are incompatible with the flask development web server. Airscore will still work, however some features will not display. If you are running the development configuration the flask development server will provide useful debugging info in the browser.

Note that the first time you run the docker-compose the database setup may take longer than the application start up. In that case there will be an error. Simply wait until the database is finished (evident in the shell) and stop and restart (ctl-c to stop) However you can avoid this by running the database service by itself the first time:

sudo docker-compose -f docker-compose-dev-local.yml up db 

Once it has finished setting up you can stop it and run all services together with one of the below commands.

To run the development configuration of the app

sudo docker-compose -f docker-compose-dev-local.yml up

To run the production configuration of the app

sudo docker-compose -f docker-compose-prod-local.yml up

Once the app is running you can navigate to localhost port 5000 (typically http://0.0.0.0:5000 or http://127.0.0.1:5000 or htttp://http://localhost:5000) in your browser to use Airscore. Adminer is on localhost port 8080


Running Tests

To run all tests, run

sudo docker-compose -f docker-compose-tests.yml run --rm tests test

flask test # If running from within docker

License

Apart from igc_lib which has a MIT license and bootstrap all rest of the code is provided under the GPL License version 2 described in the file "Copying".

If this is not present please download from www.gnu.org.