SonarQube
1.标准安装
2.docker安装
3.dokcer-compose安装
3.1 设置系统参数
由于 SonarQube 使用嵌入式 Elasticsearch,请确保您的 Docker 主机配置符合Elasticsearch 生产模式要求和文件描述符配置。
需要执行以下命令
sysctl -w vm.max_map_count=524288
sysctl -w fs.file-max=131072
ulimit -n 131072
ulimit -u 8192
如果系统的文件描述符配置不符合要求就会有如下报错
docker logs -f sonarqube_sonarqube_1
报错如下
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log
根据提示查看 /opt/sonarqube/logs/sonarqube.log
日志
2021.09.06 08:31:11 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2021.09.06 08:31:11 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:37275]
2021.09.06 08:31:11 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2021.09.06 08:31:11 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2021.09.06 08:31:16 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2021.09.06 08:31:16 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2021.09.06 08:31:16 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped