Installing Jenkins windows slave from https master - java

I am trying to install the slave on Windows from a linux master. When using the Java Web Start, I get an error that it can't load the resource http://jenkinsserver:8080/jenkins/jnlpJars/remoting.jar
This is because the jenkins server is using 8443. Is there a way to tell it to use the correct port?
When I try from command line:
java -jar slave.jar -jnlpUrl http://jenkinsserver:8443/jenkins/computer/Slave-it-jenkins-p2/slave-agent.jnlp -secret xxxx
I get a message that it is unable to access the jarfile slave.jar Is it possible to use Jenkins on https and install slaves?

Yes it is possible to execute the same over https , if you dont have the proper certificate then you can either download them from browser or you can also pass the argument --noCertifcateCheck to ignore the cert.
For the above issue via http can you please provide the detailed error stack that will help

First, you can configure your Jenkins port at Configure Jenkins menu http://your-jenkins-server/configure/. Check out the JENKINS URL at Jenkins Location
I had no problem configurating my Windows Slave using JNLP + service start. Just make sure that your JNLP port is set and open. You can set that port # Jenkins Global Security http://your-jenkins-server/configureSecurity/
I used the Jenkins documentation Installing Jenkins as Service in Windows Slaves as a guide.

Related

Install Jenkins manually on docker image

I'm trying to install/run jenkins manually without pulling the Jenkins image from the docker-hub
for this exercise I have used the ubuntu image container and I did the following:
Install jdk-11 on the container
Set up the JAVA_HOME env variable
Install jenkins with apt-get
Run jenkins with the command service jenkins start
then status output is the following
root#42024442b87b:/# service jenkins status
Correct java version found
Jenkins Automation Server is running with the pid 89
Now I don't now how to access the jenkins server running in the container from my host.
thanks in advance
Docker containers are not reachable using the network from the host system by default. You need to expose a container's host, meaning that the port will be opened on the host machine and all traffic forwarded to the container.
Running docker with -p 8080:8080 forwards 8080. Take a look at the syntax here.
You can also specify which port on the host machine is supposed to be mapped to a container's port with something like -p 1234:8080.
You can also use the EXPOSE keyword in your Dockerfile.

How to redirect jenkins.security.SecurityListener logs to a log file on a linux host

I have setup a logger on my jenkins server for jenkins.security.SecurityListener logs. I can view the logs in the webportal but I cannot find where the are stored on the server. I want to be able access these logs on the server.
When you are talking about seeings logs in webportal, are you talking about console output? In that case there are some options.
For jenkins build logs,By default logs should be made available in /var/log/jenkins/jenkins.log , unless customized in /etc/default/jenkins (for *.deb) or via /etc/sysconfig/jenkins (for */rpm).
Another option is to download them in your linux server using curl or wget command.
curl http://jenkinsUrl/job/<Build_Name>/<Build_Number>/consoleText -OutFile
another common location:
${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log
You can use plugins also to capture jenkins console logs and store them in any location in server as per your choice. Plugins are available for that.
Thanks,
Subhadeep

Local JNLP file not read for jenkins slave

I am trying to connect jenkins slave to the master.
We are allowed to have only one port (say 8888) open from the corporate firewall to talk to the master hosted on AWS. The port is being used for connecting to the jnlp process running on the master jenkins machine. Due to this reason we cannot download the slave-agent.jnlp file using http. I have manually downloaded the slave-agent.jnlp file and I am trying to give the following command to start the agent up.
java -jar slave.jar -jnlpUrl file:///oracle/app/jenkins/slave-agent.jnlp -secret 7f079707d5632d2db2501be73f1a6f5f6422b9c9fde806afd8fdd2000d5db123
I get the the following error
Failing to obtain file:/oracle/app/jenkins/slave-agent.jnlp?encrypt=true
java.io.IOException: file:/oracle/app/jenkins/slave-agent.jnlp?encrypt=true doesn't look like a JNLP file; content type was null
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:301)
at hudson.remoting.Launcher.run(Launcher.java:218)
at hudson.remoting.Launcher.main(Launcher.java:192)
Waiting 10 seconds before retry
I have tried this as well without any luck.
java -jar slave.jar -jnlpUrl file://localhost/oracle/app/jenkins/slave-agent.jnlp -secret 7f079707d5632d2db2501be73f1a6f5f6422b9c9fde806afd8fdd2000d5db123
The file is present at the location has read write permissions.
Any clue on why the java process is not able to read that file?
Answer by #gareth_bowles is wrong at least today, the url will work as a file url as well. Don't know if this was changed at some point.
For our windows slave it is "file:/D:/jenkins-slave/slave-agent.jnlp", which works.
The jnlpUrl parameter needs to be an http or https link to your Jenkins master, e.g. http://jenkins.yourco.com/computer/slavename/slave-agent.jnlp -it won't work as a file URL.

How do you know if Tomcat Server is installed on your PC

I am using Windows 7 OS.
I just installed jaspersoft server which installed Apache Tomcat and mysql as a bundle along with it.
I go to http://localhost:8080 and theres a message that says webpage is not available.
I am a beginner, and I would like to know if Tomcat is first installed on my computer. Can you tell
me how I can do that ? ( I would also like to know if it has to be started and on what
port it was installed.)
UPDATE
Heres something I did . i am really confused now . I found the location of the tomcat server. I found the server.xml file. The port in the server.xml file was listed as 8005. I also found start.bat which I ran. I now see that http://localhost:8080 works but http://localhost:8005 doesnt . Would you know why ?? The port 8005 should work because thats what was listed in the server.xml
The port 8005 is used as service port. You can send a shutdown command (a configurable password) to that port. It will not "speak" HTTP, so you cannot use your browser to connect.
The default port for delivering web-content is 8080.
But there may be other applications listen to that port. So your tomcat may not start, if the port is not available.
You asked "How do you know, if tomcat server is installed on your PC?". The answer to that question is: You can't
You can't determine, if it is installed, because it may be only extracted from a ZIP archive or packaged within another application (Like JBoss AS (I think)).
You can check in windows services if tomcat is installed it will be listed in windows services.
To check the windows service list of services installed on windows machine use
WINDOWS KEY + R and type services.msc
There you can find all the services related with Jasperreport server like Tomcat and MySQL with name starting Jasperreport server Tomcat and MySQL only if these services are installed and its need to be started by selecting the option.Then you can access it through browser using this link :-
http://localhost:8080
default port for tomcat is 8080.
In order to make
http://localhost:8080
work, tomcat has to be started first. You can check server.xml file in conf folder for the port information. You can search if tomcat is installed on your machine. Just go to start and then type tomcat. If it is installed it will give you the directory where it is installed. Then you can select that path and run it from command prompt. Example if tomcat is installed in C:\Programfile\tomcat. You need to set this path in command prompt,go to bin folder and startup. Example: C:\Programfile\tomcat\bin\startup. Else you can also run it by directly going to the path and run startup batch file.
In case of Windows(in my case XP):-
Check the directory where tomcat is installed.
Open the directory called \conf in it.
Then search file server.xml
Open that file and check what is the connector port for HTTP,whre you will found something like 8009,8080 etc.
Suppose it found 8009,use that port as "/localhost:8009/" in your web-browser with HTTP protocol.
Hope this will work !
For linux ubuntu 18.04:
Go to terminal and command:$ sudo systemctl status tomcat
Open your windows search bar, and search for the keyword Tomcat. If a shortcut file is found instead, you can open the source file location of the shortcut by right-clicking the shortcut file and selecting the Properties.

Connect to remote server and start/stop the Tomcat that's running on that particular server using Ant?

The purpose is to:
connect to a remote server maybe via host: ip , port: 8181
stop Tomcat that's running on that server
deploy a .war file
restart Tomcat
Underneath are few approaches I have taken so far to achieve this task:
Approaches taken so far:
I have looked at the following solutions but none of them worked for me:
http://www.linuxquestions.org/questions/linux-newbie-8/start-tomcat-server-remotely-824472/ --Not efficient
http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Start_an_Existing_Application
http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks
--only start/stop application not the actual tomcat itself
http://cargo.codehaus.org/Remote+Container
-- Which does't start/stop tomcat that's running on that server
If you have ssh access to the server, then you might like to consider the JSch library which you can use in combination with SSHExec Ant Task to start and stop your server:
<sshexec host="somehost"
username="dude"
password="yo"
command="/etc/init.d/tomcat restart"/>
For start/stop tomcat
In linux environment
use SSH to reach the terminal of the remote machine.
from the terminal You can start/stop the tomcat
to start startup.sh
to stop shutdown.sh
Under windows environment
Install OpenSSHD for Windows - this will allow remote "console" sessions.
If you looking for something very "unix-like" then you can install cygwin.
http://www.worldgoneweb.com/2011/installing-openssh-on-windows-7/
to start startup.bat
to stop shutdown.bat
For deployment
Simply go to tomcat manager link on the below page(on any environment)
http://your_server_ip:port_number/
user credential are specified in tomcat-users.xml inside conf di

Categories