Making Jenkins localhost publicly available within the same network - jenkins

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.

Related

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.

How to run Grails application so that other computers on network can access it?

I've developed a Grails application and I want my coworkers to be able to test it. They are on my network so I figure they can access it by using my IP address and the port number (8080). I've tried running it according to the steps laid out here and here to no avail.
I noticed that whenever I run the program, even when I follow those instructions, it says:
Grails application running at http://localhost:8080 in environment: development
Basic networking stuff here.
When something starts on interface 127.0.0.1 port something
Usually that port is then available for all the interfaces on the machine
if you run netstat -plant you will see running ports open on the machine.
Basically what ever ipconfig or ifconfig tells under Linux as your internal interface something like 192.168.1.x
The app is then available on http://192.168.1.x:8080
If you can't access it from other machines on network start by trying to ping {your machine ip}
It sounds like network security stopping local access from 1 machine accessing another.
Or even better still your good old MS firewall try stopping your security stuff on your desktop
It's not clear if you can access the app yourself on your own machine? It should be available at:
http://localhost:8080/appname
Your co-workers should be able to access the app by changing localhost to your computer name:
http://mycomputername:8080/appname

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

How to access / share Jenkins from another computer?

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.

Remote JMX Technology

anybody work on Remote Monitoring in java (JMX).
I have to monitor Remote Tomcat instance on Linux system and i need to monitor on local window machine.
i am accessing Remote Tomcat using Putty through VPN.
Please help..
I have tried by give jmx port in catalina.sh file of tomcat with variable JAVA_OPT and further tunneling in Putty ,but i m not able to access via localhost with port ,
also by using service jmx command.
please help !!!
Thanks for your time and support in advance ..
Remote JMX needs two ports to operate properly. And the second one (the RMI registry port) is by default picked randomly causing problems with firewalls etc.
Since JDK7u4 you can use
-Dcom.sun.management.jmxremote.rmi.port=<port>
to set the RMI port to be used.
See this blog for more detailed steps.

Resources