SonarQube 5.3 - Download plugins behind proxy (HTTPS) - configuration

There are a couple of questions about this already, but none of the provided solutions work with SonarQube v5.3.
So far I've tried setting sonar.web.javaAdditionalOpts=-Dhttps.proxyHost=proxy.XXX -Dhttps.proxyPort=YYY, both http(s).proxyHost=proxy.XXX and http(s).proxyPort=YYY.
It's important to notice that when SonarQube is starting (I'm running the docker app) it tries to connect to http://update.sonarsource.org/update-center.properties, in which case I'm able to check that http proxy works:
sonar_1 | 2016.02.29 20:46:18 INFO web[o.s.s.p.UpdateCenterClient] Update center: http://update.sonarsource.org/update-center.properties (HTTP proxy: proxy.XXX:YYY)
But, when trying to download any plugin from Update Center, it fails:
sonar_1 | org.sonar.api.utils.SonarException: Fail to download the plugin (ldap, version 1.5.1) from https://sonarsource.bintray.com/Distribution/sonar-ldap-plugin/sonar-ldap-plugin-1.5.1.jar (error is : Fail to download: https://sonarsource.bintray.com/Distribution/sonar-ldap-plugin/sonar-ldap-plugin-1.5.1.jar (no proxy))
Any help is much appreciated.
EDIT: Adding relevant debug logs according to the configuration been used.
Using only sonar.web.javaAdditionalOpts=-Dhttps.proxyHost=http://proxy.XXX -Dhttps.proxyPort=YYY -Dhttp.proxyHost=proxy.XXX -Dhttp.proxyPort=YYY: gist
Using http.proxyHost, http.proxyPort, https.proxyHost and https.proxyPort: gist

The HTTPS proxy properties (https.proxyHost and https.proxyPort) must be set in sonar.web.javaAdditionalOpts because they are not understood/suppoerted in sonar.properties.
The HTTP proxy properties (http.proxyHost and http.proxyPort) can be set either in sonar.web.javaAdditionalOpts or in sonar.properties directly.
Careful though: if you set the HTTP ones in sonar.web.javaAdditionalOpts, make sure to comment out the http.proxyHost and http.proxyPort lines in sonar.properties. Otherwise the latter would override the former (and I feel like this is what might be happening in your gist1 ).
Edit: you're running SonarQube in a docker container, in which case sonar.web.javaAdditionalOpts are currently set in the run.sh script. For additional Java properties you'll have to modify this directly.

Related

CAS switch the themes based on different services

Trying to configure a custom theme based on the service has been quite an undertaking in CAS 6.2.0. We use the car-overlay-template (https://github.com/apereo/cas-overlay-template) to configure and build the project.
The documentation is pretty clear about where to put the themes and what properties to use in the cas.properties file: https://apereo.github.io/cas/development/ux/User-Interface-Customization-Views.html
The property value to specify the templates location is set to:
#spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.prefix=file:///etc/cas/templates/
cas.view.templatePrefixes=file:///etc/cas/templates/
and I have the appropriate directory in the templates directory above specified in the service configuration but I continue to get the error:
2020-04-19 06:35:06,268 WARN [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Custom theme [foobar] for service [AbstractRegisteredService(serviceId=^(https|imaps)://.*, name=HTTPS and IMAPS, theme=epc, informationUrl=null, privacyUrl=null, responseType=null, id=10000001, description=This service definition authorizes all application urls that support HTTPS and IMAPS protocols., expirationPolicy=DefaultRegisteredServiceExpirationPolicy(deleteWhenExpired=false, notifyWhenDeleted=false, notifyWhenExpired=false, expirationDate=null), acceptableUsagePolicy=DefaultRegisteredServiceAcceptableUsagePolicy(enabled=true, messageCode=null, text=null), proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy#1, proxyTicketExpirationPolicy=null, proxyGrantingTicketExpirationPolicy=null, serviceTicketExpirationPolicy=null, singleSignOnParticipationPolicy=null, evaluationOrder=10000, usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider#87297e2, logoutType=BACK_CHANNEL, environments=[], attributeReleasePolicy=ReturnAllowedAttributeReleasePolicy(super=AbstractRegisteredServiceAttributeReleasePolicy(attributeFilter=null, principalAttributesRepository=DefaultPrincipalAttributesRepository(), consentPolicy=DefaultRegisteredServiceConsentPolicy(enabled=true, excludedAttributes=null, includeOnlyAttributes=null, order=0), authorizedToReleaseCredentialPassword=false, authorizedToReleaseProxyGrantingTicket=false, excludeDefaultAttributes=false, authorizedToReleaseAuthenticationAttributes=true, principalIdAttribute=null, order=0), allowedAttributes=[]), multifactorPolicy=DefaultRegisteredServiceMultifactorPolicy(multifactorAuthenticationProviders=[], failureMode=UNDEFINED, principalAttributeNameTrigger=null, principalAttributeValueToMatch=null, bypassEnabled=false, forceExecution=false, bypassTrustedDeviceEnabled=false, bypassPrincipalAttributeName=null, bypassPrincipalAttributeValue=null, script=null), logo=null, logoutUrl=null, redirectUrl=null, accessStrategy=DefaultRegisteredServiceAccessStrategy(order=0, enabled=true, ssoEnabled=true, unauthorizedRedirectUrl=null, delegatedAuthenticationPolicy=DefaultRegisteredServiceDelegatedAuthenticationPolicy(allowedProviders=[], permitUndefined=true, exclusive=false), requireAllAttributes=true, requiredAttributes={}, rejectedAttributes={}, caseInsensitive=false), publicKey=null, authenticationPolicy=DefaultRegisteredServiceAuthenticationPolicy(requiredAuthenticationHandlers=[], criteria=null), properties={}, contacts=[])] cannot be located. Falling back to default theme...>
Nowhere in the documentation does it mention directory structure for the theme/filenames or format. I understand the project is using Thymeleaf but we still need filenames and I guess a better understanding of how to set the theme path so the CAS can find the theme.
If you had any luck configuring this it would be great if you shared the part of your configuration we are missing.
After a LOT of testing and playing around with the configuration I finally got it to work as I expected it to work. I have put a small project together just in case someone else had this issue and needs a quick tutorial. You can see the project at: https://github.com/dannymk/cas-dynamic-style

Parsoid test page fail during VisualEditor installation

I'm trying to install VisualEditor in my MediaWiki wiki but I get stuck when I test Parsoid.
This is the result of the test page:
error: No API URI available for prefix: enwiki; domain: undefined path: /_rt/mediawikiwiki/Parsoid
Error: No API URI available for prefix: enwiki; domain: undefined
at /usr/lib/parsoid/src/lib/config/MWParserEnvironment.js:295:10
at /usr/lib/parsoid/node_modules/prfun/lib/index.js:532:26
at tryCatch2 (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:48:12)
at PrFunPromise.Promise (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:458:15)
at new PrFunPromise (/usr/lib/parsoid/node_modules/prfun/lib/index.js:57:21)
at /usr/lib/parsoid/node_modules/prfun/lib/index.js:530:18
at tryCatch1 (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:40:12)
at promiseReactionJob (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:269:19)
at PromiseReactionJobTask.call (/usr/lib/parsoid/node_modules/babybird/lib/promise.js:284:3)
at flush (/usr/lib/parsoid/node_modules/babybird/node_modules/asap/raw.js:50:29)
I set the API in the settings.js file end to make sure it is correct I tested using the curl command. And it works.
But I still have the problem.
Any suggestion?
You would've put something like this in Parsoid's localsettings.js:
parsoidConfig.setInterwiki( 'localhost', 'http://mediawiki.krenair.dev/mediawiki_dev/w/api.php' );
(example from my dev wiki setup)
That first string (in my case, 'localhost') should be identical to the value VE is set to use by $wgVisualEditorParsoidPrefix in your wiki's LocalSettings.php (unless you're using some other system to configure that stuff like VirtualRestConfig, in which case I can probably help in the comments). I believe you currently have it set to 'enwiki' for some reason, or else something is going wrong leading parsoid to default to 'enwiki' (I really don't know why they consider that a sane default).

Fiware CEP server stops responding

In developing in Fi-Cloud's CEP I've been having an issue that has been happening repeatedly. As I'm trying to develop a definition to perform a task, CEP's server and Authoring Tool stop responding, although ssh is still responsive.
This issue happens as I develop. I'm using the AuthoringTool to alter the definition bit by bit and then I re-upload it to the server through the authoring tool's export feature.
To reinitiate the proton with the new definition each time I alter it, I use Google's Postman with this single operation:
-PUT (url:http://{ip}:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer)
header: 'Content-Type' : 'application/json'; body : {"action": "ChangeDefinitions","definitions-url" : "/ProtonOnWebServerAdmin/resources/definitions/Definition_Name"}
At the same time, I'm logged in with three ssh intances, one to monitor the files being created on /opt/tomcat10/sample/ and other things, and the other two to 'tail -f ' log files the definition writes to, as events are processed: one log for events recieved and another log for events detected by the EPAgent.
I'm iterating through these procedures over and over as I'm developing and eventualy CEP server and the Authoring Tool stop responding.
By "tailing" tomcat's log file (# tail -f /opt/tomcat10/logs/catalina.out) I can see that, when under these circumstances, if I attemp a:
-GET (url: http://{ip}:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer)
I get no response back and tomcat logs the following response:
11452100 [http-bio-8080-exec-167] ERROR org.apache.wink.server.internal.RequestProcessor - An unhandled exception occurred which will be propagated to the container.
java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-167" java.lang.OutOfMemoryError: PermGen space
Ssh is still responsive and I can look at tomcat's log this way.
To get over this and continue, I exit ssh connections and restart CEP's instance in the Fi-Cloud.
Is the procedure I'm using to re-upload and re-run the definition inapropriate? Should I take a different approach to developing?
When you update a definition that the CEP is already working with, and you want the CEP engine to work with the updated definition, you need to:
Export the definition using the authoring tool export (as you did)
Stop the engine run, using REST PUT
PUT //host:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer
{"action":"ChangeState","state":"stop"}
Start the engine, using REST PUT
PUT //host:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer
{"action":"ChangeState","state":"start"}
You don't need to activate the "ChangeDefinitions" action, since it is the same definition name that the engine is already working with.
Activating "ChangeDefinitions" action, only influences the next run of the CEP, and has no influence on the current run.
This answer your question about how you should update a CEP definition.
Hope it will solve your issue.

Scout Eclipse ScoutServerTestRunner on client tests

now I run on new problems with scout testing.
I have Client fragment project for testing and I would like to test some templates I created.
My problem is that this templates contains some SmartFields and I would like to test them. For this I probably need ScoutServerTestRunner, so the server is up and running.
But If I try to add it I get error :
#RunWith(ScoutServerTestRunner.class)
#ServerTest()
I get error :
ServerTest cannot be resolved to a type
, all of my assert imports are deleted and I get error on my package line suggesting me Configure build path.
My guess is that this can't be done because it is client fragment and it can't connect to server.
But how then test smartFields ?
From your question I guess that there is some misunderstanding...
ScoutServerTestRunner and #ServerTest is something similar to ClientServerTestRunner and #ClientTest but for the server. You will need it for tests testing the server.
The classes are located in the org.eclipse.scout.rt.testing.server bundle.
If in a client test you need a server you have two possibilities:
A/ Start a server
You can start a server
This will probably not be the normal server (the one like in production) because you want to control the database or some external services. Authentication might also be slightly different (in order to control it and to have something compatible with your tests)
For the integration in your maven build, the maven-cargo plugin can be used to start your server before executing the client test suite.
B/ Mock the server services
Each of the services call that creates a ProxyService calling the server, can be replaced by mock (client only).
This is the preferred way for unit test, because you do not rely on a deployed server. You can also define for each test what the server answer will be.
This solutions requires probably initially more work, but in my opinion it worth it.
To register an alternative service, you can use:
TestingUtility.registerServices(
<activator instance>,
<priority>,
<service instances>
);
The service with the higher priority will win.
In each test, do not forget to un-register the alternative services you have registered.
SmartFields are using CodeTypes or LookupCalls. In case of a LookupCall, the LookupCall is probably calling the server through a LookupService. In case of a CodeType, the SmartField is internally using the CodeLookupCall class relying on a ICodeService.
In both cases, if you want to run your test without a server, you need to ensure that the client uses alternative implementations of the required services that do requires a server.

play activator - runtimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)

I am trying to run play activator template named "playStartApp".
But, it is giving me following runtime exception:
RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)\
java.lang.RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)
com.typesafe.plugin.CommonsMailerPlugin$$anonfun$4.apply(MailerPlugin.scala:329)
com.typesafe.plugin.CommonsMailerPlugin$$anonfun$4.apply(MailerPlugin.scala:329)
scala.Option.getOrElse(Option.scala:120)
com.typesafe.plugin.CommonsMailerPlugin.mailerInstance$lzycompute(MailerPlugin.scala:329)
com.typesafe.plugin.CommonsMailerPlugin.mailerInstance(MailerPlugin.scala:326)
com.typesafe.plugin.CommonsMailerPlugin.onStart(MailerPlugin.scala:343)
play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)`
I tried both:
- set mail.smtp=mock
- mail.smtp.host=smtp.gmail.com
mail.smtp.user=yourGmailLogin
mail.smtp.pass=yourGmailPassword
mail.smtp.channel=ssl
pls suggest how to resolve this?
In the "playStartApp" activator template, you can either -
Use a mock mailer, by entering the following in conf/application.conf
smtp.mock=true
The mock option will render email output to the console. If you are using the Activator UI, you'll be able to see the mail output in the logs on the "Run" tab.
Mention the SMTP server details in conf/application.conf
smtp.host=smtp.gmail.com
smtp.port=587
smtp.user="user#gmail.com"
smtp.password="password"
smtp.ssl=true
mail.from="PlayStartApp#yourdomain.com"
mail.sign=The PlayStartApp Team
You can use gmail servers for sending mails as well, which I have mentioned above.
Alternatively, in the "playStartApp", just rename conf/mail.conf.example to conf/mail.conf and move all your SMTP related configuration here. Please note that conf/mail.conf is mentioned in .gitignore.
Resources (Play Documentation):
Mail configuration parameters
SMTP Configuratoin