Failed to upgrade to version 7.9.6-community with gosu not found error

Must-share information (formatted with Markdown):
*7.8-developer

  • trying to upgrade to 7.9.6-community

  • When I run the upgrade through my helm chart the pod fails to come up. Logs show

    deirdre$ k logs sonarqube-sonarqube-77bbfdf964-td6pm -n sonarqube
    ./bin/run.sh: line 12: exec: gosu: not found

I wonder is there some issue with my config map with this version. Below is my config yaml

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-startup
data:
 run.sh: |
#!/bin/bash

set -e

if [ "${1:0:1}" != '-' ]; then
  exec "$@"
fi

SONARQUBE_JDBC_URL="jdbc:postgresql://${SONARQUBE_PGSQL_HOST}/${SONARQUBE_JDBC_USERNAME}"
SONARQUBE_JDBC_PASSWORD="${SONARQUBE_PGSQL_PW}"

exec gosu sonarqube \
java -jar lib/sonar-application-$SONAR_VERSION.jar \
  -Dsonar.log.console=true \
  -Dldap.user.realNameAttribute="cn" \
  -Dldap.user.emailAttribute="mail" \
  -Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
  -Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
  -Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \
  -Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \
  "$@"

Anyone? I think its this gosu that my config maps wants to run and the docker image doesnt have that installed but the older docker images did

Hi @DeirdreRodgers,

With the 8.x images you don’t have to overwrite the run.sh script.
Take a look at the repo of the dockers images (docker-sonarqube/8/community at master · SonarSource/docker-sonarqube · GitHub) and the docs how to configure sonarqube with environment variables (Environment Variables | SonarQube Docs).

Apart from that there is a helm chart that is offered by sonarsource now (Deploy SonarQube on Kubernetes | SonarQube Docs)

If you want to overwrite the run.sh script, you probably will need to create your own image to include the dependencies of your script

Hope that helps

Thank you @DefinitelyNotTobi , thats really helpful. I only recently took support for this over in my org so I was trying to understand why it was even doing that in the first place.
So if I am reading the docs correctly and understanding your comment I shouldnt need a config map if I am just defining generic things like ldap and jdbc connection details and I can just define those in the deployment as environment variables? I dont think I need a custom image that overrides the run.sh as there isnt anything in my ConfigMap that isnt defined here Environment Variables | SonarQube Docs ?

    SONARQUBE_JDBC_URL="jdbc:postgresql://${SONARQUBE_PGSQL_HOST}/${SONARQUBE_JDBC_USERNAME}"
    SONARQUBE_JDBC_PASSWORD="${SONARQUBE_PGSQL_PW}"

exec gosu sonarqube \
java -jar lib/sonar-application-$SONAR_VERSION.jar \
  -Dsonar.log.console=true \
  -Dsonar.security.realm=LDAP \
  -Dldap.url="$SONARQUBE_LDAP_URL" \
  -Dldap.bindDn="$SONARQUBE_LDAP_BINDDN" \
  -Dldap.bindPassword="$SONARQUBE_LDAP_BINDPW" \
  -Dldap.user.request="$SONARQUBE_LDAP_USERREQ" \
  -Dldap.user.baseDn="$SONARQUBE_LDAP_BASEDN" \
  -Dldap.user.realNameAttribute="cn" \
  -Dldap.user.emailAttribute="mail" \
  -Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
  -Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
  -Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \
  -Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \
  "$@"

Yep that sounds about right :+1:
If you are facing issues with that (in the 7.x releases the env support was just introduced and not 100%) you can also define a sonar.properties file as a config map and mount it to $SONARQUBE_HOME/conf/sonar.properties . That would be the intended way

Let me know how it goes (:

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