Installing multiple snaps on a server

Hi everyone,

I’m in the process of reorganizing my team’s technical infrastructure, and I’m considering using snaps since they seems simple, secure, and they automatically update. I have a few questions that I’m having a hard time finding answers to by just googling around.

  1. Is it possible to install multiple snaps on a server and serve them from different subdomains? If so, what is the simplest way of doing this?

  2. I’ve seen that there is a certbot snap package that is supposed to handle Let’s Encrypt certs for you. Is this usable under a server serving multiple snaps under different subdomains?

I realize these are large questions that probably have many different answers, so I don’t expect a full explanation here, but maybe just a link to a larger article or some ideas of what I could be googling around for.

Thanks in advance!

Hi @JHSheridan, all snaps run on your host, so they all share the network interface. To put different snaps under different subdomains, you would need something to be a front for them all, haproxy comes to mind. The snaps in question would need to listen on different ports or maybe loopback addresses and then haproxy would “multiplex” it all onto a single public listening socket.

One potential caveat is logging the client IPs, the snap services would see the requests coming from haproxy, not from the actual client, so you’d need to configure the services to respect the X-Forwarded-For (and similar) headers. See haproxy's manual for more information.

In that scenario it’s normally haproxy that would do your SSL termination (no need to encrypt communication between the snaps and haproxy if it never leaves localhost), so yeah certbot could certainly help there.

Hope this helps :slight_smile: