V2: equivalent to V1 CADDYPATH?

I’m trying to deploy Caddy 2.0 beta 10 as a systemd service on Ubuntu 18.04 LTS, basing my service definition largely on the “official” one for Caddy 1.

It appears as if Caddy 2.0 doesn’t look at the CADDYPATH env var anymore.
Is there already a way to tell Caddy 2.0 where to put the certificates, ideally via the Caddyfile or command line options?

(Currently I’m getting obtaining certificate: failed storage check: mkdir /var/www: permission denied errors, because Caddy is trying to create /var/www but I have Environment=CADDYPATH=/etc/ssl/caddy in my service definition, because that’s where I’d like the certs to go.)

Thanks in advance for any help and hats off for the great work so far!

Cheers,
Matz

In v2, you’ll customize the storage in your config:

{
	"storage": {
		"module": "file_system",
		"root": "/etc/ssl/caddy"
	}
}

The Caddyfile has an equivalent global option for storage.

Damn, sorry, I somehow missed this piece of the docs.
Thank you so much!

This is how things work for me now in the Caddyfile:

{
  storage file_system {
    root /etc/ssl/caddy
  }
}
3 Likes

@matt Is there any reason not to use /etc/ssl/caddy as the “storage” location?

I guess what I’m really asking is, is anything besides SSL stuff being stored in “storage”?

Yes. :slight_smile: