SonarQube Docker not picking up JDBC environment variables

Hello Sonar community,

we’re running SonarQube Developer edition on a self-hosted Kubernetes cluster.

The SonarQube Docker image we’re using is sonarqube:lts-developer.

We haven’t pulled that image for some time, like about a year, but today we tried to pull the newest version (published about a week ago) to try to resolve some peculiarities we were experiencing with our SonarQube instance.

However, since re-pulling the image from Docker Hub, SonarQube seems to be unable to connect to its PostgreSQL database. We haven’t changed anything about the JDBC connection properties; SonarQube simply doesn’t seem to pick them up and uses the embedded H2 database instead.

  • What version are you upgrading from?
    Previous LTS version, 8.9.10-LTS

  • System information (Operating system, Java version, Database provider/version)
    SonarQube docker image (Version 9.9.1-LTS)

This is our Kubernetes pod specification for SonarQube:

    spec:
      containers:
      - env:
        - name: SONARQUBE_JDBC_USERNAME
          value: postgres
        - name: SONARQUBE_JDBC_PASSWORD
          value: **REDACTED**
        - name: SONARQUBE_JDBC_URL
          value: jdbc:postgresql://localhost/sonar
        - name: sonar.security.realm
          value: LDAP
       ** Rest of LDAP properties REDACTED **
        image: sonarqube:lts-developer
        imagePullPolicy: Always
        name: sonarqube
        ports:
        - containerPort: 9000
          name: http-port
          protocol: TCP
        - containerPort: 9092
          name: api-port
          protocol: TCP
        resources:
          requests:
            memory: 2Gi
            cpu: "1"
          limits:
            memory: 4Gi
            cpu: "1"
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      - env:
        - name: POSTGRES_PASSWORD
          value: **REDACTED**
        - name: PGDATA
          value: /var/lib/postgresql/data/pgdata
        image: postgres:11
        imagePullPolicy: IfNotPresent
        name: postgres
        resources:
          requests:
            memory: 1Gi
            cpu: "1"
          limits:
            memory: 1Gi
            cpu: "1"
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgres-data

Does anybody have an idea what we can do to make SonarQube respect the SONARQUBE_JDBC_URL etc. properties?

Thanks in advance.

Hi,

A lot of things can change from one LTS to another.

You might take a look at the LTS to LTS release upgrade notes. Or the updated Environment variables page.

 
:smiley:
Ann

Hi Ann, thanks for the reply.

I’ve checked the linked documents but they don’t provide any answer as to why the SONAR_JDBC_* environment variables aren’t recognized any more.

On the contrary, the second linked document confirms that they have stayed the same from v8.9.10-LTS - except that SONAR_JDBC_URL now takes an optional parameter, but which is not necessary in our cases since we’re using the default PUBLIC schema in PostgreSQL.

Regards

Oliver

Hello,

What you posted originally was SONARQUBE_JDBC_*.

Have you really converted already to SONAR_JDBC_*?

 
Ann

Hi again,

you’re absolutely right. We’re still using SONARQUBE_*, that seems to have changed. I’ve been missing that detail the whole time.

We’ll change it in our deployment descriptor and retry. Thanks a lot!

1 Like

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