SonarQube Server on Docker

SonarQube Server on Docker

1. 建立持久層資料夾

1
mkdir -p -m 777 ./sonarqube && mkdir -p -m 777 ./sonarqube/conf && mkdir -p -m 777 ./sonarqube/data && mkdir -p -m 777 ./sonarqube/logs && mkdir -p -m 777 ./sonarqube/extensions

2. docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
version: "3.5"
services:
postgresql:
container_name: "postgresql"
image: "postgres"
ports:
- "5432:5432"
volumes:
- "/postgresql:/var/lib/postgresql/data"
environment:
- "POSTGRES_USER=sonar"
- "POSTGRES_PASSWORD=sonar"
restart: always
sonarqube:
container_name: "sonarqube"
image: "sonarqube:7.7-community"
ports:
- "9000:9000"
volumes:
- "/sonarqube/conf:/opt/sonarqube/conf"
- "/sonarqube/data:/opt/sonarqube/data"
- "/sonarqube/logs:/opt/sonarqube/logs"
- "/sonarqube/extensions:/opt/sonarqube/extensions"
environment:
- "sonar.jdbc.username=sonar"
- "sonar.jdbc.password=sonar"
- "sonar.jdbc.url=jdbc:postgresql://postgresql/sonar"
links:
- "postgresql:postgresql"
restart: always

ADserver 設定

設定
LDAP Plugin
团队环境:代码质量管理SonarQube安装

1. 將 sonar.properties 放置 SONARQUBE_HOME/conf/sonar.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# General Configuration
# LDAP configuration
sonar.security.realm=LDAP
sonar.authenticator.createUsers=true
sonar.security.savePassword=true
sonar.security.updateUserAttributes=true

ldap.url=ldap://YourAdServer
ldap.bindDn=bindDn
ldap.bindPassword=bindPassword

# User Configuration
ldap.user.baseDn=baseDn
ldap.user.request=(&(objectClass=user)(sAMAccountName={login}))

#參考