This is the story after SonarQube
in The story of making SonarQube a Docker Container.
I helped with some development, but it was in a subtle state with a fairly old version of SonarQube
in an on-premises environment.
Personally, I made SonarQube a Docker Container almost two years ago, so I provided it as the latest version, so it is a reminder at that time.
--Changed SonarQube Ver 7.4 to SonarQube Ver 8.4.2 --Changed DB for SonarQube from MySQL to PostgreSQL Ver 13.0 (End of Life of MySQL Support) --Changed docker-compose file to Ver 3
It's as easy as changing the Container Image you want to use to sonarqube: 8.4.2-community
.
# SonarQube Server
sonarqube-server:
container_name: sonarqube-server
image: sonarqube:8.4.2-community
As per End of Life of MySQL Support, the latest SonarQube
does not support MySQL, so PostgreSQL Transfer to.
Change the Container Image to be used to postgres: 13.0-alpine
, and change volumes
and ʻenvironment` by referring to the Official Guide.
At the same time, change the container_name etc. to something that is easy to understand.
#Database for SonarQube Server
postgres-sonarqube:
container_name: postgres-sonarqube
image: postgres:13.0-alpine
volumes:
- "./data/postgresql/init:/docker-entrypoint-initdb.d"
- "./data/postgresql/db:/var/lib/postgresql"
ports:
- "5432:5432"
networks:
- sonarqube-server-network
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
- POSTGRES_DB=sonar
Also, change the DB connection information (ʻenvironment) of the
SonarQube` Contaner.
# SonarQube Server
sonarqube-server:
container_name: sonarqube-server
image: sonarqube:8.4.2-community
command: -Dsonar.web.context=/sonarqube
links:
- postgres-sonarqube:postgres
volumes:
- ./data/sonarqube/extensions/plugin:/opt/sonarqube/extensions/plugins
ports:
- "9000:9000"
- "9092:9092"
networks:
- sonarqube-server-network
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- "SONARQUBE_JDBC_URL=jdbc:postgresql://postgres-sonarqube:5432/sonar"
Since Ver3 is the mainstream now, change the versions of the docker-compose file to 3
.
version: '3'
services:
After dealing with this, check the operation with the following command and finish the work.
docker-compose up --force-recreate sonarqube-server
It was easy because the main work was version upgrade work without considering data migration. I felt that this area was easy and good if I made it into a Docker Container again. I think I can do my best with this for a while.
The correspondence of this article is published in the following github repository, so please refer to it if you are interested. https://github.com/awakuwaku/sonar-qube-docker
Recommended Posts