I’ve got my setup working both locally and in production! But I imagine when I remove/replace my caddy container, it will request new certs from Let’s Encrypt. The way around this, I assume, is to persist the directory that the certs are stored in as a volume. But which directory should this be? The entire
/root) directory? That seems more than necessary, so thought I’d check as I couldn’t seem to find the answer in existing questions.
Also, in case anyone else stumbles upon this, my working
docker-compose.yml file has this for the caddy service:
If you’re running as root, then I think
/root/.caddy is all you need to persist.
Also, I’d recommend not using
restart: always, but instead
restart: unless-stopped. If you run into problems with certificate issuance, you don’t want to have Caddy continually restart, because then you’ll hit rate limits and potentially lock yourself from using your domain until the rate limits time out (which is usually 1 week).
Hm, that directory doesn’t seem to exist (at least on the alpine image). Here’s what I see in
/root/.local/share/caddy/ contains 3 directories:
Am I missing something? If not, what should be persisted?
EDIT: Actually, shouldn’t I be able to set the location where they’re stored? I was planning on mounting a volume to my droplet/VM, so I’ll need to put them in a specific place if I truly want to persist them, no?
Caddy 2 respects the XDG standard. Here’s the respective documentation page.
My mistake for giving you incorrect information - thanks @Mohammed90 for linking to the right place
Yes, those two directories you mentioned are all you should need to persist.
You can set the XDG environment variables on your container to change those base paths as well if you prefer.
Great, thanks both of you
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.