miekg / caddy-prometheus

Prometheus metrics middleware for caddy
Apache License 2.0
65 stars 26 forks source link

Restart failed: [prometheus] failed to obtain certificate #47

Closed angristan closed 5 years ago

angristan commented 5 years ago

Caddy 0.11.4.

My Caddyfile:

root@caddy ~# cat /etc/caddy/Caddyfile
import vhosts/*

prometheus

On restart:

Feb 27 21:22:36 caddy caddy[18493]: 2019/02/27 21:22:36 [INFO] [prometheus] acme: Obtaining bundled SAN certificate
Feb 27 21:22:37 caddy systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Feb 27 21:22:37 caddy systemd[1]: caddy.service: Unit entered failed state.
Feb 27 21:22:37 caddy systemd[1]: caddy.service: Failed with result 'exit-code'.

On reload:

Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [INFO] SIGUSR1: Reloading
Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [INFO] Reloading
Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [INFO][FileStorage:/etc/ssl/caddy] Started certificate maintenance routine
Feb 27 21:20:53 caddy systemd[1]: Reloaded Caddy HTTP/2 web server.
Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [INFO] [prometheus] acme: Obtaining bundled SAN certificate
Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [ERROR] Restart failed: [prometheus] failed to obtain certificate: acme: error: 400 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:malformed :: Error creating new order :: DNS name does not have enough labels, url:
Feb 27 21:20:53 caddy caddy[18132]: 2019/02/27 21:20:53 [ERROR] SIGUSR1: starting with listener file descriptors: [prometheus] failed to obtain certificate: acme: error: 400 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:malformed :: Error creating new order :: DNS name does not have enough labels, url:
angristan commented 5 years ago

In your Caddyfile :

prometheus

For each virtual host that you want to see metrics for.

That last line solved my problem. (🤦‍♂️)