Skip to content

Commit

Permalink
SONAR-19108 fix docker compose example app replica issue
Browse files Browse the repository at this point in the history
* SONAR-19108 fix docker compose example app replica issue

* Suggestions for limits and postgres image version

---------

Co-authored-by: Carmine Vassallo <[email protected]>
  • Loading branch information
jCOTINEAU and carminevassallo authored Apr 12, 2024
1 parent 6be57c7 commit 9bde6ea
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
41 changes: 30 additions & 11 deletions example-compose-files/sq-dce-postgres/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ version: "3"

services:
sonarqube:
deploy:
replicas: 3
healthcheck:
test: wget --no-proxy -qO- http://localhost:9000/api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"'
interval: 25s
timeout: 1s
retries: 3
start_period: 55s
image: sonarqube:datacenter-app
depends_on:
search-1:
Expand All @@ -10,18 +18,21 @@ services:
condition: service_healthy
search-3:
condition: service_healthy
db:
condition: service_healthy
networks:
- sonar-network
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
mem_reservation: 4096M
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_CLUSTER_KUBERNETES: true
SONAR_AUTH_JWTBASE64HS256SECRET: "dZ0EB0KxnF++nr5+4vfTCaun/eWbv6gOoXodiAMqcFo="
VIRTUAL_HOST: sonarqube.dev.local
VIRTUAL_PORT: 9000
Expand All @@ -32,10 +43,11 @@ services:
image: sonarqube:datacenter-search
hostname: "search-1"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
mem_limit: 3072M
mem_reservation: 3072M
depends_on:
- db
db:
condition: service_healthy
networks:
- sonar-network
environment:
Expand All @@ -56,10 +68,11 @@ services:
image: sonarqube:datacenter-search
hostname: "search-2"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
mem_limit: 3072M
mem_reservation: 3072M
depends_on:
- db
db:
condition: service_healthy
networks:
- sonar-network
environment:
Expand All @@ -80,10 +93,11 @@ services:
image: sonarqube:datacenter-search
hostname: "search-3"
cpus: 0.5
mem_limit: 4096M
mem_reservation: 1024M
mem_limit: 3072M
mem_reservation: 3072M
depends_on:
- db
db:
condition: service_healthy
networks:
- sonar-network
environment:
Expand All @@ -101,7 +115,12 @@ services:
retries: 3
start_period: 55s
db:
image: postgres:13
image: postgres:15
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
networks:
- sonar-network
environment:
Expand Down
10 changes: 8 additions & 2 deletions example-compose-files/sq-with-postgres/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
hostname: sonarqube
container_name: sonarqube
depends_on:
- db
db:
condition: service_healthy
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
Expand All @@ -17,7 +18,12 @@ services:
ports:
- "9000:9000"
db:
image: postgres:13
image: postgres:15
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
hostname: postgresql
container_name: postgresql
environment:
Expand Down

0 comments on commit 9bde6ea

Please sign in to comment.