All Projects → peter-evans → nominatim-k8s

peter-evans / nominatim-k8s

Licence: MIT license
Nominatim for Kubernetes on Google Container Engine (GKE).

Programming Languages

shell
77523 projects
Dockerfile
14818 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to nominatim-k8s

osrm-backend-k8s
Open Source Routing Machine (OSRM) osrm-backend for Kubernetes on Google Container Engine (GKE).
Stars: ✭ 34 (-42.37%)
Mutual labels:  google-cloud, gke, canary-deployment, pbf
nominatim-docker
Docker image for Nominatim
Stars: ✭ 33 (-44.07%)
Mutual labels:  nominatim, pbf
multer-sharp
Streaming multer storage engine permit to resize and upload to Google Cloud Storage.
Stars: ✭ 21 (-64.41%)
Mutual labels:  google-storage, google-cloud
gtoken
Securely access AWS services from GKE cluster
Stars: ✭ 43 (-27.12%)
Mutual labels:  google-cloud, gke
build-a-platform-with-krm
Build a platform with the Kubernetes resource model!
Stars: ✭ 55 (-6.78%)
Mutual labels:  google-cloud, gke
kubernetes-vault-example
Placeholder for training material related to TA usage of Vault for securing Kubernetes apps.
Stars: ✭ 16 (-72.88%)
Mutual labels:  google-cloud, gke
Microservices Demo
Sample cloud-native application with 10 microservices showcasing Kubernetes, Istio, gRPC and OpenCensus.
Stars: ✭ 11,369 (+19169.49%)
Mutual labels:  google-cloud, gke
Cloud Ops Sandbox
Cloud Operations Sandbox is an open source tool that helps practitioners to learn Service Reliability Engineering practices from Google and apply them on their cloud services using Cloud Operations suite of tools.
Stars: ✭ 191 (+223.73%)
Mutual labels:  google-cloud
Flysystem Google Cloud Storage
Flysystem Adapter for Google Cloud Storage
Stars: ✭ 237 (+301.69%)
Mutual labels:  google-cloud
Psgsuite
Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
Stars: ✭ 184 (+211.86%)
Mutual labels:  google-cloud
Google Cloud Cpp
C++ Client Libraries for Google Cloud Services
Stars: ✭ 233 (+294.92%)
Mutual labels:  google-cloud
Googlecloudarchitectprofessional
Resources to prepare for Google Certified Cloud Architect Professional Exam - 2017
Stars: ✭ 177 (+200%)
Mutual labels:  google-cloud
Google Cloud Go
Google Cloud Client Libraries for Go.
Stars: ✭ 2,720 (+4510.17%)
Mutual labels:  google-cloud
Online Courses Learning
Contains the online course about Data Science, Machine Learning, Programming Language, Operating System, Mechanial Engineering, Mathematics and Robotics provided by Coursera, Udacity, Linkedin Learning, Udemy and edX.
Stars: ✭ 193 (+227.12%)
Mutual labels:  google-cloud
Golang Samples
Sample apps and code written for Google Cloud in the Go programming language.
Stars: ✭ 3,088 (+5133.9%)
Mutual labels:  google-cloud
Nodejs Docs Samples
Node.js samples for Google Cloud Platform products.
Stars: ✭ 2,309 (+3813.56%)
Mutual labels:  google-cloud
poto
multi cloud storage to image gallery + image proxy + file api - 350 LOC.
Stars: ✭ 20 (-66.1%)
Mutual labels:  google-storage
Scio
A Scala API for Apache Beam and Google Cloud Dataflow.
Stars: ✭ 2,247 (+3708.47%)
Mutual labels:  google-cloud
Istio Gke
Istio service mesh walkthrough (GKE, CloudDNS, Flagger, OpenFaaS)
Stars: ✭ 207 (+250.85%)
Mutual labels:  google-cloud
Php Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 246 (+316.95%)
Mutual labels:  google-cloud

Nominatim for Kubernetes

CircleCI

Nominatim for Kubernetes on Google Container Engine (GKE).

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

Supported tags and respective Dockerfile links

Usage

The Docker image can be run standalone without Kubernetes:

docker run -d -p 8080:8080 \
-e NOMINATIM_PBF_URL='http://download.geofabrik.de/asia/maldives-latest.osm.pbf' \
--name nominatim peterevans/nominatim-k8s:latest

Tail the logs to verify the database has been built and Apache is serving requests:

docker logs -f <CONTAINER ID>

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

Kubernetes Deployment

Nominatim's data import from the PBF file into PostgreSQL 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 single database in storage that is used by all pods in the deployment. Each pod having its own database is desirable in order to have no single point of failure. The alternative to this solution is to maintain a HA PostgreSQL cluster.

PostgreSQL's data directory is archived in storage and restored on new pods. While this may be a crude method of copying the database it is much faster than pg_dump/pg_restore and reduces the pod startup time.

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 database to be created and its archive uploaded to Google Storage.
  4. Delete the canary deployment.
  5. Deploy the stable track deployment.

To update the live deployment with new PBF data:

  1. Deploy the canary deployment alongside the stable track deployment.
  2. Wait for the database to be created and its archive 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 database.

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 nominatim-storage-secret --from-file=$KEY_FILE

Deployment configuration

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

  • NOMINATIM_MODE - CREATE from PBF data, or RESTORE from Google Storage.
  • NOMINATIM_PBF_URL - URL to PBF data file. (Optional when NOMINATIM_MODE=RESTORE)
  • NOMINATIM_DATA_LABEL - A meaningful and unique label for the data. e.g. maldives-20161213
  • NOMINATIM_SA_KEY_PATH - Path to the JSON service account key. This needs to match the mountPath of the volume mounted secret.
  • NOMINATIM_PROJECT_ID - Google Cloud project ID.
  • NOMINATIM_GS_BUCKET - Google Storage bucket.
  • NOMINATIM_PG_THREADS - Number of threads available for PostgreSQL. Defaults to 2.

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].