2009年11月9日月曜日

CentOS5.3でgitoriousを動かすまで.

CentOS5.3でgitoriousを動かすまで.

以下は,gitorious.orgにある2009年11月7日版で動かす話.

おおむね,http://gitorious.org/gitorious/mainline/blobs/master/doc/recipes/install-centos.txt にある通りやればいいのだが,いかんせんupdateされていないので,酔狂な人以外はubuntuでやるのがいいと思います.

CentOSのpackage以外で利用したものは以下の通り.
  • ImageMagickのインストール.ImageMagick-6.5.5-3を自分は使った.
    • http://ftp.de.debian.org/debian/pool/main/i/imagemagick/imagemagick_6.5.5.3.orig.tar.gz
  • aspellとaspell-enのインストール.
    • http://ftp.de.debian.org/debian/pool/main/a/aspell/aspell_0.60.6.orig.tar.gz
    • http://ftp.de.debian.org/debian/pool/main/a/aspell-en/aspell-en_6.0-0.orig.tar.gz
  • sphinxのインストール
    • http://www.sphinxsearch.com/downloads.html
  • gitのインストール
    • git-1.6.5.2
  • oniguruma
    • onig-5.9.1.tar.gz
  • ruby enterprise.

http://gitorious.org/gitorious/mainline/blobs/master/doc/recipes/install-centos.txtにある通りなのだが違うところ.

/etc/init.d/git-daemon

#!/bin/bash
#
# Init file for Gitorious GIT-Daemon daemon
#
# chkconfig: 2345 55 25
# description: GIT-Daemon server daemon
#
# processname: git-daemon
# pidfile: /var/www/gitorious/log/git-daemon.pid

# source function library
. /etc/rc.d/init.d/functions
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH

RETVAL=0
PROG="git daemon"
GIT_DAEMON="/usr/local/ruby-enterprise/bin/ruby /var/www/gitorious/script/git-da
emon -d"
LOCK_FILE=/var/lock/git-daemon
PID_FILE=/var/www/gitorious/log/git-daemon.pid

do_check_pid() {
if [ -f $PID_FILE ]; then
PID=`cat $PID_FILE`
RUNNING=`ps --pid $PID | wc -l`
else
PID=0
RUNNING=0
fi
}

runlevel=$(set -- $(runlevel); eval "echo \$$#" )

start()
{
do_check_pid
if [ $RUNNING != 2 ] ; then
echo -n $"Starting $PROG: "
/bin/su git -c "$GIT_DAEMON"
sleep 1
if [ -f $PID_FILE ] ; then
success
else
failure
fi
RETVAL=$?
else
echo -n $"$PROG already running"
failure
fi
[ "$RETVAL" = 0 ] && touch $LOCK_FILE
echo
}

stop()
{
do_check_pid
echo -n $"Stopping $PROG: "
if [ $RUNNING != 2 ] ; then
failure $"Stopping $PROG"
else
killproc -p $PID_FILE
fi
RETVAL=$?
# if we are in halt or reboot runlevel kill all running sessions
# so the TCP connections are closed cleanly
if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
killproc -p $PID 2>/dev/null
fi
[ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
echo
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ] ; then
if [ "$RETVAL" = 0 ] ; then
stop
# avoid race
sleep 5
start
fi
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL

/etc/init.d/ultrasphinx

#!/bin/bash
#
# Init file for Gitorious Ultrasphinx daemon
#
# chkconfig: 2345 55 25
# description: Ultrasphinx server daemon
#
# processname: searchd
# pidfile: /var/www/gitorious/db/sphinx/log/searchd.pid
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH

RETVAL=0
START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start RAILS_ENV=production"
STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop RAILS_ENV=production"
RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart RAILS_ENV=production"
STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status RAILS_ENV=production"
LOCK_FILE=/var/lock/git-ultrasphinx
PID_FILE=/var/www/gitorious/db/sphinx/log/searchd.pid

case "$1" in
start)
/bin/su git -c "$START_CMD"
;;
stop)
/bin/su git -c "$STOP_CMD"
;;
status)
/bin/su git -c "$STATUS_CMD"
;;
restart)
/bin/su git -c "$RESTART_CMD"
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL

/etc/init.d/stomp

#!/bin/bash
#
# Init file for Gitorious stomp daemon
#
# chkconfig: 2345 55 25
# description: stomp server daemon
#
# processname: stomp
# pidfile: /var/www/gitorious/log/stomp.pid

# source function library
. /etc/rc.d/init.d/functions
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH

RETVAL=0
PROG=/usr/local/bin/stompserver
DAEMON=/usr/local/bin/stompserver
LOCK_FILE=/var/lock/stomp
#PID_FILE=/var/www/gitorious/log/stomp.pid

runlevel=$(set -- $(runlevel); eval "echo \$$#" )

start()
{
echo -n $"Starting $PROG: "
$DAEMON > /dev/null &
sleep 1
}

stop()
{
echo -n $"Stopping $PROG: "
killall stompserver
echo
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL

おわったらこの3つの/etc/init.d以下のファイルはchkconfig -add file名 で追加.

crontabにtask_performerはもういらない.

0 件のコメント:

コメントを投稿