BretFisher / dogvscat

Sample Docker Swarm cluster stack of tools
http://dogvs.cat
MIT License
504 stars 127 forks source link

Add cache to Ghost blog service #8

Open BretFisher opened 6 years ago

BretFisher commented 6 years ago

Since the Ghost service can only have a single replica (Ghost design limitation), it's expected to have a caching proxy in front of it, which itself could be multi-replica for better LB/HA. I'm thinking the best options here are varnish or nginx, which would be another service in the Ghost stack file.

pascalandy commented 5 years ago

I'll be very curious to see the architecture you have in mind. There is an issue on Traefik's GitHub but it goes nowhere at this point.

BretFisher commented 5 years ago

I was assuming a cache container in front of Ghost node container. So traffic would be:

client --> cloud LB-->swarm ingress-->traefik-->proxy overlay-->cache-->ghost overlay-->ghost

I'm normally a nginx guy, and have done reverse proxy caching with it before, but thought it would be fun to try varnish in this project, which I haven't used.

Hopefully, we can use one of these images:

pascalandy commented 5 years ago

If I understand well, in a case where I have 5 Ghost instances, I would need 5 varnish instances.

client—>cloud LB—>swarm ingress—>traefik—>proxy overlay—>Varnish_Caching_1—>Ghost overlay—>Ghost_1
                                                       —>Varnish_Caching_2—>Ghost overlay—>Ghost_2
                                                       —>Varnish_Caching_n—>Ghost overlay—>Ghost_n

I actually like this. Not all my clients needs to have a caching instance :-p

BretFisher commented 5 years ago

Yes, it would be a 1-to-1. The other option would be to replace layer 7 reverse proxy (Traefik) with something that can do both DNS routing and caching... like nginx... but I feel like that's harder to get right.

pascalandy commented 5 years ago

Thanks for your input on this :) BTW, I'll will not replace Traefik anytime soon :-p

pascalandy commented 5 years ago

I'm not very knowledgeable with Caddy, but it sounds like an elegant solution