Archive

Archive for September, 2011

Start JoNaS server from Jenkins with a shell script

September 19th, 2011 No comments

Continuous integration is a process that involves the build of the project but also the deployment of the artefacts (the term used with Maven). These artefacts are archives such as EAR, WAR, JAR files.
I had to write a shell script in Jenkins that would run just after the build and that would stop the JoNaS server, deploy the artefacts and restart JoNaS.

The project is based on Maven. However to create a job that executes a shell script, the first option “Build a free-style software project” seems best, instead of the “Build a maven2/3 project” option.
The process is quite simple :
1) stop JoNaS
2) delete the previous EAR file
3) copy the EAR file that was just built to the JoNaS deploy folder
4) restart JoNaS

I chose to poll the SCM every 10mn. So that means JoNaS checks every 10mn if a commit occured during the last 10mn. If so, it builds the project again. And deploys it.

Notice the highlighted line export BUILD_ID=dontKillMe. This is very important.
I spent about 2 hours wondering why JoNaS would start and then would stop after 20 or 30 seconds.
The reason is that Jenkins attempts to clean up after itself, so all processes that have that build ID are killed by default. So that processes do not accidentally leak and run the machine out of memory, for one.

The issue is described in this page with a funny title :
https://issues.jenkins-ci.org/browse/JENKINS-2729
Other interesting link :
http://wiki.hudson-ci.org/display/HUDSON/ProcessTreeKiller

Categories: Continuous integration, Jenkins, JOnAS Tags:

Proxy vs Reverse-proxy

September 12th, 2011 No comments

The other day I was asked by a coworker the difference between a proxy and a reverse-proxy.
These are 2 types of servers that are largely used in front of an application server. Many companies and schools filter their internal network through proxies.
So I made this drawing, I think it should come handy to a lot of people.
Many people are familiar with the proxy server that they need to configure in their browser to access the internet. But few people are familiar with the reverse-proxy server.

To sum things up :
1) The proxy server’s main job is to cache pages so it serves them if the client asks them again.
2) The reverse-proxy server’s main job is to secure the servers as it takes the incoming requests from the internet and forwards them to the servers. Other jobs are : load balancing, filtering and also caching.

The reverse-proxy can be located in a demilitarized zone (DMZ), that is a very secured area, between 2 firewalls for instance.
One thing to remember :
if the firewall is removed, the client still can access the internet. If the proxy is removed, the client cannot access the internet.

Categories: Architecture Tags: