dogvscat
dogvscat copied to clipboard
Add cache to Ghost blog service
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.
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.
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:
-
This one requires a varnish config file added as a swarm config, but looks flexible and up to date.
-
This one is ENVVAR heavy, which I like (very 12factor.net!) No configs needed hopefully.
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
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.
Thanks for your input on this :) BTW, I'll will not replace Traefik anytime soon :-p
I'm not very knowledgeable with Caddy, but it sounds like an elegant solution
- https://github.com/caddyserver/examples/tree/master/ghost
- https://caddyserver.com/docs/http.cache