forked from OpenShiftDemos/sonarqube-openshift-docker
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from bashbang/master
Upgrade SonarQube to 9.9.1
- Loading branch information
Showing
5 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
FROM sonarqube:8.2-community | ||
FROM sonarqube:9.9.1-community | ||
|
||
# if you're upgrading from 8.2.2 you'll need this intermediate image to do the DB upgrade. See docs/upgrading-lts.md | ||
# FROM sonarqube:8.9.10-community | ||
|
||
MAINTAINER Erik Jacobs <[email protected]> | ||
MAINTAINER Siamak Sadeghianfar <[email protected]> | ||
|
@@ -19,28 +22,14 @@ LABEL summary="$SUMMARY" \ | |
release="$SONAR_VERSION" | ||
|
||
# Define Plug-in Versions | ||
ARG SONAR_ZAP_PLUGIN_VERSION=1.2.0 | ||
ARG SONAR_ZAP_PLUGIN_VERSION=2.3.0 | ||
ENV SONARQUBE_PLUGIN_DIR="$SONARQUBE_HOME/extensions/plugins" | ||
|
||
# Switch to root for package installs | ||
USER 0 | ||
RUN apt-get update && \ | ||
apt-get install -y curl zip | ||
|
||
# =============================================================================================== | ||
# Mitigation for CVE-2021-44228 and CVE-2021-45046 | ||
# - Set LOG4J_FORMAT_MSG_NO_LOOKUPS=true | ||
# - Remove JndiLookup.class from the classpath. | ||
# | ||
# References: | ||
# - https://logging.apache.org/log4j/2.x/security.html | ||
# | ||
# Search for jars containing JndiLookup.class: | ||
# - find / -name log4j-core*.jar -exec unzip -vl {} \; 2>/dev/null | grep JndiLookup.class | ||
# ----------------------------------------------------------------------------------------------- | ||
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true | ||
RUN find / -name log4j-core*.jar -exec zip -q -d {} org/apache/logging/log4j/core/lookup/JndiLookup.class \; 2>/dev/null | ||
# =============================================================================================== | ||
|
||
# ================================================================================================================================================================================ | ||
# Bundle Plug-in(s) | ||
|
@@ -58,7 +47,9 @@ WORKDIR $SONARQUBE_HOME | |
# random UIDs. | ||
RUN chown -R 1001:0 "$SONARQUBE_HOME" \ | ||
&& chgrp -R 0 "$SONARQUBE_HOME" \ | ||
&& chmod -R g+rwX "$SONARQUBE_HOME" \ | ||
&& chmod 775 "$SONARQUBE_HOME/bin/run.sh" | ||
&& chmod -R g+rwX "$SONARQUBE_HOME" | ||
|
||
EXPOSE 9000 | ||
|
||
# this sets the default user for running in openshift | ||
USER 1001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3.7" | ||
services: | ||
sonarqube: | ||
container_name: sonarqube | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
network: host | ||
ports: | ||
- 9000:9000 | ||
networks: | ||
- backend | ||
|
||
networks: | ||
backend: | ||
driver: "bridge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Upgrading LTS versions of SonarQube | ||
|
||
If you're running a version of SonarQube several versions behind the current LTS you'll need to systematically upgrade to each LTS version and trigger the DB upgrade. | ||
|
||
Example to upgrade from 8.2.2 to 9.9.1-community you first need to upgrade the an intermediate LTS version 8.9.10-community | ||
The DB upgrade is straight forward. Once 8.9.10-community has been updated in your dockerfile and deployed (remember turn off the pod for your existing sonarqube as only one instance can run at a time) you'll need to navigate to {yourURL}/upgrade and press the button to upgrade the database. | ||
|
||
You'll then do it again with 9.9.1 to upgrade the docker file and the db with the /upgrade url. | ||
|
||
Now, we did have one catch with this upgrade. The base OS on 8.9.10-community is Alpine where the other versions of LTS are Ubuntu. This means the apt-get commands in the docker file will fail and can be replaced with apk commands if you choose. Since it was just an intermediate upgrade we opted not to bother with the apk upgrades. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters