How to recover crashed Jenkins from Linux server? - linux

I have installed Jenkins on Linux server. I am using 9091 port to run Jenkins & installed SSL to that. Jenkins URL looks like following one (https://testurl.com:9091/)
When I am trying to open Jenkins it's not get opened. Jenkins log file is given below.
How to recover Jenkins & open it..?

Related

How to launch Windows Slave from Linux Master in JENKINS

What I am trying to do: Create a Windows Slave from a Linux (Ubuntu) Master on Jenkins.
Jenkins is inside a container (Docker).
I followed the step-by-step here: https://scmquest.com/jenkins-windows-slave-configuration-with-screenshots/
And when I tried to launch the agent, I have an error like this: enter image description here
Okay I find out how.
I did docker container ls then under PORT there's x.x.x.x:8080->8080/tcp, x.x.x.x:50000->50000/tcp. I set the port to 500000 in Jenkins->Configure Global Security->Agent.
Now I have another error from java.
java.lang.NoClassDefFoundError:java/sql/Date

Jenkins - how do I reload remote Tomcat in Windows from Jenkins in Linux server?

I successfully built a .war file and deployed to remote Tomcat in Windows server from Jenkins in CentOS 7. Now I want to make Jenkins let the remote Windows server reload Tomcat after the .war file is successfully deployed. So I went to Execute Windows batch command and wrote the following script.
set JAVA_HOME=D:\Java\jdk1.6
cd "D:\Java\Tomcat 6"
cmd /c bin\shutdown.bat
timeout 5
cmd /c bin\startup.bat
After building the project, I realized it didn't work, as the Jenkins is in Linux and the remote Tomcat is in Windows. So finally I got to a conclusion that I might have to be able to access the remote Windows command line from the Linux shell.
Any good solutions for this?
The last log of building and deploying the .war file ended like the following.
Deploying /var/lib/jenkins/workspace/POS/target/posapi.war to container Tomcat 7.x Remote
Redeploying [/var/lib/jenkins/workspace/POS/target/posapi.war]
Undeploying [/var/lib/jenkins/workspace/POS/target/posapi.war]
Deploying [/var/lib/jenkins/workspace/POS/target/posapi.war]
Finished: SUCCESS
Does it mean that the reload is also successfully done?

Jenkins server time behind Linux machine

I have a jenkins server 1.651.3 running on a RedHat 6.3
Linux OS time is 12:30, but Jenkins server time is 11:30
How can I syncronize Jenkins server time with Linux ? (both should show 12:30)
Note: I tried these workarounds to solve the problem - without success:
1. added
-Duser.timezone=Asia/Jerusalem
-Dorg.apache.commons.jelly.tags.fmt.timeZone=Asia/Jerusalem
to /etc/sysconfig/jenkins and restarted jenkins service
2. executed
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Jerusalem')
from Jenkins Script console
Any ideas?

Is it possible to access Jenkins slave machine's files?

I have Jenkins master installed in cloud service in linux server. I have also installed Jenkins in my local machine (Windows). The local machine version of Jenkins is working as a slave. Slave setup is configured in master location. The connection between them works fine.
I have a plugin in Jenkins master where I need to provide an application directory. This application directory is located only in my slave machine. So I would like to know that is it possible to tell to Jenkins master that the application directory is located at slave machine? If yes how it is done?
I have been searching in Google, but not found any solution yet.
The Copy to Slave plugin allows copying to and from a Slave to Master

How to simultaneously deploy Node.js web app on multiple servers with Jenkins?

I'm gonna deploy a Node.js mobile web application on two remote servers.(Linux OS)
I'm using SVN server to manage my project source code.
To simply and clearly manage the app, I decided to use Jenkins.
I'm new to Jenkins so it was a quite difficult task installing and configuring Jenkins.
But I couldn't find how to set up Jenkins to build remote servers simultaneously.
Could you help me?
You should look into supervisor. It's language and application type agnostic, it just takes care of (re-) starting application.
So in your jenkins build:
You update your code from SVN
You run your unit tests (definitely a good idea)
You either launch an svn update on each host or copy the current content to them (I'd recommend this because there are many ways to make SVN fail and this allows to include SVN_REVISION in the some .JS file for instance)
You execute on each host: fuser -k -n tcp $DAEMON_PORT, this will kill the currently running application with the port $DAEMON_PORT (the one you use in your node.js's app)
And the best is obviously that it will automatically start your node.js at system's startup (provided supervisor is correctly installed (apt-get install supervisor on Debian)) and restart it in case of failure.
A node.js supervisord's subconfig looks like this:
# /etc/supervisor/conf.d/my-node-app.conf
[program:my-node-app]
user = running-user
environment = NODE_ENV=production
directory = /usr/local/share/dir_app
command = node app.js
stderr_logfile = /var/log/supervisor/my-node-app-stderr.log
stdout_logfile = /var/log/supervisor/my-node-app-stdout.log
There are many configuration parameters.
Note: There is a node.js's supervisor, it's not the one I'm talking about and I haven't tested it.
per Linux OS, you need to ssh to your hosts to run command to get application updated:
work out the workflow of application update in shell script. Especially you need to daemonize your node app so that a completed jenkins job execution will not kill your app when exits. Here's a nice article to tell how to do this: Running node.js Apps With Upstart, or you can refer to pure nodejs tech like forever. Assume you worked out a script under /etc/init.d/myNodeApp
ssh to your Linux OS from jenkins. so you need to make sure the ssh private key file has been copied to /var/lib/jenkins/.ssh/id_rsa with the ownership of jenkins user
Here's an example shell step in jenkins job configuration:
ssh <your application ip> "service myNodeApp stop; cd /ur/app/dir; svn update; service myNodeApp restart"

Resources