Giter VIP home page Giter VIP logo

grpc's Introduction

gRPC practice

Done while following this guide Udemy course: https://www.udemy.com/grpc-golang/

What's in this project

Three different go packages. All have to do with learning gRPC and are independent from each other

greet
  • Demoes types of gRPC communication (check it's proto file)
  • Uses SSL unlike the other two services
  • Proper gRPC error handling examples
  • Proper deadline examples
calculator
  • Lessons learned from greet. Where greet was instructor lead, calculator was meant for students to figure out their own solution
  • Not sure if it has proper eror/deadline examples. I might have implemented some.
blog
  • CRUD demonstration with a "blog" app.
  • Instructor lead, but I deviated and used DynamoDB.
  • If you are using my docker-compose.yml, there will be no need to worry about AWS credentials and region setup as I'm using a "dynamodb-local" image to provide the DynamoDB functionality.
  • Only of the three that uses DynamoDB
  • Not sure if it has proper eror/deadline examples. I might have implemented some.

Setup:

Requires:

  • docker
  • docker-compose
  • Optional (if you want to mess around with files directly without docker-compose)
    • GoLang 1.12+
    • Properly set-up GoLang environment (GOROOT/GOHOME)
    • make

Usage

Spin up the servers
docker-compose up
In a separate tab, run clients

Skip this if you just want to explore with Evans

## GREET

# Grabbing the SSL cert. Needed for greet_client because that has an SSL example
docker cp grpc_greet_1:/code/ssl/server.crt ssl/server.crt
go run github.com/Kaurin/gRPC/greet/greet_client

## CALCULATOR
go run github.com/Kaurin/gRPC/calculator/calculator_client

### BLOG
go run github.com/Kaurin/gRPC/blog/blog_client
Exploring the gRPC API manually with Evans

Unfortunately, Evans doesn't support a simple "go get -u" :(

# Install the "evans" utility. Check the Makefile for details
make evans

## GREET
# Grabbing the SSL cert. Needed for greet_client because that has an SSL example
docker cp grpc_greet_1:/code/ssl/server.crt ssl/server.crt
evans -p 50052 --tls --host localhost --cacert ssl/server.crt --reflection

## CALCULATOR
evans -p 50053 -r

## BLOG
evans -p 50051 -r

What you want in all three is to use call <functionName>.

Evans has tab-compoletion, but if you want to see all functions in a given run, then use show rpc.

Also, you can use ctrl+d to end sending messages in examples that require it, or to just bail on input.

Cleanup

Don't forget to run:

docker-compose down
Manual cleanup of remaining files

WARNING Please make sure to read the makefile before running the command

make cleanimages

grpc's People

Contributors

kaurin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.