Я установил следующие вещи на экземпляре AWS EC2 CentOS:
- Nginx
- сервер Sonarqube
- сонарный сканер
- SSL-сертификат с именем Jenkins
Мой сонар установлен на порт 9000, и ниже указан URL-адрес для доступа к нему, так как на этом компьютере установлен сертификат SSL.
https://jenkins.net/sonar/
Ниже приведены другие детали:
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
root /usr/share/nginx/html;
ssl_certificate "/etc/nginx/ssl/jenkins.crt";
ssl_certificate_key "/etc/nginx/ssl/jenkins.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /
{
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
# Required for new HTTP-based CLI
proxy_http_version 1.1;
proxy_request_buffering off;
}
location /nagios{
proxy_pass http://127.0.0.1:8093/nagios;
}
location /sonar{
proxy_pass http://127.0.0.1:9000/sonar;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
Файл конфигурации сервера Sonarqube:
#--------------------------------------------------------------------------------------------------
# WEB SERVER
# The default value is root context (empty value).
sonar.web.context=/sonar
# TCP port for incoming HTTP connections. Default value is 9000.
#sonar.web.port=9000
Файл конфигурации сканера сонара:
sonar.host.url=https://jenkins.net/sonar
Здесь я попробовал все нижеприведенные вещи, такие как:
sonar.host.url=http://jenkins.net/sonar
and
sonar.host.url=http://<my_ip_addr>/sonar
Однако во всех случаях я сталкиваюсь с проблемой ниже:
[CS_Sonar] $ /opt/sonar_scanner/bin/sonar-scanner -Djavax.net.ssl.trustStore=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.debug=ssl,handshake -Dsonar.host.url=https://jenkins.net/dde/sonar ******** -Dproject.settings=/home/ubuntu/workspace/CS_Sonar/sonar.properties -Dsonar.projectBaseDir=/home/ubuntu/workspace/CS_Sonar
INFO: Scanner configuration file: /opt/sonar_scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/ubuntu/workspace/CS_Sonar/sonar.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-1032-aws amd64
INFO: User cache: /home/ubuntu/.sonar/cache
ERROR: SonarQube server [https://jenkins.net/dde/sonar] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.333s
INFO: Final Memory: 5M/241M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: Caused by: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: Caused by: unable to find valid certification path to requested target
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
Может кто-нибудь из вас, пожалуйста, помогите в этом. Спасибо!