Must-share information (formatted with Markdown):
- Which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- Enterprise EditionVersion 9.9.4 (build 87374)
- How is SonarQube deployed: zip, Docker, Helm
- Docker (AWS ECS cluster)
- what are you trying to achieve
- Keep indices consistent
- what have you tried so far to achieve this
- See below
Hey Team,
We run Sonar on AWS ECS Cluster and drain tasks to refresh EC2 instances. Each time we start a new task, Sonar indices require refreshing.
As a workaround, we set a lambda that checks daily for broken projects. It compares /api/issues/search?componentKeys=${project}
against /api/measures/component?component=${project}
, and whenever we encounter inconsistencies, we reindex with /api/issues/reindex
.
From DevOps
For the ECS drain machine. The process sends a signal to a running container (sigterm) to stop, and once the EC2 instance has no containers on it, it is terminated and replaced. At the same time, additional computing is started for any containers to migrate to. If, after 20 minutes, a container does not gracefully shut down, the instance is terminated, and any running containers are terminated with the instance. We have no logs of this happening for SonarQube. This is essentially some chaos engineering, but waiting 20 minutes for containers to migrate.
The index issue is with elastic search, which is inside the SonarQube container. Given that it is a container and doesn’t have a state datastore/volume, it should be ephemeral, and data should be pulled from RDS/Postgres on startup. I suspect there is an issue when a new SonarQube container is started. It could be a lack of resources or a software issue.
While researching for the solution, we found a post about allowing running an independent ES. That should help address the symptoms.
Please advise us on the best solution/workaround to keep indices consistent after provisioning fresh Sonar tasks.
Regards,
Przemek