Vitalie Lazu old blog

Another blog about ruby, rails, debian and system administration. Other useful staff for developers and system administrators.

Wednesday, November 12, 2008

How to setup a runit service for grails

Today I had a task to setup continuous integration for grails on EC2 server. I asked Google for a solution and it returns no results, so I want to share my experience., maybe it will be helpful for other system administrators.

Below is a little script that do all automatically, you will need just to start the service with:
sv start grails

You can also add a hourly cron job to update grails application from git or subversion.


apt-get install runit

mkdir -p $sv_dir/log

cat - > $sv_dir/run <<EOF

export JAVA_HOME='/opt/jdk1.6.0_10'
export PATH=${JAVA_HOME}/bin:$PATH

export JIBX_HOME='/opt/jibx'
export PATH=${JIBX_HOME}/bin:$PATH

cd /opt/apps/my_project
exec grails -Dserver.port=80 run-app

cat - > $sv_dir/log/run <<EOF

set -e
# use /mnt, because on EC2 a bigger disk is mounted to /mnt

test -d "$LOG" || mkdir -p -m2750 "$LOG" && chown nobody:adm "$LOG"
exec chpst -unobody svlogd -tt "$LOG"

chmod 755 $sv_dir/run $sv_dir/log/run

# add service
update-service --add $sv_dir

Labels: , ,


Post a Comment

<< Home