Hi!
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.
Anyway, I followed this toturial from Traefik's documentation itself and this documentation to push a bit further. As a result, here is my docker-compose file:
version: '3.5'
services:
traefik:
image: traefik:chevrotin
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker=true
- --certificatesresolvers.le.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
- --certificatesresolvers.le.acme.email=jlevarato@pm.me
- --certificatesresolvers.le.acme.storage=/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
web:
image: drillan767/mypetsnanny:latest
restart: unless-stopped
ports:
- "8080:80"
links:
- db
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- mpn_storage:/app/storage/app/public
- .env:/app/.env
networks:
- mpn
labels:
- "traefik.http.routers.web.rule=Host(`mypetsnanny.fr`)"
- "traefik.http.routers.web.tls=true"
- "traefik.http.routers.web.tls.certresolver=le"
db:
image: mariadb:latest
ports:
- 3306
environment:
MYSQL_USER: someuser
MYSQL_DATABASE: somedb
MYSQL_PASSWORD: some_pwd
MYSQL_ROOT_PASSWORD: some_other_pwd
networks:
- mpn
volumes:
mpn_storage:
name: mpn_storage
external: true
networks:
mpn:
external: true
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.
Thank you in advance!