Can Jenkins CI be monitored with supervisor

amazon ec2Jenkinssupervisord

I'm running Jenkins CI on an Ubuntu EC2 micro instance (it's the only thing running).

Every so often, OOM killer strikes, which is a real pain (I've already configured jenkins memory usage to a bare minimum).

Can I use supervisor (or similar?) to spin up jenkins again?

If so, what would the supervisor run script look like?

Best Answer

The following will restart the service if it ends abruptly AND force an allocation of 512M of RAM for the java VM. Adjust accordingly to maybe .5 or .75 of your RAM. You need some idle RAM to cache all the workspaces.

[program:jenkins]
command = /usr/bin/java -Xms512m -Xmx512m -Xmsn512m -server -Djava.net.preferIPv4Stack=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
stdout_logfile = syslog
redirect_stderr = true
user = jenkins
Related Topic