echo_server_grpc

command module
v0.0.0-...-a2fc03f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

gRPC echo server

This is a simple Echo server built using Go and gRPC.

Run as docker container

To run the server as a Docker container, follow these steps:

  • Change ":9000" to "server:9000" in frontend.go (this is only required for Docker deployments).
  • docker build --tag echo-frontend -f Dockerfile-frontend .
  • docker build --tag echo-server -f Dockerfile-server .
  • docker network create test
  • docker run --rm -d --net test -p 9000:9000 --name server echo-server
  • docker run --rm -d --net test -p 8080:8080 --name frontend echo-frontend
  • curl http://localhost:8080/echo

Push docker container

  • Change ":9000" to "echo-server:9000" in frontend.go (this is only required for Kubernetes deployments).
  • docker build --tag echo-frontend -f Dockerfile-frontend .
  • docker build --tag echo-server -f Dockerfile-server .
  • docker tag echo-frontend xzhu0027/echo-frontend-grpc
  • docker push xzhu0027/echo-frontend-grpc
  • docker tag echo-server xzhu0027/echo-server-grpc
  • docker push xzhu0027/echo-server-grpc

How to build and run ACL wasm filter

The ACL Wasm Filter is a content-based Access Control List (ACL) implemented using WebAssembly (Wasm) written in Rust.

  • ./build_wasm.sh

    • This will build the ACL wasm written in rust to /tmp/content_based_acl.wasm.
  • kubectl apply -f echo-server-grpc-istio-full.yaml

    • This yaml file is generated by istioctl kube-inject -f echo-server-grpc-istio.yaml. It contains the Istio sidecar configuration with a volume that mounts the ACL Wasm Filter into the sidecar container's filesystem.
  • kubectl apply -f wasm_acl.yaml

    • Add the ACL wasm filter to echo server. By default, the filter blocks requests that match a certain string.

Note:

  • The ACL Wasm Filter can be customized to match different strings or patterns by modifying the lib.rs file.
  • You can check the wasm logs use kubectl logs <echo-server-pod-name> -c istio-proxy -f. (Need to use log.warn!)

How to build and run go filter

  • ./build_go_filter.sh
  • kubectl apply -f echo-server-grpc-istio-full.yaml
  • kubectl apply -f wasm_acl.yaml

Note: Go filter is not runnabel yet.. See reference: https://github.com/envoyproxy/envoy/tree/main/examples/golang-http/simple

Acknowledgement

Thanks to the mRPC team for the wasm rust code.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL