I am trying to run a sonarqube app on the AWS fargate platform. When I run the raw docker image it works like a charm. But If I pass the JDBC properties to the container as an argument I am facing the following issue. Apparently, the elastic search needs a new config. If it is an ECS cluster I would have ssh into the EC2 instances and update these properties. In the case of fargate, how do I achieve this?
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
From the github issue seems like it not possible as there is no EC2 instance or Host ivolvole in Fargate.
the workarounds for the
max_map_counterror appear to be settingmax_memory_mapdirectly on the host (which may result in undesirable side effects, or using the sysctl flag on on the docker run command. Unfortunately, neither of these options are not supported in Fargate since it involves interacting with the container instance itself.
But the other way is to increase file limit and disable mmap check.
I had to properly configure U limits on my ECS task definition, something like:
"ulimits": [
{
"name": "nofile",
"softLimit": 65535,
"hardLimit": 65535
}
]
I've disabled mmap in ElasticSearch, which gets rid of the
max_map_countsetting requirement. This can be done by configuring thesonar.search.javaAdditionalOpts SonarQubesetting. I wasn't able to do it with an environment variable since ECS seems to be eating them, but in the end I just passed it as a parameter to the container, which works since the entrypoint is set and consumes arguments properly. In my case:
"command": [
"-Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmapfs=false"
]
Adding the variable discovery.type = single-node under the "Environment Variables" section (edit the es container) in the task definition resolved the issue for me. If you're using the json file, then add the following section
"environment": [
{
"name": "discovery.type",
"value": "single-node"
}
],
Unfortunately, I don't know why that worked.