I currently have Sonarqube, Postgres & Nginx running via a single docker-compose using nginx as a reverse proxy to provide TLS. So I've been looking and trying to configure replacing nginx with Traefik. Our current host sits on a subdomain, which the cert we have is solely for that domain. We host multiple container based systems on that host and just use different ports to dissociate between them. I've been unable to configure my traefik instance to run sonarqube and wondered if someone could help identify how to do it. This is my current docker-compose, I wasn't sure how to use a simple port based url like subdomain.domain.com:9000 which is how nginx runs this. So I tried using a path, but was unable to get this to work
Hello @jonny7 and thanks for your interest in Traefik,
If I'm understanding well, you are trying to expose sonarqube through Traefik on port 9000. In order to do that, you will have to configure a Traefik entry point on port 9000 as explained in the following documentation and to enable the Docker provider.
Then, you will have to configure a router and a service for the sonarqube container. The container configuration would look like the following:
version: '3'
services:
sonarqube:
container_name: sonarqube
hostname: sonarqube
image: 'sonarqube:community'
networks:
- traefik
- sq_net
labels:
- traefik.enable=true
- traefik.docker.network=traefik # needed because there is multiple networks
- traefik.http.routers.sq.tls=true
- traefik.http.routers.sq.rule=Host(`subdomain.domain.com`)
- traefik.http.routers.sq.entrypoints=sonarqube # attach this router to the entrypoint named sonarqube
- traefik.http.services.sq.loadbalancer.server.port=9000 # this is the port exposed by the sonarqube container (might be optional)
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: test
SONAR_JDBC_PASSWORD: test
restart: unless-stopped
volumes:
- 'sonarqube_data:/opt/sonarqube/data'
- 'sonarqube_extensions:/opt/sonarqube/extensions'
- 'sonarqube_logs:/opt/sonarqube/logs'
....
To be able to help you, it will be better if you can share your static configuration, logs, the Traefik container configuration and also what are the errors.
To be sure, you want to expose the sonarqube through Traefik on port 9000?
This means that your service will be accessible on subdomain.domain.com:9000.
If that's the case you have to configure an entrypoint for that and that's what the error logs says:
time="2021-01-21T16:00:40Z" level=error msg="entryPoint \"sonarqube\" doesn't exist" entryPointName=sonarqube routerName=sq@docker
time="2021-01-21T16:00:40Z" level=error msg="no valid entryPoint for this router" routerName=sq@docker
To fix that you will have to add the configuration for this entrypoint, something like:
Without logs or more insights, it's really hard to help you more. I'm not able to understand if the problem is that a client is not able to reach Traefik or if Traefik is not able to reach the sonarqube service.
As the curl request is falling, I'm suspecting that a client is not able to send a request to Traefik.
Are you sure that Traefik is reachable from a client?
Maybe you have missed exposing the port 9000 in the Traefik deployment?
Could you share the content of the docker-compose used to deploy Traefik?