-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathdocker-compose-dce.yml
More file actions
164 lines (162 loc) · 4.54 KB
/
Copy pathdocker-compose-dce.yml
File metadata and controls
164 lines (162 loc) · 4.54 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
services:
sonarqube:
image: "sonarqube:${TAG}-app"
depends_on:
search-1:
condition: service_healthy
search-2:
condition: service_healthy
search-3:
condition: service_healthy
networks:
- sonar-network
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_WEB_PORT: 9000
SONAR_CLUSTER_SEARCH_HOSTS: "search-1,search-2,search-3"
SONAR_CLUSTER_HOSTS: "sonarqube"
SONAR_AUTH_JWTBASE64HS256SECRET: "dZ0EB0KxnF++nr5+4vfTCaun/eWbv6gOoXodiAMqcFo="
VIRTUAL_HOST: sonarqube.dev.local
VIRTUAL_PORT: 9000
volumes:
- sonarqube_extensions:/opt/sonarqube/extensions
- sonarqube_logs:/opt/sonarqube/logs
search-1:
image: "sonarqube:${TAG}-search"
hostname: "search-1"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
depends_on:
- db
networks:
- sonar-network
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_CLUSTER_ES_HOSTS: "search-1,search-2,search-3"
SONAR_CLUSTER_NODE_NAME: "search-1"
volumes:
- search-data-1:/opt/sonarqube/data
healthcheck:
test: >
sh -c '
URL="http://$$SONAR_CLUSTER_NODE_NAME:9001/_cluster/health?wait_for_status=yellow&timeout=50s";
if command -v curl > /dev/null 2>&1; then
RESPONSE=$$(curl -s "$$URL");
else
RESPONSE=$$(wget --no-proxy -qO- "$$URL");
fi;
echo "$$RESPONSE" | grep -q -e "\"status\":\"green\"" -e "\"status\":\"yellow\"";
'
interval: 25s
timeout: 1s
retries: 9
start_period: 55s
search-2:
image: "sonarqube:${TAG}-search"
hostname: "search-2"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
depends_on:
- db
networks:
- sonar-network
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_CLUSTER_ES_HOSTS: "search-1,search-2,search-3"
SONAR_CLUSTER_NODE_NAME: "search-2"
volumes:
- search-data-2:/opt/sonarqube/data
healthcheck:
test: >
sh -c '
URL="http://$$SONAR_CLUSTER_NODE_NAME:9001/_cluster/health?wait_for_status=yellow&timeout=50s";
if command -v curl > /dev/null 2>&1; then
RESPONSE=$$(curl -s "$$URL");
else
RESPONSE=$$(wget --no-proxy -qO- "$$URL");
fi;
echo "$$RESPONSE" | grep -q -e "\"status\":\"green\"" -e "\"status\":\"yellow\"";
'
interval: 25s
timeout: 1s
retries: 9
start_period: 55s
search-3:
image: "sonarqube:${TAG}-search"
hostname: "search-3"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
depends_on:
- db
networks:
- sonar-network
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_CLUSTER_ES_HOSTS: "search-1,search-2,search-3"
SONAR_CLUSTER_NODE_NAME: "search-3"
volumes:
- search-data-3:/opt/sonarqube/data
healthcheck:
test: >
sh -c '
URL="http://$$SONAR_CLUSTER_NODE_NAME:9001/_cluster/health?wait_for_status=yellow&timeout=50s";
if command -v curl > /dev/null 2>&1; then
RESPONSE=$$(curl -s "$$URL");
else
RESPONSE=$$(wget --no-proxy -qO- "$$URL");
fi;
echo "$$RESPONSE" | grep -q -e "\"status\":\"green\"" -e "\"status\":\"yellow\"";
'
interval: 25s
timeout: 1s
retries: 9
start_period: 55s
db:
image: postgres:13
networks:
- sonar-network
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar
volumes:
- postgresql:/var/lib/postgresql
- postgresql_data:/var/lib/postgresql/data
proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- sonar-network
- sonar-public
networks:
sonar-network:
ipam:
driver: default
config:
- subnet: 172.28.2.0/24
sonar-public:
driver: bridge
volumes:
sonarqube_extensions:
sonarqube_logs:
search-data-1:
search-data-2:
search-data-3:
postgresql:
postgresql_data: