Structure:
My Website uses SOLR for searching. Since I have three SOLR Nodes I want to use Traefik to handle the load balancing of those Nodes. Everything runs in Docker containers.
What I want to achieve
- SOLR should be available through solr.localhost
- Traefik should be available through traefik.localhost
- The load balancing of the three SOLR Nodes on solr.localhost
Versions:
- Traefik v. 3.3.2
- SOLR v 9.7.0
Problem:
I deploy the website in Plesk which uses Nginx that runs on port 80 and 443. So I need to run Traefik on different ports. I tried to change the Traefik port 80:80 to port 81:80 and port 443:443 to 8443:443. On port 80:80 / 443:443 SOLR and Traefik are available on the subdomains. But when I change the ports, the subdomains are no longer working and nether does the load balancing work because of the unreachable subdomain.
What I tried:
I tried nearly everything you can find on the internet to change this port but nothing worked. I think i'm missing something in the docker-compose settings but I can't figure out what it is.
Questions:
Is it just not possible to change the port?
Has anyone a solution to this problem?
docker-compose.yml:
services:
traefik:
image: traefik:3.3.2
container_name: traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./certs:/etc/certs/
ports:
- "81:80"
- "8443:443"
- "8090:8080"
command:
- --providers.docker
- --providers.docker.exposedbydefault=false
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
- --accesslog
- --log
- --log.level=DEBUG
- --api
- --api.insecure=true
labels:
- traefik.enable=true
- traefik.docker.network=solr-cloud-concept_traefik-network
- traefik.constraint-label=solr-cloud-concept_traefik-network
- traefik.http.services.traefik-dashboard.loadbalancer.server.port=8080
- traefik.http.routers.traefik-dashboard-http.entrypoints=http
- traefik.http.routers.traefik-dashboard-http.rule=Host(`traefik.localhost`)
- traefik.http.routers.traefik-dashboard-https.entrypoints=https
- traefik.http.routers.traefik-dashboard-https.rule=Host(`traefik.localhost`)
- traefik.http.routers.traefik-dashboard-https.tls=true
- traefik.http.routers.traefik-dashboard-https.service=api@internal
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
networks:
- traefik-network
solr1:
image: solr:9.7.0
container_name: solr1
ports:
- "8983:8983"
networks:
- solr-network
- traefik-network
environment:
ZK_HOST: zoo1:2181,zoo2:2181,zoo3:2181
SOLR_HOST: solr1
SOLR_PORT: 8983
depends_on:
- zoo1
- zoo2
- zoo3
labels:
- traefik.enable=true
- traefik.docker.network=solr-cloud-concept_traefik-network
- traefik.constraint-label=solr-cloud-concept_traefik-network
- traefik.http.services.solr.loadbalancer.server.port=8983
- traefik.http.routers.solr-http.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-http.entrypoints=http
- traefik.http.routers.solr-https.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-https.entrypoints=https
- traefik.http.routers.solr-https.tls=true
solr2:
image: solr:9.7.0
container_name: solr2
networks:
- solr-network
- traefik-network
environment:
ZK_HOST: zoo1:2181,zoo2:2181,zoo3:2181
SOLR_HOST: solr2
SOLR_PORT: 8983
depends_on:
- zoo1
- zoo2
- zoo3
labels:
- traefik.enable=true
- traefik.docker.network=solr-cloud-concept_traefik-network
- traefik.constraint-label=solr-cloud-concept_traefik-network
- traefik.http.services.solr.loadbalancer.server.port=8983
- traefik.http.routers.solr-http.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-http.entrypoints=http
- traefik.http.routers.solr-https.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-https.entrypoints=https
- traefik.http.routers.solr-https.tls=true
solr3:
image: solr:9.7.0
container_name: solr3
networks:
- solr-network
- traefik-network
environment:
ZK_HOST: zoo1:2181,zoo2:2181,zoo3:2181
SOLR_HOST: solr3
SOLR_PORT: 8983
depends_on:
- zoo1
- zoo2
- zoo3
labels:
- traefik.enable=true
- traefik.docker.network=solr-cloud-concept_traefik-network
- traefik.constraint-label=solr-cloud-concept_traefik-network
- traefik.http.services.solr.loadbalancer.server.port=8983
- traefik.http.routers.solr-http.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-http.entrypoints=http
- traefik.http.routers.solr-https.rule=Host(`solr.localhost`)
- traefik.http.routers.solr-https.entrypoints=https
- traefik.http.routers.solr-https.tls=true
zoo1:
image: zookeeper:3.9.3
container_name: zoo1
networks:
- solr-network
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
ZOO_4LW_COMMANDS_WHITELIST: "mntr,conf,ruok"
expose:
- "2181"
labels:
- "traefik.enable=false"
zoo2:
image: zookeeper:3.9.3
container_name: zoo2
networks:
- solr-network
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
ZOO_4LW_COMMANDS_WHITELIST: "mntr,conf,ruok"
expose:
- "2181"
labels:
- "traefik.enable=false"
zoo3:
image: zookeeper:3.9.3
container_name: zoo3
networks:
- solr-network
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
ZOO_4LW_COMMANDS_WHITELIST: "mntr,conf,ruok"
expose:
- "2181"
labels:
- "traefik.enable=false"
volumes:
traefik-certificates:
networks:
traefik-network:
external: false
solr-network:
driver: bridge