I'm also relatively new to Traefik v2 and still trying to get my head around how to migrate my v1.x config. Following the docs for v2, I've created a new YAML file for my Traefik container and added a bunch of new labels to my Docker Compose file.
Initially I had a problem with declaring a common middleware across my containers which defines a bunch of HTTPS headers, redirecting HTTP-to-HTTPS and securing the /api endpoint which I've since resolved. I use the DNS-01 ACME challenge for LE certificate generation and have provided my DNSimple OAUTH token and API base URL as env vars to my Traefik container.
Now I have these in place, my Traefik container outputs a couple of errors I just can't seem to get my head around resolving.
level=error msg="Unable to obtain ACME certificate for domains \"vacuum.sub.domain.com\": unable to generate a certificate for the domains ... : acme: Error -> One or more domains had a problem:\n vacuum.sub.domain.com acme: error: 403 :: urn:ietf:params:acme:error:unauthorized :: No TXT record found at _acme-challenge.sub.domain.com, url: \n" providerName=default.acme rule="Host(vacuum.sub.domain.com)" routerName=vacuum
time="2019-09-25T05:16:17+02:00" level=error msg="middleware \"default@docker\" does not exist" entryPointName=web-secure routerName=vacuum@docker
Would really appreciate a bit of help understanding how I can resolve these and simplify my config.
Still getting me head around that and I think I might be best to use a static configuration for the middleware I'm calling 'default' which has the SSH header options.
So in my mind, I would create a file provider in traefik.yml like this:
Yep, that's sounds about right to me. Try that, and if you still get errors you cannot figure out, post here again!
I think you can also specify middleware via labels as per here but I personally would try to do what you are doing, because to me the yaml looks nicer than the corresponding labels.
Indeed, I can just see easily 20 labels per container, not so fun to maintain when if there is an option to declare a common set somewhere else as a directive.
Going further down the rabbit hole it seems instead of getting out!
Now getting:
time="2019-09-25T11:06:06+02:00" level=error msg="cannot create middleware: multi-types middleware not supported, consider declaring two different pieces of middleware instead" entryPointName=web routerName=vacuum@docker
and
time="2019-09-25T11:06:07+02:00" level=error msg="cannot create middleware: multi-types middleware not supported, consider declaring two different pieces of middleware instead" routerName=vacuum@docker entryPointName=web-secure
Also getting this
time="2019-09-25T11:07:16+02:00" level=error msg="Unable to obtain ACME certificate for domains \"domain.com,*.domain.com\" : unable to generate a certificate for the domains [domain.com *.domain.com]: acme: Error -> One or more domains had a problem:\n[*.domain.com] [*.domain.com] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/domain.com/records: 400 Zone record already exists\n[domain.com] time limit exceeded: last error: NS ns3.dnsimple.com. returned NXDOMAIN for _acme-challenge.domain.com.\n" providerName=default.acme
time="2019-09-25T11:07:16+02:00" level=error msg="Unable to obtain ACME certificate for domains \"domain.com,*.domain.com\" : unable to generate a certificate for the domains [domain.com *.domain.com]: acme: Error -> One or more domains had a problem:\n[*.domain.com] time limit exceeded: last error: NS ns1.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.domain.com., value: ...\n[domain.com] [domain.com] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/domain.com/records: 400 Zone record already exists\n" providerName=default.acme
I'm now getting the default Traefik self-signed root cert and a number of my endpoints are just returning a 404 with nothing to suggest there's a problem with fetching the cert
time="2019-09-25T11:07:16+02:00" level=error msg="Unable to obtain ACME certificate for domains \"domain.com,*.domain.com\" : unable to generate a certificate for the domains [domain.com *.domain.com]: acme: Error -> One or more domains had a problem:\n[*.domain.com] [*.domain.com] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/domain.com/records: 400 Zone record already exists\n[domain.com] time limit exceeded: last error: NS ns3.dnsimple.com. returned NXDOMAIN for _acme-challenge.domain.com.\n" providerName=default.acme
Non eXistent DOMAIN, so your domain (domain.com) don't exist or the A record is missing
time="2019-09-25T11:07:16+02:00" level=error msg="Unable to obtain ACME certificate for domains \"domain.com,*.domain.com\" : unable to generate a certificate for the domains [domain.com *.domain.com]: acme: Error -> One or more domains had a problem:\n[*.domain.com] time limit exceeded: last error: NS ns1.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.domain.com., value: ...\n[domain.com] [domain.com] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/domain.com/records: 400 Zone record already exists\n" providerName=default.acme
OK, so besides the invalid cert error now on some container endpoints, a few also just come back as a vanilla 404 from Traefik, it seems the redirect to SSL isn't being followed from the middlewares rule
@ldez - much progress made. I can now reach all my endpoints but I'm now getting a bunch of LE errors for DNS-01 challenge.
time="2019-09-26T00:46:44+02:00" level=error msg="Unable to obtain ACME certificate for domains \"replicant.vaulted.cloud,*.replicant.vaulted.cloud\" : unable to generate a certificate for the domains [replicant.vaulted.cloud *.replicant.vaulted.cloud]: acme: Error -> One or more domains had a problem:\n[*.replicant.vaulted.cloud] [*.replicant.vaulted.cloud] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/vaulted.cloud/records: 400 Zone record already exists\n" providerName=default.acme
time="2019-09-26T00:46:53+02:00" level=error msg="Unable to obtain ACME certificate for domains \"replicant.vaulted.cloud,*.replicant.vaulted.cloud\" : unable to generate a certificate for the domains [replicant.vaulted.cloud *.replicant.vaulted.cloud]: acme: Error -> One or more domains had a problem:\n[*.replicant.vaulted.cloud] failed to initiate challenge: acme: error: 400 :: POST :: https://acme-staging-v02.api.letsencrypt.org/acme/chall-v3/10441876/qgHu7w :: urn:ietf:params:acme:error:malformed :: Unable to update challenge :: authorization must be pending, url: \n[replicant.vaulted.cloud] [replicant.vaulted.cloud] acme: error presenting token: dnsimple: API call failed: POST https://api.dnsimple.com/v2/74286/zones/vaulted.cloud/records: 400 Zone record already exists\n" providerName=default.acme
time="2019-09-26T00:47:47+02:00" level=error msg="Unable to obtain ACME certificate for domains \"replicant.vaulted.cloud,*.replicant.vaulted.cloud\" : unable to generate a certificate for the domains [replicant.vaulted.cloud *.replicant.vaulted.cloud]: acme: Error -> One or more domains had a problem:\n[replicant.vaulted.cloud] time limit exceeded: last error: NS ns2.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.replicant.vaulted.cloud., value: nQ8U3r94qlYs92bmRUUv0avdrNG71cp8zjC_qPtuujs]: \n" providerName=default.acme
time="2019-09-26T00:48:12+02:00" level=error msg="Unable to obtain ACME certificate for domains \"replicant.vaulted.cloud,*.replicant.vaulted.cloud\" : unable to generate a certificate for the domains [replicant.vaulted.cloud *.replicant.vaulted.cloud]: acme: Error -> One or more domains had a problem:\n[*.replicant.vaulted.cloud] time limit exceeded: last error: NS ns3.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.replicant.vaulted.cloud., value: RoB9OYDpQ8-alOnDH2h8YvnzQKSp2sblQjnZaWMMWJE]: \n[replicant.vaulted.cloud] time limit exceeded: last error: NS ns1.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.replicant.vaulted.cloud., value: ULYdn9s_Ad9UmewOqT5FjBW3_lxJwsC7NjdhHgrOZo4]: \n" providerName=default.acme
time="2019-09-26T00:48:12+02:00" level=error msg="Unable to obtain ACME certificate for domains \"replicant.vaulted.cloud,*.replicant.vaulted.cloud\" : unable to generate a certificate for the domains [replicant.vaulted.cloud *.replicant.vaulted.cloud]: acme: Error -> One or more domains had a problem:\n[*.replicant.vaulted.cloud] time limit exceeded: last error: NS ns2.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.replicant.vaulted.cloud., value: td6zPBqMjOcKfQ-2MdHY8pv5iD0kVqDP1YMe-jf67oQ]: \n[replicant.vaulted.cloud] time limit exceeded: last error: NS ns4.dnsimple.com. did not return the expected TXT record [fqdn: _acme-challenge.replicant.vaulted.cloud., value: Ljx833nFv1eLb8eujx1G1ImUR8wXf_0rIHETTXEZm9U]: \n" providerName=default.acme
I'm using the staging ACME endpoint and this is a domain that exists and was working for DNS-01 challenge previously in Traefik 1.7
I think it's creating a duplicate _acme-challenge TXT record, one for the root domain (I only have A records for the apex, not CNAME's) and then attempting to create another for *.replicant.vaulted.cloud