Closed leeadh closed 5 years ago
@oldthreefeng & @suulperi I had the same problem because the user in the container (named "sonarqube") had no write permission to the mount location on the host. I believe docker-compose was creating those directories as root. I solved it by creating those directories manually and opening up the permissions. I'll bet there's a more secure way involving making a sonarqube user on the host machine.
j'ai modifié la version java de 14 à 11 et çà marche bien puisque sonarqube ne supporte pas une version plus que la version 11.
Thank you everyone.
I had to properly configure ulimits and environment on my ECS task definition(Fargate), something like:
"environment": [
{ "name" : "SONARQUBE_JDBC_URL", "value" : "jdbc:postgresql://sonarqube-db:5432/sonar" },
{ "name" : "SONARQUBE_JDBC_USERNAME", "value" : "admin" },
{ "name" : "SONARQUBE_JDBC_PASSWORD", "value" : "xxxxxx" },
{ "name" : "sonar.search.javaAdditionalOpts", "value" : "-Dnode.store.allow_mmapfs=false" }
],
"ulimits": [
{
"name": "nofile",
"softLimit": 65535,
"hardLimit": 65535
}
],
in my case it works
I've managed to get this started on Fargate. There were two different issues, like I've mentioned above:
- I had to properly configure ulimits 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_count
setting requirement. This can be done by configuring thesonar.search.javaAdditionalOpts
SonarQube setting. 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" ]
Hopefully this information will help some people.
@Sodki Can you please share the ECS task definition JSON for reference?
While using the suggested docker-compose.yml with
image: sonarqube:7.9-community
, I get the following error:db_1 | 2019-07-02 15:33:41.440 UTC [1] LOG: database system is ready to accept connections sonarqube_1 | 2019.07.02 15:33:41 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp sonarqube_1 | 2019.07.02 15:33:41 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 sonarqube_1 | 2019.07.02 15:33:42 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch sonarqube_1 | 2019.07.02 15:33:42 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running sonarqube_1 | 2019.07.02 15:33:42 INFO app[][o.e.p.PluginsService] no modules loaded sonarqube_1 | 2019.07.02 15:33:42 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] sonarqube_1 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. sonarqube_1 | ERROR: [1] bootstrap checks failed sonarqube_1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] sonarqube_1 | 2019.07.02 15:33:50 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78 sonarqube_1 | 2019.07.02 15:33:50 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped sonarqube_1 | 2019.07.02 15:33:50 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped sonarqube_sonarqube_1 exited with code 0
However when I change the sonarqube image to
sonarqube:7.7-community
everything seems to work fine.As @tmeedend mentioned, if you remove the db connection
sonar.jdbc.url=jdbc:postgresql://db:5432/sonar
from the env vars, even the 7.9 image runs fine.
- Ubuntu 18.04.2
- Docker version 18.09.6
- docker-compose version 1.17.1
Thanks a Lot Its working for me too. im using sonarqube 7.9 ((latest stable version for today)) in amazon linux2 VM...
question..? if i miss
sonar.jdbc.url=jdbc:postgresql://db:5432/sonar
from my properties did i miss any features in sonarqube..?
cheers
This is how I fixed the error: max virtual memory areas vm.max_map_count [65530] is too low
In AKS deployment yaml file under sonarqube container:
env:
- name: sonar.search.javaAdditionalOpts value: -Dnode.store.allow_mmapfs=false
this worked for me
I am seeing the following in the log:
11:27:21 ERROR: [2] bootstrap checks failed 11:27:21 [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] 11:27:21 [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Guys, To everyone having this error in a recent deployment. Notice there are some changes when using 8.x image versions. as noted here https://docs.sonarqube.org/latest/setup/install-server/ in the "SonarQube 7.9.x LTS" apart.
I recommend you to add "lts" tag to the image, in order to use a 7.9 version.
Once this change is done in the dockerfile, just, re-try
I have a similar error with the last image : ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] It only occurs if I try to configure sonarqube with postgresql. If I don't touch the default config, it starts correctly with the H2 datasource.
try this:
sysctl -w vm.max_map_count=262144
as discussed here: https://stackoverflow.com/questions/51445846/elastic-search-max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-inc
this worked for me
If it relies on host to run extra commands, it's not self-contained and not a container in sprit. Please try fix this without relying on host. I know it is due to elastic search but still...
Having the same issue on Windows 11 with docker version 4.3.2 With the following configuration I was able to make it work
environment:
SONAR_JDBC_URL: XXX
SONAR_JDBC_USERNAME: XXX
SONAR_JDBC_PASSWORD: XXX
sonar.search.javaAdditionalOpts: "-Dnode.store.allow_mmap=false"
Having the same issue on Windows 11 with docker version 4.3.2 With the following configuration I was able to make it work
environment: SONAR_JDBC_URL: XXX SONAR_JDBC_USERNAME: XXX SONAR_JDBC_PASSWORD: XXX sonar.search.javaAdditionalOpts: "-Dnode.store.allow_mmap=false"
Having the same issue on Windows 11 and Docker version 4.8.1 and was resolved by adding this line in my compose file Thanks
Hey,
Old issue dig up, be can be useful for folks using an autoscale k8s cluster, like us on Scaleway.
For Kubernetes issues with max_map_count
, if you are like me in a managed k8s and don't have access to hosts, simply add theses lines in your deployment yaml, under spec:
at the same level as containers:
initContainers:
- name: configure-sysctl
securityContext:
runAsUser: 0
privileged: true
image: busybox
imagePullPolicy: IfNotPresent
command: [ "sysctl", "-w", "vm.max_map_count=262144" ]
This code has been extracted from elastic official helm template.
Hope it helps ! Regards
For anyone experiencing the same issue on serverless (AWS Fargate) or similar environments without access to the underlying host VM... The issue has resurfaced when upgrading from 8.9 LTS to 9.9 LTS IF you are still using the old / deprecated environment variables and/or container commands.
Starting from 9.9 LTS this is the correct workaround:
# NOTE: 'ulimits' block is used only for SonarQube ElasticSearch requirements
ulimits = [
{
"name" : "nofile",
"softLimit" : 65535,
"hardLimit" : 65535
}
]
environment_variables = [
{
name = "SONAR_SEARCH_JAVAADDITIONALOPTS"
value = "-Dnode.store.allow_mmap=false,-Ddiscovery.type=single-node"
}
]
@kurac338 comment fixed my issue - i think this should be re-opened
2019-07-16T15:13:10.168811793+02:00 13:13:10.161 [main] WARN org.sonar.application.config.AppSettingsLoaderImpl - Configuration file not found: /opt/sonarqube/conf/sonar.properties 2019-07-16T15:13:10.518807941+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp 2019-07-16T15:13:10.578643291+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2019-07-16T15:13:10.757209823+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch 2019-07-16T15:13:10.859887546+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running 2019-07-16T15:13:11.456811146+02:00 2019.07.16 13:13:11 INFO app[][o.e.p.PluginsService] no modules loaded 2019-07-16T15:13:11.458854619+02:00 2019.07.16 13:13:11 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] 2019-07-16T15:13:11.519148858+02:00 OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. 2019-07-16T15:13:15.286139248+02:00 2019.07.16 13:13:15 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1 2019-07-16T15:13:15.287856877+02:00 2019.07.16 13:13:15 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped 2019-07-16T15:13:15.288865436+02:00 2019.07.16 13:13:15 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
Do deployment on Kubernetes version 1.14. Using PostgreSQL Server 10.9 (Docker Image) SonarQube Deployment. Do next things before running deployment
- Create Namespace called sonarqube 2, Create Persistent Volume Claims "sonarqube-data-pv-claim", "sonarqube-conf-pv-claim", and "sonarqube-extensions-pv-claim" with your suitable storage configurations
- Use same secrets than with PostgreSQL installation
apiVersion: apps/v1 kind: Deployment metadata: name: sonarqube-server namespace: sonarqube spec: selector: matchLabels: name: sonarqube-server replicas: 1 template: metadata: name: sonarqube-server labels: name: sonarqube-server spec: containers: - name: sonarqube-server image: sonarqube:7.9.1-community env: - name: SONARQUBE_JDBC_PASSWORD valueFrom: secretKeyRef: name: sonarqube-db-secret key: password - name: SONARQUBE_JDBC_URL value: jdbc:postgresql://sonarqube-postgres:5432/sonar volumeMounts: - mountPath: "/opt/sonarqube/conf/" name: sonarqube-conf - mountPath: "/opt/sonarqube/data/" name: sonarqube-data - mountPath: "/opt/sonarqube/extensions/" name: sonarqube-extensions ports: - containerPort: 9000 volumes: - name: sonarqube-conf persistentVolumeClaim: claimName: sonarqube-conf-pv-claim - name: sonarqube-data persistentVolumeClaim: claimName: sonarqube-data-pv-claim - name: sonarqube-extensions persistentVolumeClaim: claimName: sonarqube-extensions-pv-claim
by this configuration are you able to connect with PostgreSQL DB? I am getting this message "Embedded database should be used for evaluation purposes only" in the SonarQube UI.
2019-07-16T15:13:10.168811793+02:00 13:13:10.161 [main] WARN org.sonar.application.config.AppSettingsLoaderImpl - Configuration file not found: /opt/sonarqube/conf/sonar.properties 2019-07-16T15:13:10.518807941+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp 2019-07-16T15:13:10.578643291+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2019-07-16T15:13:10.757209823+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch 2019-07-16T15:13:10.859887546+02:00 2019.07.16 13:13:10 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running 2019-07-16T15:13:11.456811146+02:00 2019.07.16 13:13:11 INFO app[][o.e.p.PluginsService] no modules loaded 2019-07-16T15:13:11.458854619+02:00 2019.07.16 13:13:11 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] 2019-07-16T15:13:11.519148858+02:00 OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. 2019-07-16T15:13:15.286139248+02:00 2019.07.16 13:13:15 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1 2019-07-16T15:13:15.287856877+02:00 2019.07.16 13:13:15 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped 2019-07-16T15:13:15.288865436+02:00 2019.07.16 13:13:15 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
Do deployment on Kubernetes version 1.14. Using PostgreSQL Server 10.9 (Docker Image) SonarQube Deployment. Do next things before running deployment
- Create Namespace called sonarqube 2, Create Persistent Volume Claims "sonarqube-data-pv-claim", "sonarqube-conf-pv-claim", and "sonarqube-extensions-pv-claim" with your suitable storage configurations
- Use same secrets than with PostgreSQL installation
apiVersion: apps/v1 kind: Deployment metadata: name: sonarqube-server namespace: sonarqube spec: selector: matchLabels: name: sonarqube-server replicas: 1 template: metadata: name: sonarqube-server labels: name: sonarqube-server spec: containers: - name: sonarqube-server image: sonarqube:7.9.1-community env: - name: SONARQUBE_JDBC_PASSWORD valueFrom: secretKeyRef: name: sonarqube-db-secret key: password - name: SONARQUBE_JDBC_URL value: jdbc:postgresql://sonarqube-postgres:5432/sonar volumeMounts: - mountPath: "/opt/sonarqube/conf/" name: sonarqube-conf - mountPath: "/opt/sonarqube/data/" name: sonarqube-data - mountPath: "/opt/sonarqube/extensions/" name: sonarqube-extensions ports: - containerPort: 9000 volumes: - name: sonarqube-conf persistentVolumeClaim: claimName: sonarqube-conf-pv-claim - name: sonarqube-data persistentVolumeClaim: claimName: sonarqube-data-pv-claim - name: sonarqube-extensions persistentVolumeClaim: claimName: sonarqube-extensions-pv-claim
by this configuration are you able to connect with PostgreSQL DB? I am getting this message "Embedded database should be used for evaluation purposes only" in the SonarQube UI.
I would like to emphasize what @kurac338 said, please be careful when upgrading from one LTS to another as there might be some breaking changes.
In case of database variable, please take a look here and pay attention to the difference with SONARQUBE_XX
and SONAR_XX
which is the new formalism.
Let me know if this help you. Cheers,
I would like to emphasize what @kurac338 said, please be careful when upgrading from one LTS to another as there might be some breaking changes.
In case of database variable, please take a look here and pay attention to the difference with
SONARQUBE_XX
andSONAR_XX
which is the new formalism.Let me know if this help you. Cheers,
This is my deployment configuration but still SonarQube is not able to connect with PostgreSQL.
apiVersion: apps/v1
kind: Deployment
metadata:
name: sonarqube
namespace: sonarqube
labels:
app: sonarqube
spec:
replicas: 1
selector:
matchLabels:
app: sonarqube
template:
metadata:
labels:
app: sonarqube
spec:
securityContext:
fsGroup: 999
containers:
- name: sonarqube
image: sonarqube:latest
env:
- name: SONARQUBE_JDBC_USERNAME
value: sonarqube #Put your db username
- name: SONARQUBE_JDBC_URL
value: jdbc:postgresql://<Database IP>:<Port>/sonarqube #DB URL
- name: SONARQUBE_JDBC_PASSWORD
valueFrom:
secretKeyRef:
name: postgres #don't change it
key: password # don't change it
ports:
- containerPort: 9000
protocol: TCP
volumeMounts:
- mountPath: "/opt/sonarqube/data/"
name: sonar-data
- mountPath: "/opt/sonarqube/extensions/"
name: sonar-extensions
volumes:
- name: sonar-data
persistentVolumeClaim:
claimName: sonar-data
- name: sonar-extensions
persistentVolumeClaim:
claimName: sonar-extensions
Could you please tell me what mistakes I am doing and what will be the solution?
Well, from your file you are using SONARQUBE_XX
instead of SONAR_XX
variables, the other one being fully deprecated.
Hi,
I was running sonarqube on aws and via docker using docker run -d -p 9000:9000 sonarqube. I also tried sudo docker run -d -p 9000:9000 sonarqube.
Basically i did as below and opened up the port groups on aws. However, docker keeps running into a segmentation fault as seen after I try access my publicip:9000 as showb below
I then restart the VM in aws and check my docker logs and it states that
ubuntu@ip-10-0-0-68:~$ docker logs 41cf22d6ae9e 2019.06.29 01:36:36 WARN app[][o.s.application.App] SonarQube will require Java 11+ starting on next version 2019.06.29 01:36:36 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp 2019.06.29 01:36:36 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2019.06.29 01:36:36 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch 2019.06.29 01:36:36 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running 2019.06.29 01:36:37 INFO app[][o.e.p.PluginsService] no modules loaded 2019.06.29 01:36:37 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
Has this been resolved ?