How can i change the contextpath of jenkins? - apache

We have a situation trying to run jenkins behind apache,
we need to specify a new context path because we already have an instance of jenkins in ./Jenkins, so we try to use the parameter --prefix=/jenkins2/ in order to have the 2 instances separated.
The problem is that with that parameter, when i hit the url http://myserver.com/jenkins2 i have this:
HTTP ERROR 404
Problem accessing /. Reason:
    Not Found
Powered by Jetty:// 9.4.z-SNAPSHOT
any help?

In /etc/sysconfig/jenkins or /etc/default/jenkins change the follow line
JENKINS_ARGS=""
to
JENKINS_ARGS="--prefix=/jenkins2"
you can also run in a different por changing JENKINS_PORT in the same file.
Probably yours is not working because the "/" in the end "/jenkins2/"
If you can't find these files, you can check where is viewing the content of /etc/init.d/jenkins, in the line starting with "JENKINS_CONFIG="
If you are not running jenkins as service you can run:
java -jar jenkins.war --prefix=/jenkins2

Related

Codeception looking for external server

I finally handled that Yii1 and YiiBridge install instructions and run some sample test. The problem now is, instead use my localhost, PHPBrowser is going to an unknown server from LAN, which obviously fails all tests. Is there any configuration that can prevent this?
edit: Refs
https://codeception.com/docs/modules/Yii1.html
https://github.com/Codeception/YiiBridge

Cannot open URL. Please check this URL is correct: http://localhost:8080/

I am using IntelliJ Ideea 13.1.4 and I encountered this error - after I Run / Debug my project, after "Artifact portal-webapp:war exploded: Artifact is deployed successfully"
I get this error but it has been working util now...
Do you Have any idea what should it be?
It appears Idea is trying to wait for your page to return 200 response and then open the external web browser. If this does not happen (e.g. your application returns a redirect due to authentication filters), Idea is just spamming your application with requests and then complains about not being able to open the web page.
I was on production profile but I don't know how I was building until now automatic on dev profile. Now I put a -Pdev to the mvn clean install command I had in a .bat file and all is ok.

RabbitMQ error on startup - erlexec: HOME must be set

For some reason I cannot start RabbitMQ anymore after it crashed.
I am getting the following error:
erlexec: HOME must be set
I've tried to export my home to /home/ubuntu but still getting the same error.
Any ideas?
I'm assuming that you are trying to start rabbitmq with something like service start rabbitmq-server. If so, the service command strips out environment variables. So you will need to either define it in your start up script or in a config file for your startup script (see https://unix.stackexchange.com/a/44378).
Additionally, I believe the rabbitmq home directory is actually /var/lib/rabbitmq/.
I have found suitable solution for myself. You can run epmd service before RabbitMQ server. This is fixing issue with HOME variable and others.
erlexec needs the environment variable HOME to be set in order to place a cookie (that contains a string). If HOME was for some reason unset in the environment that you are running rabbitmq (or rabbitmqctl) in, then you will get this error.
Try to check if HOME is defined by typing:
$ env
to get the list of defined environments. If it was not defined try to define it with
$ export HOME=/var/lib/rabbitmq
If you are using python3 and tox, note that tox by default does not pass current environment variable to the test environment. You will have to add the following to tox.ini
setdev =
HOME=/var/lib/rabbitmq
Just wanted to mention it because it gave me a headache the entire day today and I finally understood what was the issue and I though I should share this hint.

Jenkins build fails occasionally during maven install (or update) on slave executor

I'm running some maven builds in Jenkins, using a Master/multi-slave setup. These builds mostly run fine, but every now and again I get this inexplicable error in the console output for the executing slave, and the build dies:
FATAL: Failed to parse /var/lib/jenkins/updates/hudson.tasks.Maven.MavenInstaller into JSON
hudson.util.IOException2: Failed to parse /var/lib/jenkins/updates/hudson.tasks.Maven.MavenInstaller into JSON
at hudson.model.DownloadService$Downloadable.getData(DownloadService.java:216)
at hudson.tools.DownloadFromUrlInstaller$DescriptorImpl.getInstallables(DownloadFromUrlInstaller.java:149)
at hudson.tools.DownloadFromUrlInstaller.getInstallable(DownloadFromUrlInstaller.java:54)
at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:63)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:61)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:150)
at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:515)
at hudson.tasks.Maven.perform(Maven.java:238)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:700)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:470)
at hudson.model.Run.run(Run.java:1409)
at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Caused by: net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:512)
at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:843)
at net.sf.json.JSONObject._fromString(JSONObject.java:1064)
at net.sf.json.JSONObject.fromObject(JSONObject.java:176)
at net.sf.json.JSONObject.fromObject(JSONObject.java:147)
at hudson.model.DownloadService$Downloadable.getData(DownloadService.java:213)
... 17 more
The home directory for the slave instance is /home/jenkins, as opposed to /var/lib/jenkins, which could explain the error, but nothing (nothing I've found, anyway) explains why jenkins would be trying to access the wrong home directory.
Has anybody else experienced this problem? Any suggestions for where to go debug-wise?
[UPDATE 20120312]
The direct cause of this problem is empty files in the $JENKINS_HOME/updates/ directory on the jenkins master. In this particular case, the master node is trying to parse $JENKINS_HOME/updates/hudson.tasks.Maven.MavenInstaller and send the data to the slave node so that it can update its maven installation. If I manually populate that file with data from another jenkins installation that I have, all processes go through just fine. However, due to a daily(?) update process, the file is replaced with another empty one, and so the problem persists.
This affects all self-installed tools (ant, java, etc.), and results in little side-effects like the version field under jenkins configuration -> maven -> install from apache being a text field instead of a drop-down.
So, the question becomes why are these files being downloaded empty? I can't find any reference to where they're being downloaded from, so I can't directly debug the link. Even if I could, it appears to work from one Jenkins installation, and not from another. Anyone out there have any suggestions?
Problem solved! The jenkins installation is fronted by an apache proxy, and it worked like a charm...almost. A minor tweak was required to get it to an error-free state. I had to change:
ProxyPass /jenkins/ http://localhost:8080/
ProxyPassReverse /jenkins/ http://localhost:8080/
To:
ProxyPass /jenkins/ http://localhost:8080/jenkins/
ProxyPassReverse /jenkins/ http://localhost:8080/jenkins/
And I had to add:
JENKINS_ARGS="--prefix=/jenkins"
To /etc/sysconfig/jenkins. After that adjustment, everything works fine.
As a side note, the thing that tipped me off to the proxy configuration was that every ajax call was being made twice (once to '/...' and once to '/jenkins/...'). At least, every one that succeeded. Once I made the configuration change, the ajax calls were just being made once each, and performance increased as well.
This misconfiguration makes for some weird side-effects, so hopefully this post can help somebody else.

403 : Access forbidden selenium

I want to run my testcases with the help of parameters mentioned in the testSuite.xml file and use them in my test cases by mentioning
#Parameters({ "selenium.host", "selenium.port", "selenium.browser", "selenium.url" }) in my code.
Though, I started a standalone server with -trustAllSSLcertificates, the system is giving "403 access forbidden error". However, if I run the test cases individually, by hardcoding the port, URL, Host & browsername, it works fine.
Where am i going wrong?.....
BTW, I run my test cases using build.xml file. Here also i added the -trustAllSSLcertificates when starting the server. But still it does not work.
Please help.
When running Selenium WebDriver using selenium-server-standalone I kept getting this error.
HTTP ERROR: 403
Forbidden for Proxy
RequestURI=/session
Turns out that it was because I needed to use the url http://localhost:4444/wd/hub as the url for the RemoteWebDriver client to connect to.
I'm sure there are a number of things that could cause the HTTP ERROR: 403, but you may want to double-check that it's resolving to the correct base url.