Hi,
I'm trying to reverse proxy an external GeoServer service using Traefik in combination with an R Shiny Docker Swarm set up. I can get the Shiny app to display as expected, but still unable to map GeoServer as a PathPrefix to localhost on my computer (i'm currently testing this on my laptop).
I'd like to be able to see GeoServer at localhost/geoserver2
Thanks for you advice.
The docker-compose-traefik.yml:
version: "3.7"
services:
traefik:
image: traefik:2.5.3
deploy:
restart_policy:
condition: any
placement:
constraints:
- node.role == manager
labels:
- "traefik.http.services.traefik.loadbalancer.server.port=80"
#- "traefik.http.services.traefik.loadbalancer.server.port=443"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
#- "--entrypoints.websecure.address=:443"
#- --providers.docker.watch=true
#- '--providers.docker.defaultRule=Host("en.localexample.com")'
- "--providers.file=true"
- "--providers.file.filename=/home/shiny/webapps/9c9t/config/rules.yml"
- "--providers.file.watch=true"
ports:
- "80:80"
- "9020:8080"
#- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- test_net2
networks:
test_net2:
driver: overlay
external: true
My rules.yml:
http:
routers:
router-geoserver:
rule: "Host(`localhost`) && PathPrefix(`/geoserver2/`)"
service: service-geoserver
entryPoints:
- "web"
services:
service-geoserver:
loadBalancer:
servers:
- url: "http://172.17.0.5:8080/geoserver/"
passHostHeader: false
I have also tried replacing the above URL with "http://localhost:8030/geoserver' which is the published port in the running GeoServer Docker container.
The docker-compose_shinyapp.yml:
version: "3.7"
services:
dataservice:
image: img_shiny9c9t_v2
#ports:
deploy:
replicas: 5
labels:
- "traefik.enable=true"
- "traefik.http.routers.dataservice.rule=Host(`localhost`)"
- "traefik.http.routers.dataservice.entrypoints=web"
- "traefik.http.middlewares.dataservice.stripprefix.prefixes=/"
- "traefik.http.routers.dataservice.middlewares=dataservice@docker"
- "traefik.http.services.dataservice.loadbalancer.server.port=3838"
- "traefik.http.services.dataservice.loadbalancer.sticky=true"
- "traefik.http.services.dataservice.loadbalancer.sticky.cookie.name=stickycookie"
- "traefik.http.services.dataservice.loadbalancer.sticky.cookie.secure=false"
- "traefik.http.services.dataservice.loadbalancer.sticky.cookie.httpOnly=true"
restart_policy:
condition: on-failure
update_config:
delay: 2s
volumes:
- /home/shiny/webapps/9c9t:/home/shiny/webapps/9c9t
networks:
- test_net2
networks:
test_net2:
driver: overlay
external: true