ElasticSearch problem after rolling back an upgrade

I am using the Community version 8.9.0 in a docker-compose file with nginx, hosted on Ubuntu.
The database is an external SqlServer Db on Azure.

Today I decided to upgrade to the 9.9.0-community image.
Before doing that I did the usual apt update/upgrade commands. That wasn’t going smoothly, but I got docker running okay again.
I also made a copy of the database, as usual.
Then I pulled 9.9.0 and restarted the containers.
For some reason SQ came up with a default login prompt, no single sign-on. Also, it displayed messages about the need of getting a license to use an external database.
Then, I decided to rollback.
I restored the database and I went back to the 9.8.0-community image.
However, sonarqube doesn’t want to start:
“java.lang.IllegalStateException: cannot downgrade a node from version [7.17.8] to version [7.17.6]”

I tried to clean up as much as possible from the docker host, removed all my containers and images, but nothing helps. SQ keeps complaining about the ElasticSearch version.

Have I done something wrong? And more importantly, how can I get it working again?

Hey there.

I would start with this advice:

It sounds like your database configuration didn’t stick around. Can you share your docker-compse file?

I gave 9.9.0 a try again, and noticed that it uses the H2 database, instead of the external one.
This is my docker-compose file.
I have an .env file with the variables. I already tried to put them in the yml file directly, but that didn’t help SonarQube to use the external db.

It looks like it just ignores those parameters.

version: "3"

services:
  sonarqube:
    image: sonarqube:9.9.0-community
    container_name: sonarqube
    restart: always
    environment:
      - SONARQUBE_JDBC_USERNAME=${DBUSER}
      - SONARQUBE_JDBC_PASSWORD=${DBPWD}
      - SONARQUBE_JDBC_URL=jdbc:sqlserver://${DBSERVER};databaseName=${DBNAME};
      - SONAR_SEARCH_JAVAADDITIONALOPTS=-Dlog4j2.formatMsgNoLookups=true
    ports:
      - 9000:9000
      - 9002:9002
    volumes:
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_logs:/opt/sonarqube/logs
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
    networks:
      - sonarnet

  nginx:
    image: linuxserver/swag
    container_name: nginx
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=1000
      - EMAIL=${EMAIL}
      - TZ=Europe/Amsterdam
      - URL=${DOMAIN}
      - SUBDOMAINS=${SUBDOMAIN},
      - VALIDATION=http
      - ONLY_SUBDOMAINS=true
    volumes:
      - ~/sonarqubedocker/config:/config
      - ~/sonarqubedocker/nginx-sonarqube.conf:/config/nginx/site-confs/default.conf
    ports:
      - 80:80
      - 443:443
    networks:
      - sonarnet
    restart: always

networks:
  sonarnet:
    driver: bridge

volumes:
  sonarqube_bundled-plugins:
  sonarqube_conf:
  sonarqube_data:
  sonarqube_logs:
  sonarqube_extensions:

I already found out that the variable names are outdated. Apparently they should be named SONAR_ as of version 9.9

You’re right. I promise we’re working to get an upgrade note added!

So are you in good shape now?