Copy LetsEncrypt Certificate on renewal

I am running Nextcloud in a snappy container with LetsEncrypt, which is really great. But I want to use the certificate for my xmpp server, too.

I am not sure how to approach this, because the snappy container seems to be a tightly knit system that may not get along with a custom solution. I have a some ideas in my mind:

  • I could copy the files out of the snappy container. Now I have the problem of timing: this should be done automatically when the certificate is renewed.

  • My xmpp server is on a different subdomain than my nextcloud server, so I could get a different certificate outside the snappy container. There is however the issue with the port 80 which is in use. And sudo snap stop nextcloud does not seem to unblock it.

  • I could change the permissions of the folder in the snap directory for my xmpp server to access them. I fear however that they may be reset at an arbitrary time

Do you have an elegant way to achieve what I am trying?

Thanks and best regards,