SonarQube, Fargate & AWS ElasticSearch

Hi, I’m running SonarQube 7.9 LTS Community. I am hosting it on AWS using Fargate, RDS and it’s working. I’d like to however switch from using the inbuilt SonarQube ElasticSearch to the AWS ElasticSearch.

Is this possible when using the Community Edition? I ask because essentially what I am trying to setup is pretty much the DataCenter edition as described here https://docs.sonarqube.org/latest/setup/install-cluster/. It states " Running SonarQube as a Cluster is only possible with a Data Center Edition ."

I am not really looking for high availability. It just isn’t good practice to run ElasticSearch within a Fargate container as the Elasticsearch indexes will be deleted whenever the container is replaced.

In addtion to the above the SonarQube doco states:
" By default, Elasticsearch data is stored in $SONARQUBE-HOME/data , but this is not recommended for production instances. Instead, you should store this data elsewhere, ideally in a dedicated volume with fast I/O. Beyond maintaining acceptable performance, doing so will also ease the upgrade of SonarQube." (https://docs.sonarqube.org/latest/setup/install-server/)

So yeah, I’d like to be able to use the AWS Elasticsearch, not the SonarQube integrated one. Is this possible?

Hi,

Switching to an external Elasticsearch instance isn’t possible in any edition, not even the Data Center Edition.

 
Ann

The documentation here https://docs.sonarqube.org/latest/setup/install-cluster/ seems to clearly indicate otherwise Ann? Obviously this documentation is for DataCenter edition.

Hi,

That documentation page is indeed for the Data Center Edition, which runs Elasticsearch inside SonarQube nodes.

 
Ann

Wow, wow… wow.

So what are the implications of running SonarQube (any edition) in a container setup where the ElasticSearch indexes are wiped anytime the container is refreshed?

Hi,

It means that starting back up takes longer because ES has to reindex. Really, not what we recommend. This would be one reason you’d configure the ES indices to be stored somewhere else, as mentioned in the docs you cited in your OP.

 
Ann

Appreciate it’s not what SonarQube recommends, but aside from a slower startup there is no material impact? If so, this should work for us in the shorter term.

In the longer term and for a more permanent solution it means we can’t host this on Fargate as it doesn’t support persistent storage :frowning:

Sounds like someone in the community needs to implement external Elastic Search.
Looks like Data Center edition is already able to be configured to have a “Search Node” which talks to the “application nodes”.

Or possibly setting these options…

sonar.cluster.enabled=true
sonar.cluster.hosts=ip1,ip2
sonar.cluster.search.hosts=ip3,ip4,ip5
sonar.cluster.node.type=application
sonar.auth.jwtBase64Hs256Secret=YOURGENERATEDSECRET

And then creating your own “search node”