How to access / share Jenkins from another computer? - jenkins

I installed jenkins (localhost:8080) on RHEL and I am able to build code successfully
Now, I want to setup master / slave agent.
My laptop will act as 'Master Jenkins' and my colleague's will be 'Slave'
However, my colleague could not connect to 'Master Jenkins' and we both are on SAME LAN and able to ping each other
I tried the following but nothing worked
(a) Changed --httpListenAddress=0.0.0.0
(b) Changed --httpListenAddress=<my laptop ip>
(c) Changed --httpListenAddress=<my colleague's laptop ip>
and my colleague tried 'telnet <my laptop ip> 8080' from his laptop and did not work
Please help me to resolve this issue and I am new to Jenkins

Jenkins should host it's own service, so that is probably not the problem. Is your firewall open on port 8080?

Issue has been resolved by adding the port no '8080' in firewall
Goto 'Computer --> More Applications (or) Control Center --> Firewall --> Other Ports --> Add'

For all Mac Users. None of the above worked for me I installed Jenkins using HomeBrew.
go to
~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
and Change the httpListenAddress value from 127.0.0.1 to 0.0.0.0.
Since this homebrew.mxcl.jenkins.plist file in placed in LaunchAgents you need to restart your machine to make this effective.

Open the POrt 8080 via firewall and then change the URL of jenkins from "Manage Jenkins>Config Sys>Jenkins Location>" to "http://yourIP:8080" and then access it from other machine on same network domain.

I found that, after upgrading the local Java instance, Jenkins was no longer accessible over the domain. The fix was to update the path to the new java.exe, in the Programs and Services tab, in the Properties of the Jenkins rule, in Windows Firewall Advanced settings. You may also use the "All programs that meet the specified conditions" setting, but I do not know the impact that choice would have on the security of the server.

Related

Making Jenkins localhost publicly available within the same network

I am running my jenkins on localhost on my macmini which is my remote machine. All the tests are also running on that mac mini. However i want to share that localhost:8080 jenkins url to make it publickly so something like the eg.71.65.187.98:8080. so within the same network my coworkers can open the url and see the jenkins. How can i do that? without using any external service?
Run ifconfig in the terminal. it'll show all the network interfaces on your Mac. One of them is the network your machine is actively connected to.
If your Mac is on a wired connection that should be en0. Make a note of the address after inet, that should be the address your machine uses
It depends on how you start your jenkins server. If you use the generic war file then you can add the command flags --httpPort=yourPort --httpListenAddress=yourAdress.
A complete command could look like this:
java "${JAVA_OPTS}" -Xms256m -Xmx256m -jar jenkins.war --httpPort=8787 --httpListenAddress=192.168.0.171
Depending on your OS it may be possible that you need to tell your firewall to open the desired port.
I was able to solve the issue since i installed my jenkins using brew. first I needed to :
nano /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist
then change the httpListenAddress to 0.0.0.0
Then by using ifconfig on the terminal i was able to get my IP address and i was able the use IP address:8080 inside my network.

Unable to access localhost Jenkins from the another computer in the same network

Unable to access localhost Jenkins from another computer in the same network. These are the steps I did
1) I pinged the ip address of the computer from another computer and it is successful
2) I change the Jenkins URL in the config to - http://[IP of the machine:8080]
3) Turned off the firewall.
However I am not able to access this url from the same computer or another computer - http://[IP of the machine:8080]
Any time would be appreciated. Followed all the steps, not sure if i need to use a service like xamp or mamp
i also did ifconfig and this is what i got. My jenkins port is running on :8080 and i dont know what url to add to my jenkins so i can access it from other network within the same computer
Also what other steps i need to do, do i need to open the port from somwhere?
For Instance, your IP of Jenkins master is 192.169.x.x.
Open the Port 8080 via firewall and then change the URL of jenkins from "Manage Jenkins >>Config Sys >> Jenkins Location>" to "http://192.169.x.x:8080"
Now you can access it from other machine on same network domain.Just have to hit the url http://192.169.x.x:8080
You can now create different users with different privileges for the same.
You can find it under Manage Jenkins >> Manage Users >> Create Users.

Jenkins not accessible with http://<hostname>:8080 in Windows server 2012

I have installed Jenkins in Windows server 2012 64-bit machine and want to make it available in internal network.
I have added --httpListenAddress to 0.0.0.0 and restarted Jenkins and tried to access it with http://hostname:8080 but no page shows up(though It showing Jenkins icon in URL bar). However http://localhost:8080 works fine.
Further I checked the firewall inbound rule for the Jenkins but seems it has no issues.
I tried to catch the listening ports with "netstat -aon | find /i "8080" and found <host ip address>:8080 FIN_WAIT_2 which sign towards that the request is stuck(May be I am wrong).
I am clueless what exactly is blocking to use hostname with jenkins. Please share your solution if you already fixed this issue.
You might try adding a Windows Firewall rule. Go to Windows Firewall, Advanced Configuration, Inbound Rules rule and create an Allow rule for the specific version of java.exe you have installed.
This worked for us with the drawback that every time you upgrade Java, you must also modify the firewall rule. This is because Java creates a new subfolder for every version. We've tried using %JAVA_HOME% in firewall rules but it doesn't seem to work. We were on Windows Server 2012R2 at the time.
Similar answer here: https://stackoverflow.com/a/17479566/7752
On the server open a new command prompt and type
ipconfig
You should get a list of ips. Open a browser and type each up followed by 8080 for e.g.
http://202.123.2.1:8080
If Jenkins opens up, from another computer ping the ip and see if you can get a ping reply
ping 202.123.2.1
If you get a ping reply, you can access jenkins from any pc on the network by typing in the ip and port number.
Now to get to the hostname,you need to edit your host file
c:\Windows\System32\Drivers\etc\hosts
Type in the ip followed by the hostname
202.123.2.1 jenkins
If you can't get through, you need to open port 8080. See https://www.vultr.com/docs/how-to-open-a-port-in-windows-firewall-on-windows-server-2012
You cannot access from outside the machine because Jenkins Service does not have credentials to use that machine, only from localhost is accessible.
This is how to enter the credentials in Jenkins service.
In the Windows search bar, type services then enter.
Then scroll down to Jenkins and double-click on it.
In Jenkins Properties, select the tab "Log On".
Select Check box "This account"
Update your username and password.
Voila! Now Jenkins web can connect to the Jenkins machine via Jenkins service.

Possible to Change Jenkins URL? : http://localhost:8080

Possible to Change Jenkins URL? : http://localhost:8080
Currently I have jenkins setup on a virtual machine.
Is it possible to setup Jenkins on a URL which is more is accessible for other users?
For example I dont want other users to access test results by connecting to the Virtual machine instead I want them to access a URL from their own device in turn enabling them to login and see test results via jenkins.
thanks for you help
Let's say IP of your virtual machine is 192.168.x.x.
Open the Port 8080 via firewall and then change the URL of jenkins from
"Manage Jenkins >>Config Sys >> Jenkins Location>" to "http://192.168.x.x:8080"
Now you can access it from other machine on same network domain.Just have to hit the url http://192.168.x.x:8080
You can now create different users with different privileges for the same.
You can find it under Manage Jenkins >> Manage Users >> Create Users.
It is related to networking. The machines should be on the same network, so they can talk to each other (unless you have public IP).
The ONLY rule to give access is, that machines can talk to each other (of course, in their language, 0's & 1's).
I suggest following things to do to share the URL:
Ask the users to connect to the same network that your machine is in.
Verify whether they are able to PING your machine IP (get it from ipconfig command for windows - router assigns IP for your machine, that starts with 192.168 or 10.10). command example: ping 10.10.1.10
If any issues in Ping, it might be Windows Firewall or Anti-virus which might be blocking, so allow the IPs in your firewall so they can access your machine.
Then ask them to access Jenkins using the following URL http://[IP of your machine:8080]
We want the Jenkins web interface to be accessible from anywhere (not
just on the local machine), so we’re going to open up the config file:
sudo nano /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist
Find this line:
<string>--httpListenAddress=127.0.0.1</string>
And change it to:
<string>--httpListenAddress=0.0.0.0</string>
RF : Installing Jenkins on macOS

There is no "Launch agent via Java Web Start" option in my jenkins when I adding a windows slave node

I have already configured the java enviroment and installtion
path
This is a duplicate question from Server Fault: Answer Here
Java Web Start utilizes TCP so it has to be enabled and configured in Jenkins...
Login to Jenkins as admin
Manage Jenkins > Configure Global Security > TCP port for JNLP agents
Do yourself a favor and pick a static port assignment...
As of Jenkins version 2.176.3, there is option enabled when "Launch agent by connecting it to the master" which is same as "launch agent via java web start" once you enable the "Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents" as mentioned above.
e.g. Fixed: 50000
Make sure that you've enabled a JNLP port in Manager Jenkins -> Configure Global Security. If no JNLP port is specified, then the JNLP slave option will not appear.
I had similar issue after updating my Jenkins, I then used "Launch agent by connecting it to the master" method to launch and my port "TCP port for inbound agents" under
- Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents got changed to 8888. I have updated it back to 50000 and that resolved the issue. Hope it helps.
On some systems I used to get a button to download the agent's JNLP. On my new linux mint system, I instead get the "JNLP not available" message. So was lost as to where to get the JNLP file. However, looking in the command below I saw the URL for downloading it, eg:
http://127.0.0.1:8080/computer/build_slave/jenkins-agent.jnlp
Go to the slave machine, paste the URL in the browser to download it!
This might also be due to missing permissions for the user trying to setup the agent via java web start, at least that was the case in my scenario;
To verify this, try to download the jnlp directly; URL would be of the form [jenkins url]/computer/[agent name]/slave-agent.jnlp, if there is a permissions issue you will get something along the lines of:
Access Denied
xxxx is missing the Agent/Connect permission

Resources