opendrift-leeway-webgui 2024.1.0

Creator: codyrutscher

Last updated:

Add to Cart

Description:

opendriftleewaywebgui 2024.1.0

About
This is a little Django web application that does an OpenDrift Leeway simulation with a set of provided parameters via a web form. The result is sent to a user via e-mail.
This is an experimental tool to help Search and Rescue operations. An experimental service is available at leeway.tuerantuer.org.
Sample output from the leeway tool (100 points, 1km radius, south of Lampedusa):

Usage
Django users have to be created in the CRUD backend, available at https://leeway.example.com/admin. E-mail addresses should be added for users as they receive the result via e-mail.
The program regularly fetches incoming mails via IMAP and starts simulations from key-value-pairs in the mail subject or text body. The sender of the mail needs to have an associated account. Allowed keys via e-mail are: longitude, latitude, object_type, radius, duration, start_time. The separator between key and value is =. Key-value-pairs are separated by ; in the subject and by new lines in the text body. The date format for start date is YYYY-MM-DD HH:MM:SS.
API usage
API documentation can be found at: https://leeway.tuerantuer.org/api/docs/
Authentication can be provided in two ways:

Via your session cookie, obtained from the normal login
Via an authentication token, can be obtained via /api/auth/login/

Installation
Prerequisite: Python 3.8 or later is required.

Clone this repository and change into the new directory:
git clone git@github.com:digitalfabrik/opendrift-leeway-webgui.git leeway
cd leeway


Create a virtual environment outside of the project directory and activate it:
python3 -m venv ~/.venv
source ~/.venv/bin/activate


Install the dependencies:
pip install -e .[dev]


Create minimal config file /etc/opendrift-leeway-webgui.ini to enable DEBUG mode:
[base]
DEBUG = True


Initialize the database:
cd opendrift_leeway_webgui
python3 manage.py migrate
python3 manage.py createsuperuser


Build the enhanced Docker container:
cd opendrift
docker build -t opendrift-leeway-custom .



Development Server

Switch into the cloned project and then into the opendrift_leeway_webgui subdirectory.
Open two terminals:

In the first terminal run:
source ../.venv/bin/activate
python3 manage.py runserver


In the second terminal run:
source ../.venv/bin/activate
celery -A leeway worker -l INFO





Releasing
Run bumpver update to perform the following tasks with one command:

Bump the version in pyproject.toml
Create a version bump commit
Create a new version tag
Push the commit and tag
Create a new release on PyPI via GitHub Actions

Production Server
This details the installation on Debian with Apache2 and mod_wsgi.

Create target directory on the production system:
sudo mkdir /opt/iopendrift-leeway-webgui
sudo chown www-data:www-data /opt/opendrift-leeway-webgui


Create the virtual environment:
sudo -u www-data bash
python3 -m venv .venv
source .venv/bin/activate


Install the application into the virtual environment:
pip install opendrift-leeway-webgui


Copy the example config file to /etc/opendrift-leeway-webgui.ini and fill in the template
Install Docker and add the docker group to the www-data user.
Create symlink to facilitate the Apache configuration:
ln -s $(python -c "from opendrift_leeway_webgui.core import wsgi; print(wsgi.__file__)") .


Configure Apache2 according to the example.
Set up Celery worker with leeway-celery.service and start the service.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.