Simple yet powerful echo server for development purposes
231
Simple echo server that echos messages, its supports both gRPC and Http
$ git clone https://github.com/msolimans/icho
$ cd icho
$ go build -mod=vendor
$ docker pull msolimans/icho
$ docker run -ti --rm -p 8888:8888 -p 9999:9999 msolimans/icho
Open you browser and point to http://localhost:8888/echo, you should see {response: "hello world"}
If you want to override response you can do that through query string, something like
http://localhost:8888/echo?text=foo
If you want to echo based on http POST, try the following:
$ curl --request POST --data-raw '"foo message"' \
http://localhost:8888/echo
{"response":"foo message"}
If you want to override response through environment variable
$ docker run -ti --rm \
-e ECHO_TEXT="foo response" \
-p 8888:8888 -p 9999:9999 \
msolimans/icho
$ curl http://localhost:8888/echo
{"response":"foo response"}
If you want to override ports, you can pass http and grpc ports like below
$ docker run --rm -ti \
-p 7777:7777 \
-p 6666:6666 \
msolimans/icho -http=6666 -grpc=7777
Starting REST service :6666
Starting gRPC service :7777
If you want to try gRPC, open proto file under icho directory in any of the gRPC client tools and use port 9999
Here's gRPC Client, https://github.com/uw-labs/bloomrpc
Create deployment resource:
$ touch icho.yml
$ vim icho.yml
Add the following:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: icho
name: icho
spec:
replicas: 1
selector:
matchLabels:
run: icho
template:
metadata:
labels:
run: icho
spec:
containers:
- image: msolimans/icho
name: icho
ports:
- containerPort: 8888
Create deployment:
$ kubectl create -f icho.yml
Expose deployment as a NodePort service:
$ kubectl expose deploy \
--name ichosvc \
--target-port=8888 --port=8888 \
--type=NodePort \
icho
open your browser http://localhost:8888/echo
If you're using minikube, open it using:
$ minikube service ichosvc
$ git clone https://github.com/msolimans/icho
$ cd icho
$ docker-compose up
Content type
Image
Digest
Size
3.5 MB
Last updated
about 5 years ago
docker pull msolimans/icho