I am trying to set up my Bookstack instance behind Traefik using paths, and I am running into problems.
My Docker host is in a Windows domain, so let's say it's accessible at dockerserver.company.local
. My Bookstack container is directly accessible at dockerserver.company.local:6875
, and I would like to make it available at dockerserver.company.local/bookstack/
. But after reading through the documentation and trying multiple configurations, I still can't get it to work.
I also can't find any example setups either, which would be quite helpful as a reference.
Here is my current Bookstack docker-compose.yml
file:
---
version: "2"
services:
bookstack:
image: linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- DB_HOST=bookstack_db
- DB_USER=bookstack
- DB_PASS=bookstack
- DB_DATABASE=bookstackapp
volumes:
- /home/user/bookstack/config
ports:
- 6875:80
restart: unless-stopped
depends_on:
- bookstack_db
labels:
- "traefik.enable=true"
- "traefik.http.routers.bookstack.rule=Host(`dockerserver.company.local`) && Path(`/bookstack`)"
- "traefik.http.middlewares.bookstack.stripprefix.prefixes=/bookstack"
- "traefik.http.routers.bookstack.entrypoints=web"
- "traefik.http.services.bookstack.loadbalancer.server.port=6875"
bookstack_db:
image: linuxserver/mariadb
container_name: bookstack_db
environment:
- PUID=1000
- PGID=1000
- MYSQL_ROOT_PASSWORD=bookstack
- TZ=America/New_York
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=bookstack
volumes:
- /home/user/bookstack/config
restart: unless-stopped
And here is my Traefik docker-compose.yml
file:
version: "3.3"
services:
traefik:
image: "traefik:v2.0"
command:
- --entrypoints.web.address=:80
- --providers.docker=true
- --api.insecure # Don't do that in production
- "--log.level=DEBUG"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
Now with this configuration, if I attempt to visit http://dockerserver.company.local/bookstack/
, I get a 404 error (and no Traefik logs that I can tell). And if I attempt to visit http://dockerserver.company.local/bookstack
(note no trailing forward slash), I get a Gateway Timeout
error, and the Traefik log is as follows:
\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/bookstack\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Accept-Language\":[\"en-US,en;q=0.5\"],\"Connection\":[\"keep-alive\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0\"],\"X-Forwarded-Host\":[\"dockerserver.company.local\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"902385745d4a\"],\"X-Real-Ip\":[\"192.168.0.57\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"dockerserver.company.local\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"192.168.0.57:14634\",\"RequestURI\":\"/bookstack\",\"TLS\":null}" ForwardURL="http://172.18.0.3:6875"
time="2019-10-11T12:04:41Z" level=debug msg="'504 Gateway Timeout' caused by: dial tcp 172.18.0.3:6875: i/o timeout"
time="2019-10-11T12:04:41Z" level=debug msg="vulcand/oxy/roundrobin/rr: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/bookstack\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Accept-Language\":[\"en-US,en;q=0.5\"],\"Connection\":[\"keep-alive\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0\"],\"X-Forwarded-Host\":[\"dockerserver.company.local\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"902385745d4a\"],\"X-Real-Ip\":[\"192.168.0.57\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"dockerserver.company.local\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"192.168.0.57:14634\",\"RequestURI\":\"/bookstack\",\"TLS\":null}"
Can someone give me advice on how to accomplish what I am trying to do? Or tips on how to troubleshoot? Or even example setups?
At this point, I am suspicious that Traefik can't talk to my Bookstack container at all (hence the 404 errors). Do I need to add some networking magic in my Bookstack container?
TIA!