Skip to content

feuyeux/hello-grpc

Repository files navigation

Hello gRPC

Simple server and client examples showcasing gRPC features(including proxy and propagate, running in containers and kubernetes) with:

No. Lang Lib IDE
1 C++ grpc CLion
2 Rust tonic RustRover
3 Java grpc-java IDEA
4 Go grpc-go GoLand
5 C# grpc-dotnet Rider
6 Python grpcio PyCharm
7 Node.js grpc-js WebStorm
8 TypeScript grpc-js WebStorm
9 Dart grpc-dart PyCharm
10 Kotlin grpc-kotlin IDEA
11 Swift grpc-swift AppCode
12 PHP grpc-php PhpStorm

☕ What is

grpc_diagram

No. Lang 4 MODELS Collection Sleep Random Timestamp UUID Env
1 java 🍎 🍎 🍎 🍎 🍎 🍎 🍎
2 go 🍎 🍎 🍎 🍎 🍎 🍎 🍎
3 nodejs 🍎 🍎 🍎 🍎 🍎 🍎 🍎
4 typescript 🍎 🍎 🍎 🍎 🍎 🍎 🍎
5 python 🍎 🍎 🍎 🍎 🍎 🍎 🍎
6 rust 🍎 🍎 🍎 🍎 🍎 🍎 🍎
7 c++ 🍎 🍎 🍎 🍎 🍎 🍎 🍎
8 c# 🍎 🍎 🍎 🍎 🍎 🍎 🍎
9 kotlin 🍎 🍎 🍎 🍎 🍎 🍎 🍎
10 swift 🍎 🍎 🍎 🍎 🍎 🍎 🍎
11 dart 🍎 🍎 🍎 🍎 🍎 🍎 🍎
12 php 🍎 🍎 🍎 🍎 🍎 🍎 🍎
No. Lang Header TLS Proxy Docker Build UT LOG
1 java 🍎 🍎 🍎 🍎 maven junit5 log4j2
2 go 🍎 🍎 🍎 🍎 (mod) (testing) logrus
3 nodejs 🍎 🥑 🍎 🍎 npm mocha winston
4 typescript 🍎 🍏 🍏 🍎 yarn&tsc winston
5 python 🍎 🍎 🍎 🍎 pip (unittest) (logging)
6 rust 🍎 🍎 🍎 🍎 cargo (test) log4rs
7 c++ 🍎 🍎 🍎 🍎 bazel/cmake Catch2 glog
8 c# 🍎 🍎 🍎 🍎 nuget NUnit log4net
9 kotlin 🍎 🍎 🍎 🍎 gradle junit5 log4j2
10 swift 🍎 🍏 🍏 🍎 spm (XCTest) swift-log
11 dart 🍎 🍏 🍏 🍎 pub test logger
12 php 🍎 🍏 🍏 🍎 composer phpunit log4php

🍎 :apple: done 🍏 :green_apple: unimplemented 🥑 :avocado: known issues

☕ How to use

1 Envs

  • GRPC_SERVER: grpc server host on client side.
  • GRPC_SERVER_PORT: grpc server port on client side.
  • GRPC_HELLO_BACKEND: next grpc server host on server side.
  • GRPC_HELLO_BACKEND_PORT:next grpc server port on server side.
  • GRPC_HELLO_SECURE: set it as Y when you want to use TLS on both sides.

2 Containers

Running in containers sample:

client(kotlin) -[tls]:8881-> server1(java) -[tls]:8882-> server2(golang) -[tls]:8883-> server3(rust)

# server3(golang):8883
docker run --rm --name grpc_server_go -d \
 -p 8883:8883 \
 -e GRPC_SERVER_PORT=8883 \
 feuyeux/grpc_server_rust:1.0.0

# server2(rust):8882
docker run --rm --name grpc_server_rust -d \
 -p 8882:8882 \
 -e GRPC_SERVER_PORT=8882 \
 -e GRPC_HELLO_BACKEND=$(ipconfig getifaddr en0) \
 -e GRPC_HELLO_BACKEND_PORT=8883 \
 feuyeux/grpc_server_go:1.0.0

# server1(java):8881
docker run --rm --name grpc_server_java -d \
 -p 8881:8881 \
 -e GRPC_SERVER_PORT=8881 \
 -e GRPC_HELLO_BACKEND=$(ipconfig getifaddr en0) \
 -e GRPC_HELLO_BACKEND_PORT=8882 \
 feuyeux/grpc_server_java:1.0.0

# client(kotlin)
docker run --rm --name grpc_client_kotlin \
 -e GRPC_SERVER=$(ipconfig getifaddr en0) \
 -e GRPC_SERVER_PORT=8881 \
 feuyeux/grpc_client_kotlin:1.0.0

Docker-Mesh-Kube

3 Logs

Enable gRpc Debugging

export GRPC_VERBOSITY=DEBUG
export GRPC_TRACE=all

☕ Recommend

☕ Stars

Star History Chart

About

Demonstrate gRPC examples in 12 programming languages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •