[go: up one dir, main page]

Skip to content

This project is a POC of the API Composition Pattern but using gRPC, the idea is having the same proto file implemented in different services (micro or nano) and each service returns a piece of the information to the gateway.

Notifications You must be signed in to change notification settings

gbauso/grpc_microservices

Repository files navigation

gRPC Microservices

Overview

Deployed to Oketo -> https://grpc-ui-gbauso.cloud.okteto.net

This project is a POC of the API Composition Pattern but using gRPC, the idea is having the same proto file implemented in different services (micro or nano) and each service returns a piece of the information to the gateway.

Gateway

gateway

Discovery Service

discovery

Stack

In order to prove this concept, a set of tools and languages were chosen:

overview

How to run

Requirements

  • Account in New Relic (Url and API Key needed)
  • Open Weather API Key

Docker Compose

Before run docker-compose up, it's necessary creating a .env file (copying from .env.example) and setting values:

  • NR_BASE_URL -> New Relic logging base URL -> e.g https://log-api.eu.newrelic.com/log/v1
  • NR_API_KEY -> New Relic API Key with permissions for logging
  • OPENWEATHER_APP_ID -> Open Weather API KEY (APP ID)

After run docker compose up open GRPC-UI on http(s)://localhost:8080

Okteto (K8S)

Develop on Okteto

Before deploying to Okteto, you need to create some secrets (go to Setting -> Secrets):

  • NR_BASE_URL -> New Relic logging base URL -> e.g https://log-api.eu.newrelic.com/log/v1
  • NR_API_KEY -> New Relic API Key with permissions for logging
  • OPENWEATHER_ID -> Open Weather API KEY (APP ID)

After deploy to okteto open open GRPC-UI on https://grpc-ui-{yourOktetoUserOrNamespace}.cloud.okteto.net/

Kubernetes (With Istio)

Requisites

Kubectl configured, Helm Charts and Istio installed.

Windows

You can find a file called run.ps1 and follow the example.

e.g ./run.ps1 $OPENWEATHER_ID $NR_BASE_URL $NR_API_KEY $INSTALL_ISTIO_ADDONS

  • OPENWEATHER_ID -> Open Weather API KEY (APP ID)
  • NR_BASE_URL -> New Relic logging base URL -> e.g https://log-api.eu.newrelic.com/log/v1
  • NR_API_KEY -> New Relic API Key with permissions for logging
  • INSTALL_ISTIO_ADDONS -> Install Jaeger, Prometheus, Grafana and Kiali -> Values: 0 or 1
Linux/Mac

You can find a file called run.sh and follow the example.

e.g ./run.sh $OPENWEATHER_ID $NR_BASE_URL $NR_API_KEY $INSTALL_ISTIO_ADDONS

  • OPENWEATHER_ID -> Open Weather API KEY (APP ID)
  • NR_BASE_URL -> New Relic logging base URL -> e.g https://log-api.eu.newrelic.com/log/v1
  • NR_API_KEY -> New Relic API Key with permissions for logging
  • INSTALL_ISTIO_ADDONS -> Install Jaeger, Prometheus, Grafana and Kiali -> Values: true or false

After deploy to k8s open GRPC-UI on http(s)://ui.{yourDomain}/

Development

Want to contribute? Great!

Start development on this project is simple, fork the project and open it on VSCode or your preferred IDE. It will be a pleasure review your PR.

Todos

  • Finish configuration of Istio
  • Write Unit tests for the services
  • Unify the logs and improve readability
  • Move metrics from Prometheus to New Relic
  • Move from Azure Pipelines to Github Actions
  • Cover Server Stream, Client Stream and Bidirectional on Gateway
  • SSL on gRPC servers

License

MIT

About

This project is a POC of the API Composition Pattern but using gRPC, the idea is having the same proto file implemented in different services (micro or nano) and each service returns a piece of the information to the gateway.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published