Deployment - HY-OHTUPROJ-OSRM/osrm-project GitHub Wiki

Preface

In production, this program should be run as Docker containers in a container orchestration platform.

This repository includes a template for deploying to an OpenShift cluster.

Deployment to OpenShift

The file osrm-project.yaml includes a template to deploy the application to a OpenShift cluster.

See the OpenShift Documentation and the Kubernetes Documentation for more info about how to interpret the .yaml file.

Before deploying

  • The Routes in osrm-project.yaml are hardcoded to an internal OpenShift cluster of the University of Helsinki. You need to change them to URLs for your own cluster.

  • routing-api and routing-front are built into a Quay.io registry and osrm-project.yaml will pull them there. Adjust the image URLs if building to a different location.

  • You will need to create a PersistentVolumeClaim for the PostGIS container called osrm-data in your OpenShift cluster manually.

  • You will need the oc application.

Deployment

  • Login to your OpenShift cluster with
oc login

using the appropriate arguments for your cluster.

  • Create/update the application described in osrm-project.yaml with the following command in the deployment folder of this repository:
oc process -f osrm-project.yaml -p POSTGRES_PASSWORD=<password> | oc apply -f -

Create a Postgres password of your choosing. The password to be chosen doesn't necessarily matter much as the Postgres pod is not exposed to the internet, but you might want to do that at some point for debugging, by creating a Route to the pod.

Changing the route dataset in OpenShift

  • The Docker image for routing-api comes with a limited region of Finland for easier testing.

  • If you want to use a different dataset, that doesn't come with the image, like the entire Finland dataset, you will need to create a PersistentVolumeClaim, upload the dataset file to it, mount the PersistentVolumeClaim to the routing-api Pod before startup and start with the environment variable ROUTE_DATA_PATH in the routing-api Pod set to the mounted path of the dataset file.

  • Uploading a file to a PersistentVolume can be done by creating a sort of helper Pod mounted to the PersistentVolume and using the oc rsync command to copy the dataset file from your local machine to the mounted path in the helper Pod, thereby copying the file to the PersistentVolume. The helper Pod can then be deleted.

⚠️ **GitHub.com Fallback** ⚠️