Thursday, October 14, 2010

Hudson and Listen on Localhost only

I have been using Hudson for almost close to 3 years and have seen many many requirements from clients. Have been amazed by what all can be done using Hudson. Just yesterday, had a rather unusual requirement that Hudson was supposed to listen to only localhost. No user from outside the machine that Hudson was installed should be able to access it. A little bit of research, trial and error, and I was able to get this resolved in a few minutes.

So, next time you have this requirement to run Hudson locally and not be able to access from outside this machine, follow this very simple instruction.

In the normal way of starting Hudson, you will be using either your shell or batch file, which has the following command:

java -jar hudson.war --httpPort=7223

Now, when you don't want external access to Hudson other than localhost, start Hudson as follows:

java -jar hudson.war --httpPort=7223 --httpListenAddress=localhost

Try accessing Hudson from the same machine everything works fine:
Now, try accessing Hudson from another machine, in my case a Virtual Machine, you will see something like this:

Exactly what you want, right?
To see all other options you can provide while using Hudson and the default Winstone servlet container, take a look here:

4 comments:

  1. Meera,
    First off, I want to thank you for your blog. Your examples are clear, concise, and insightful. I particularly like the entries on service testing with SoapUI. Helped me out tremendously.

    But anyway, I've been searching for an article or opinions on the advantages and disadvantages on running Hudson from the lightweight Winstone container. Is there ever an instance where it would be better to run it from something like Glassfish or Tomcat? If you know of any articles, please direct me to them. Thanks.

    ReplyDelete
  2. Daniel,
    I have seen several requirements from clients for this feature. It is quite common to have Hudson run within Tomcat or any other AppServer. I haven't seen any articles on the same.

    I am planning on writing one, and will post it here.

    Thanks so much for your wonderful comment.

    ReplyDelete
  3. thanks for sharing with us its informative..

    ReplyDelete