Web GUI for Leeway simulations with OpenDrift
Project description
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 enableDEBUG
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
- In the first terminal run:
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 thewww-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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opendrift-leeway-webgui-2024.1.0.tar.gz
.
File metadata
- Download URL: opendrift-leeway-webgui-2024.1.0.tar.gz
- Upload date:
- Size: 209.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da593cda951024407f0570d997386f8b4dfe635e27a3b34ead7e1cab3ca65091 |
|
MD5 | ed5b1c7f4853f853e3b66acaa70e90f0 |
|
BLAKE2b-256 | 1ebe2b166f48defc872730ad73eda2dd8d636ff778e12a57df4483e223186671 |
File details
Details for the file opendrift_leeway_webgui-2024.1.0-py3-none-any.whl
.
File metadata
- Download URL: opendrift_leeway_webgui-2024.1.0-py3-none-any.whl
- Upload date:
- Size: 218.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a32e53f29d86bf70449f7368ed31400ed734d8f468c65b89baab828e58deefed |
|
MD5 | f7926865e0c71dd5bb58b6380d8df707 |
|
BLAKE2b-256 | 300b438a95c390afbd2888ca1167e08675d29a9f24638dad2e0c0b3de64dcb1f |