Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sonar.web.javaAdditionalOpts from run.sh to allow proxy definition #20

Closed
wants to merge 5 commits into from

Conversation

resilva87
Copy link

Hi guys,

After trying desperately for a week to correctly set the proxy definition in sonar.properties (http://stackoverflow.com/questions/35709604/sonarqube-5-3-download-plugins-behind-proxy-https/35726595?noredirect=1#comment59208893_35726595) I've found out that defining sonar.web.javaAdditionalOpts in run.sh was the culprit to problem.

It seems that when the application is starting, it'll read sonar.properties file but it'll not merge or even replace sonar.web.javaAdditionalOpts from run.sh, in which case I could not set the required proxies for my environment.

The property in my sonar.properties was set like this: sonar.web.javaAdditionalOpts=-Djava.security.egd=file:/dev/./urandom -Dhttps.proxyHost=proxy.XXX -Dhttps.proxyPort=YYY -Dhttp.proxyHost=proxy.XXX -Dhttp.proxyPort=YYY

I believe this is a bug as it does not allow anyone to properly use proxies in their environment.

Cheers.

@Godin Godin self-assigned this Mar 3, 2016
@Godin
Copy link
Member

Godin commented Mar 3, 2016

@resilva87 I don't think that complete removal of default -Djava.security.egd=file:/dev/./urandom is a good idea. Maybe you have a better idea? Also I'm actually surprised that specification of http.proxyHost in conf/sonar.properties doesn't work, this sounds like a bug in upstream - in SonarQube.

@Godin Godin added this to the waiting-for-contributor milestone Mar 3, 2016
@resilva87
Copy link
Author

@Godin Actually in this context you'are correct: http.proxy{Host/Port} does work. But not the https variant. Some plugins in Update Center require connection to https://sonarsource.bintray.com which fails even if https.proxy{Host/Port} are defined in sonar.properties. The only way I found, based on these, was setting both http and https proxies in sonar.web.javaAdditionalOpts, which is working.

@Godin
Copy link
Member

Godin commented Mar 5, 2016

Seems that indeed https.proxyHost and https.proxyPort can't be loaded from sonar.properties - see https://github.com/SonarSource/sonarqube/blob/5.3/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java#L168-L170
And I created ticket - https://jira.sonarsource.com/browse/SONAR-7429 , feel free to vote.

@Godin
Copy link
Member

Godin commented Mar 10, 2016

@resilva87 according to @simonbrandhof ( https://jira.sonarsource.com/browse/SONAR-7429 ) :

"http.proxyUser" and "http.proxyPassword" are indeed properties defined by SonarQube. They're badly named as they're used for both HTTP and HTTPS. That deserves documentation to be updated.

did you tried this?

@Godin
Copy link
Member

Godin commented Mar 10, 2016

@resilva87 oups, sorry, my bad - this statement doesn't include proxyHost and proxyPort

@Godin
Copy link
Member

Godin commented Mar 10, 2016

@resilva87 you can test my quick attempt of fix - SonarSource/sonarqube#830

@Godin
Copy link
Member

Godin commented Mar 11, 2016

@resilva87 also please check PR #22 - it allows to pass sonar.web.javaAdditionalOpts without removal of default value -Djava.security.egd=file:/dev/./urandom, e.g.

docker run --rm --name sonarqube -p 9000:9000 -p 9092:9092 \
  -e SONARQUBE_WEB_JVM_OPTS="-Xmx32m" \
  sonarqube

@Godin
Copy link
Member

Godin commented May 2, 2016

Closed in preference to #22

@Godin Godin closed this May 2, 2016
@Godin Godin removed this from the waiting-for-contributor milestone May 2, 2016
@SonarSource SonarSource locked as resolved and limited conversation to collaborators Jan 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants