A web server to manage requests for meshes and routes generated using the PolarRoute and MeshiPhi libraries, implemented using Django, Celery and Django REST framework.
It currently takes vessel meshes created using MeshiPhi and serves requests for routes, which are calculated using PolarRoute.
PolarRouteServer can be installed from GitHub using pip
.
- Inside a virtual environment (e.g. venv, conda, etc.) run
pip install git+https://github.com/bas-amop/PolarRoute-server
- To install a specific version append the tag, e.g.
pip intall git+https://github.com/bas-amop/[email protected]
- Alternatively, clone this repository with git and install from source with
pip install -e .
- To install a specific version append the tag, e.g.
Use docker compose for development deployment to orchestrate celery and rabbitmq alongside the django development server.
Clone this repository and run docker compose up
to build and start the services.
Note: In development, meshes are not automatically ingested into the database. Follow these steps to add a mesh to the database.
- Make a local directory structure with
mkdir -p data/mesh
and copy a vessel mesh file from MeshiPhi into./data/mesh
, which is bind-mounted into the app container. - Run
docker compose exec app /bin/bash
to open a shell inside the running app container. - Run
django-admin insert_mesh /usr/src/app/data/mesh/<MESH FILENAME>
to insert the mesh into the database manually.
Test that the app is working using the demo tool (see Documentation). The URL of the service should be localhost:8000
.
The django development server supports hot reloading and the source code is bind-mounted into the container, so changes should be reflected in the running app. Any changes to polarrouteserver.route_api.models.py
will necessitate a migration to the database. To create and run migrations, run:
docker compose exec app django-admin makemigrations
docker compose exec app django-admin migrate
Optionally, Swagger can be used to serve an API schema. This is not started by default, but can be enabled by started docker compose
with the --profile swagger
option, e.g. docker compose --profile swagger up -d
- the swagger UI will be served at localhost:80/swagger
.