Skip to main content

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):

Example leeway output

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.

Installation

  1. Clone this repository and change into the new directory:
    gh repo clone digitalfabrik/leeway
    cd leeway
    
  2. Create a virtual environment and activate it:
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install the dependencies:
    pip install -e .[dev]
    
  4. Create minimal config file /etc/opendrift-leeway-webgui.ini to enable DEBUG mode:
    [base]
    DEBUG = True
    
  5. Initialize the database:
    cd opendrift_leeway_webgui
    python3 manage.py migrate
    python3 manage.py createsuperuser
    

Development Server

  1. Switch into the cloned project and then into the opendrift_leeway_webgui subdirectory.
  2. Open two terminals:
    1. In the first terminal run:
      source ../.venv/bin/activate
      python3 manage.py runserver
      
    2. 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:

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

Production Server

This details the installation on Debian with Apache2 and mod_wsgi.

  1. Create target directory on the production system:
    sudo mkdir /opt/iopendrift-leeway-webgui
    sudo chown www-data:www-data /opt/opendrift-leeway-webgui
    
  2. Create the virtual environment:
    sudo -u www-data bash
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install the application into the virtual environment:
    pip install opendrift-leeway-webgui
    
  4. Copy the example config file to /etc/opendrift-leeway-webgui.ini and fill in the template
  5. Install Docker and add the docker group to the www-data user.
  6. Create symlink to facilitate the Apache configuration:
    ln -s $(python -c "from opendrift_leeway_webgui.core import wsgi; print(wsgi.__file__)") .
    
  7. Configure Apache2 according to the example.
  8. Set up Celery worker with leeway-celery.service and start the service.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opendrift-leeway-webgui-2022.12.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file opendrift-leeway-webgui-2022.12.0.tar.gz.

File metadata

File hashes

Hashes for opendrift-leeway-webgui-2022.12.0.tar.gz
Algorithm Hash digest
SHA256 4f4b7034679e41462d5e18a73cfc8935fc76594d847cfcc2b8d62d41e4956277
MD5 76879e05ce40c8dfb6e1d817fa32a590
BLAKE2b-256 51e4ced7461bd644367002fe288383c9140c1cf2836bdf2db3fdb77f0e19aa8c

See more details on using hashes here.

File details

Details for the file opendrift_leeway_webgui-2022.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opendrift_leeway_webgui-2022.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac819ad1fd1b48b63fea5a6a81c06c5b9e9dff4e81213e20d2d054f287e3c6f0
MD5 9856b318f1da31e3359645adff19831e
BLAKE2b-256 8f675faa155fb6d8a71ac18586d3821e0d20b5b5bf4848a40e2f2bd83e3ad7c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page