All Projects â†’ peter-evans â†’ osrm-backend-k8s

peter-evans / osrm-backend-k8s

Licence: MIT license
Open Source Routing Machine (OSRM) osrm-backend for Kubernetes on Google Container Engine (GKE).

Programming Languages

shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to osrm-backend-k8s

nominatim-k8s
Nominatim for Kubernetes on Google Container Engine (GKE).
Stars: ✭ 59 (+73.53%)
Mutual labels:  google-cloud, gke, canary-deployment, pbf
routing-py
🌎 Python library to access all public routing, isochrones and matrix APIs in a consistent manner.
Stars: ✭ 106 (+211.76%)
Mutual labels:  osrm, osrm-backend
gtoken
Securely access AWS services from GKE cluster
Stars: ✭ 43 (+26.47%)
Mutual labels:  google-cloud, gke
kubernetes-vault-example
Placeholder for training material related to TA usage of Vault for securing Kubernetes apps.
Stars: ✭ 16 (-52.94%)
Mutual labels:  google-cloud, gke
build-a-platform-with-krm
Build a platform with the Kubernetes resource model!
Stars: ✭ 55 (+61.76%)
Mutual labels:  google-cloud, gke
Microservices Demo
Sample cloud-native application with 10 microservices showcasing Kubernetes, Istio, gRPC and OpenCensus.
Stars: ✭ 11,369 (+33338.24%)
Mutual labels:  google-cloud, gke
Osrm Backend
Open Source Routing Machine - C++ backend
Stars: ✭ 4,716 (+13770.59%)
Mutual labels:  osrm
perspectiveapi-authorship-demo
Example code to illustrate how to build an authorship experience using the perspective API
Stars: ✭ 62 (+82.35%)
Mutual labels:  google-cloud
node-isochrone
NodeJS isochrone map library
Stars: ✭ 27 (-20.59%)
Mutual labels:  osrm
Serverless Google Cloudfunctions
Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
Stars: ✭ 241 (+608.82%)
Mutual labels:  google-cloud
CloudConductor
CloudConductor is a workflow management system that generates and executes bioinformatics pipelines
Stars: ✭ 13 (-61.76%)
Mutual labels:  google-cloud
streamlit-project
This repository provides a simple deployment-ready project layout for a Streamlit app. Simply swap out the code in `app.py` for your own and hit deploy!
Stars: ✭ 33 (-2.94%)
Mutual labels:  google-cloud
spannerz
Google Cloud Spanner Query Planner Visualizer
Stars: ✭ 60 (+76.47%)
Mutual labels:  google-cloud
cloudrun-tutorial
A tutorial showing some of the features of Cloud Run
Stars: ✭ 79 (+132.35%)
Mutual labels:  google-cloud
migrate-for-anthos-gke
Migrate to Containers samples and best practices
Stars: ✭ 33 (-2.94%)
Mutual labels:  gke
google maps
🗺 An unofficial Google Maps Platform client library for the Rust programming language.
Stars: ✭ 40 (+17.65%)
Mutual labels:  google-cloud
Php Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 246 (+623.53%)
Mutual labels:  google-cloud
pydriosm
PyDriosm: an open-source tool for downloading, reading and PostgreSQL-based I/O of OpenStreetMap data
Stars: ✭ 42 (+23.53%)
Mutual labels:  pbf
auth
A GitHub Action for authenticating to Google Cloud.
Stars: ✭ 567 (+1567.65%)
Mutual labels:  google-cloud
traefik-gke-demo
Demo to use Traefik as GKE loadbalancer
Stars: ✭ 25 (-26.47%)
Mutual labels:  google-cloud

osrm-backend for Kubernetes

CircleCI

Open Source Routing Machine (OSRM) osrm-backend for Kubernetes on Google Container Engine (GKE).

This Docker image and sample Kubernetes configuration files are one solution to persisting osrm-backend data and providing immutable deployments.

If you are looking for a more general purpose docker image, see osrm-backend-docker.

Supported tags and respective Dockerfile links

For earlier versions see releases and the available tags on Docker Hub.

Usage

The Docker image can be run standalone without Kubernetes:

docker run -d -p 5000:5000 \
-e OSRM_PBF_URL='http://download.geofabrik.de/asia/maldives-latest.osm.pbf' \
--name osrm-backend peterevans/osrm-backend-k8s:latest

Tail the logs to verify the graph has been built and osrm-backend is serving requests:

docker logs -f <CONTAINER ID>

Then point your web browser to http://localhost:5000/

Kubernetes Deployment

The osrm-backend builds a data graph from a PBF file. This process can take over an hour for a single country. If a pod in a deployment fails, waiting over an hour for a new pod to start could lead to loss of service.

The sample Kubernetes files provide a means of persisting a data graph in storage that is used by all pods in the deployment. Each pod having their own copy of the graph is desirable in order to have no single point of failure.

Explanation

Initial deployment flow:

  1. Create a secret that contains the JSON key of a Google Cloud IAM service account that has read/write permissions to Google Storage.
  2. Deploy the canary deployment.
  3. Wait for the graph to be built and uploaded to Google Storage.
  4. Delete the canary deployment.
  5. Deploy the stable track deployment.

To update the live deployment with a new graph:

  1. Deploy the canary deployment alongside the stable track deployment.
  2. Wait for the graph to be built and uploaded to Google Storage.
  3. Delete the canary deployment.
  4. Perform a rolling update on the stable track deployment to create pods using the new graph.

Creating the secret

# Google Cloud project ID and service account details
PROJECT_ID=my-project
SA_NAME=my-service-account
SA_DISPLAY_NAME="My Service Account"
SA_EMAIL=$SA_NAME@$PROJECT_ID.iam.gserviceaccount.com
KEY_FILE=service-account-key.json

# Create a new GCP IAM service account
gcloud iam service-accounts create $SA_NAME --display-name "$SA_DISPLAY_NAME"

# Create and download a new key for the service account
gcloud iam service-accounts keys create $KEY_FILE --iam-account $SA_EMAIL

# Give the service account the "Storage Object Viewer" and "Storage Object Creator" IAM roles
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SA_EMAIL --role roles/storage.objectViewer
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SA_EMAIL --role roles/storage.objectCreator

# Create a secret containing the service account key file
kubectl create secret generic osrm-storage-secret --from-file=$KEY_FILE

Deployment configuration

Before deploying, edit the env section of both the canary deployment and stable track deployment.

  • OSRM_MODE - CREATE from PBF data, or RESTORE from Google Storage.
  • OSRM_PBF_URL - URL to PBF data file. (Optional when OSRM_MODE=RESTORE)
  • OSRM_GRAPH_PROFILE - Graph profile; car,bicycle or foot. (Optional when OSRM_MODE=RESTORE)
  • OSRM_DATA_LABEL - A meaningful and unique label for the data. e.g. maldives-car-20161209
  • OSRM_SA_KEY_PATH - Path to the JSON service account key. This needs to match the mountPath of the volume mounted secret.
  • OSRM_PROJECT_ID - Google Cloud project ID.
  • OSRM_GS_BUCKET - Google Storage bucket.

License

MIT License - see the LICENSE file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].