So, I have this website running on Laravel 8. I dockerized it then published it on a repository. Since it's a small website, the server itself is Artisan, Laravel's main tool, and it is set to run on 0.0.0.0:8080, so it's easily set to be available outside the container. The issue may come from here, though.
There's a lot of stuff I'm not even sure if I'm doing right, but I got no fatal error from Traefik which is nice.
However, when running docker-compose logs traefik, I get the following:
traefik_1 | time="2020-12-06T00:48:27Z" level=error msg="Unable to obtain ACME certificate for domains "mypetsnanny.fr": unable to generate a certificate for the domains [mypetsnanny.fr]: error: one or more domains had a problem:\n[mypetsnanny.fr] acme: error: 403 :: urn:ietf:params:acme:error:unauthorized :: Cannot negotiate ALPN protocol "acme-tls/1" for tls-alpn-01 challenge, url: \n" providerName=le.acme routerName=web@docker rule="Host(mypetsnanny.fr)"
In the mean time, I get a simple "gateway timeout" message on my website.
Also, if I run "curl localhost" outside my container, I'll get 404 page not found, but if I do curl localhost:8080 it inside it, I'll get the html for my website. It seems that I failed to "plug" Traefik to the website but I don't know how it should be done.
I think Traefik and ALPN are setup properly, nothing to change there. I can connect and Traefik accepts the acme-tls/1 protocol.
What I actually think is going wrong is that the IPv6 address/AAAA DNS record of mypetsnanny.fr is set to some random Apache server, and Let's Encrypt is connecting to that instead of Traefik.
Try removing the AAAA record and see whether that makes any difference.
Not directly related to your problem, but shouldn't you be mounting /acme.json as a volume for Traefik to persistently store the accounts, private keys and certificates?
Otherwise Traefik would recreate everything on every restart and you'll quickly hit rate-limits and be unable to create certificates.
If you've already got persistence working some other way, sorry!
So now, when completely removing completely my containers (docker-compose down --rmi=all) and restarting everything, I get no error from Traefik, just a notice that it loaded the flagged configuration. However, I still can't get to display my website outside its container, maybe matching it to the 80 port while it's used by Traefik isn't the best idea, but I have no clue of what I should do instead
Thanks in advance
P.S: btw, I added the volume as you suggested, but the acme.json file stays empty, and I can't find other ways to set it up.
Small update: I changed the port used by my application to 8080 and added a label for Traefik so it uses it, and fixed a bad copy / paste on the traefik.http.routers.whoami.entrypoints=websecure line (whoami has nothing to do here). Still no website displayed, but at least things are evolving.
Even smaller update: I discovered that it was linked to the fact that Traefik had to be linked to the same network than the web app. And now it works, but the https isn't safe:
traefik_1 | time="2020-12-06T20:37:23Z" level=info msg="Configuration loaded from flags."
This being said, my acme.json is still empty (I used chmod 600 on it just fyi). I added it inside my docker-compose but it doesn't appear inside the traefik container's root. Not sure if it's normal..