504 error with SonarQube

Hello!

I'm trying to set up Sonarqube server behind Traefik using docker-compose. All logs are clean, but service returns 504 error (Gateway Timeout).

  1. Sonarqube version: latest (9.3.0)
  2. Postgres version: latest (14.2)
  3. Traefik: latest (2.6.1)
docker-compose file for sonarqube

version: “3”

services:
postgres:
image: postgres:latest
container_name: postgres
volumes:

  • ./sonarqube-postgres:/var/lib/postgresql
  • ./sonarqube-postgres-data:/var/lib/postgresql/data
    environment:
    POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    POSTGRES_USER: ${POSTGRES_USER}
    restart: unless-stopped
    ports:
  • 5432:5432
    healthcheck:
    test: [“CMD-SHELL”, “pg_isready -U $POSTGRES_USER”]
    interval: 10s
    timeout: 5s
    retries: 5
    start_period: 10s
    labels:
  • traefik.enable=false
    networks:
    sonar-net:

sonarqube:
image: sonarqube:latest
container_name: sonarqube
volumes:

  • ./sonarqube-data:/opt/sonarqube/data
  • ./sonarqube-extensions:/opt/sonarqube/extensions
  • ./sonarqube-logs:/opt/sonarqube/logs
  • ./sonarqube-temp:/opt/sonarqube/temp
    environment:
    SONAR_JDBC_URL: jdbc:postgresql://postgres:5432/${POSTGRES_USER}
    SONAR_JDBC_USERNAME: ${POSTGRES_USER}
    SONAR_JDBC_PASSWORD: ${POSTGRES_PASSWORD}
    labels:
  • traefik.enable=true
  • traefik.http.routers.sonarqube.rule=Host( ${SONAR_HOST} ) || Host( www.${SONAR_HOST} )
  • traefik.http.routers.sonarqube.service=sonarqube
  • traefik.http.routers.sonarqube.entrypoints=secure
  • traefik.http.services.sonarqube.loadbalancer.server.port=9000
  • traefik.http.routers.sonarqube.tls=true
  • traefik.http.routers.sonarqube.tls.certresolver=myresolver
  • traefik.http.routers.sonarqube.middlewares=redirect-www,gzip-compress,auth
  • traefik.http.services.sonarqube.loadbalancer.passhostheader=true
    restart: unless-stopped
    ports:
  • 9000:9000
    depends_on:
    postgres:
    condition: service_healthy
    networks:
    traefik:
    sonar-net:

networks:
traefik:
name: traefik
sonar-net:
name: sonar-net
external: false

docker-compose for traefik

services:
traefik:
container_name: traefik
image: traefik:latest
security_opt:
- no-new-privileges:true
environment:
- TRAEFIK_DOMAIN
- TRAEFIK_WWW
- ACME_EMAIL
- PILOT_TOKEN
restart: unless-stopped
ports:
- 80:80
- 443:443
- 8082:8082
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./:/etc/traefik
- /etc/apache2/.htpasswd:/etc/apache2/.htpasswd
- /etc/apache2/.external:/etc/apache2/.external

networks:
default:
external:
name: traefik

All other services are right (prometheus, gitlab, blog).

Sonarqube logs: don't know how to attach =(

I'm sorry, the reason was in labels. I forgot to set docker network:

  • traefik.docker.network=traefik

So it all works correctly

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.