3

We have just installed Jenkins on our server (Debian 7 wheezy). It works on local network, but not on extern network. We search but we don't find any workaround for this problem.

We can ping our server but when we go on the address for jenkins it doesn't work.

fische
  • 31
  • 1
  • 1
  • 2

2 Answers2

4

Probably because of the reasons below:

1) Your web server config

For apache: allow from all

For tomcat:

<Host name="localhost" appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

should be

<Host name="www.example.com" appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

2) Your firewall settings (open port for external connection)

3) Jenkins Config

Firstly, for Debien, modify /etc/default/jenkins, add a line HTTP_HOST=external address (e.g. HTTP_HOST=www.example.com)

Then, add --httpListenAddress=$HTTP_HOST to your JENKINS_ARGS (JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --httpListenAddress=$HTTP_HOST")

Finally, restart your jenkins

William LAM
  • 141
  • 2
  • We have a redmine with apache already install and it works good. And with the iptables -L command the result is: Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination So normaly all port are open. No? – fische Sep 03 '13 at 15:53
  • Try disable your firewall by: # /etc/init.d/iptables save # /etc/init.d/iptables stop Is your redmine accessible by external network? Is your jenkins and redmine are deployed the same web server? By default, Jenkins has its own standalone web server running on port 8080. – William LAM Sep 04 '13 at 01:34
  • Yes the redmine is always accessible by the external network. Redmine and Jenkins are not on the same server (ie Apache and tomcat). I really don't understand. Are there anything to change in the jenkin's configurationn ? – fische Sep 04 '13 at 15:25
  • If I change the port of jenkins to 80 (ie the port of redmine) and i stop the apache. Jenkins doen't work too. – fische Sep 04 '13 at 15:49
  • How about the jenkins config? under/etc/default/jenkins JENKINS_ARGS="--webroot=/var/run/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --httpListenAddress=$HTTP_HOST" $HTTP_HOST should not be localhost or 127.0.0.1 – William LAM Sep 05 '13 at 01:10
  • I just have JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT". It's good? I have to specify the $HTTP_HOST? and if i have to specify them, what i have to write? – fische Sep 05 '13 at 15:19
  • see if the updated answer can solve your problem – William LAM Sep 05 '13 at 15:52
  • it doesn't work! ><. I specify for the HTTP_HOST my external address of my server. It's right? – fische Sep 05 '13 at 16:09
  • how about tomcat setting. Can you access to tomcat homepage or other war other than jenkins? It may not be jenkins problem. See updated answer. – William LAM Sep 05 '13 at 16:14
  • I change my configuration of tomcat. And I can't have access to tomcat. I have tomcat6. – fische Sep 05 '13 at 16:52
  • Would you mind posting your server.xml to your question? – William LAM Sep 06 '13 at 01:10
0

a) Open a Bash shell (Git Bash on Windows will do fine) on your home computer (not the Jenkins computer).

b) Perform a PORT FORWARD through a SECURE SSH TUNNEL to "map" port 8080 on the Jenkins computer to port 8080 on your home computer. The command to do this in the Git Bash shell is:

ssh -L 127.0.0.1:8080:localhost:8080 [email protected] -i "C:\PathToFolderContainingMySecretKey"

Here xx.yyy.zzz.ab is your public internet address (e.g., 62.187.151.9). Note that the path after -i is the path on your computer where you stored the private key which matches the public key you used on the Jenkins computer.

c) And now, on your home computer can connect like this: http://localhost:8080

d) The first time you configure Jenkins you'll need the initial admin password. Here's how to get it. In the Git Bash shell on the home computer (remember, you have already connected via SSH to the Jenkins computer):

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy and paste it into your browser, and away you go!

Gary
  • 1