Skip to content

iamtrungbui/caddy-api-gateway-demo

 
 

Repository files navigation

Caddy API gateway demo

Use caddy as microservice API gateway in docker swarm.

Build Status

Requirements

  • Docker Engine 1.13+
  • docker-compose 1.11.2+

Notice

The image in docker-compose is build by Dockerfile.app and Dockerfile.gateway in this demo. I've host it in docker hub, so you can use it in next step directly. You can also build the image by yourself, then don't forget to change the image name in docker-compose.yml

Run Server

Pull images from docker hub(~30M):

docker-compose pull

Run

docker stack deploy -c docker-compose.yml caddy

Try

Because of caddy's proxy connection reuse feature, you can't test this demo by visit http://{your-host-ip}:2015 in your browser. I write a client to send concurrent requests.
If you have docker,

docker run --rm -it muninn/caddy-microservice:client

You can also use unix shell version:

cd client
sh test.sh

app will tell you which container it is running in.

About

Use caddy as API gateway in microservice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 70.3%
  • Shell 29.7%