使用 Docker Compose 编排 SonarQube 10.0
目录结构
# sonar-docker-compose/
.
|-- docker-compose.yml
`-- sonar.properties
0 directories, 2 files
准备前工作
-
创建数据目录及授予相应权限:
mkdir -p /data/sonarqube/postgres/{postgresql,data} mkdir -p /data/sonarqube/sonarqube/{extensions,logs,data} chmod -R 777 /data/sonarqube/
-
防火墙放行相应端口:
firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=9000/tcp firewall-cmd --reload
使用 Docker Compose 编排 Sonar
-
docker-compose.yml
内容参考:--- version: "3.3" services: postgres: image: postgres:13 restart: always container_name: postgres ports: - "5432:5432/tcp" volumes: - /data/sonarqube/postgres/postgresql:/var/lib/postgresql - /data/sonarqube/postgres/data:/var/lib/postgresql/data - /etc/localtime:/etc/localtime environment: TZ: Asia/Shanghai POSTGRES_USER: sonar POSTGRES_PASSWORD: sonar POSTGRES_DB: sonar networks: - local-sonar sonar: image: sonarqube:10.1.0-community restart: always container_name: sonar depends_on: - postgres volumes: - /data/sonarqube/sonarqube/extensions:/opt/sonarqube/extensions - /data/sonarqube/sonarqube/logs:/opt/sonarqube/logs - /data/sonarqube/sonarqube/data:/opt/sonarqube/data - ./sonar.properties:/opt/sonarqube/conf/sonar.properties - /etc/localtime:/etc/localtime ports: - "9000:9000/tcp" environment: SONAR_JDBC_URL: jdbc:postgresql://postgres:5432/sonar SONAR_JDBC_USERNAME: sonar SONAR_JDBC_PASSWORD: sonar networks: - local-sonar networks: local-sonar:
-
sonar.properties
配置文件内容参考:# sonar.security.realm=LDAP # sonar.authenticator.downcase=true # ldap.authentication=simple # ldap.url=ldap://"":389 # ldap.bindDn=cn="",dc="",dc="" # ldap.bindPassword="" # ldap.user.baseDn=ou="",dc="",dc="" # ldap.user.request=(&(objectClass=top)(sAMAccountName={login})) # ldap.user.realNameAttribute=cn # ldap.user.emailAttribute=mail # ldap.group.baseDn=ou="",dc="",dc="" # ldap.group.request=(&(objectClass=top)(member={dn})) # http.proxyHost="" # http.proxyPort=""