Showing posts with label Mercurial. Show all posts
Showing posts with label Mercurial. Show all posts

Thursday, December 15, 2011

SCM-Manager

SCM-Manager is a cool Jetty based HTTP-server for managing your source code repositories. Just one single mangement instance for dealing with various SCMs which makes it a lot easier to maintain your projects.

SCM-Manager supports Mercurial, Git, and Subversion. You can manage all your users and their permissions very easily.  Of course SCM-Manager also provides bridges for different kinds of authentication like PAM, LDAP and Active Direcotry.

With a bunch of plugins  and the possibilty to write your own plugins there are basically no limitations with this great software. Highly recommended is the Jenkins plugin which allows to inform your CI whenever there are changes on your repo so there is no need for dump polling.

Installation on Debian / Ubuntu:
  •     download latest release of scm-server
  •     unpack to /opt/scm-server
  •     add the script below to /etc/init.d/scmserver
  •     add a user scmserver
  •     run update-rc.d-insserv scmserver defaults
  •     /etc/init.d/scmserver start

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          scmserver
# Required-Start:    $remote_fs $syslog $network
# Required-Stop:     $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start scmserver at boot time
# Description:       Control Repositories
### END INIT INFO

# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi

# Check for and source configuration file otherwise set defaults
RETVAL=0

appname=ScmServerDaemon

# See how we were called.
start() {
    # Call the scm-server script as our user
    /bin/su - scmserver -c "/opt/scm-server/bin/scm-server start >> /opt/scm-home/logs/scm-manager-output.log 2>&1 & "

}

stop() {
    if [ ! status = 0 ]
    then
          SCM_PID=$( ps auxwww | grep  java | grep ${appname} | awk '{print $2 }' )
          kill -9 $SCM_PID
    else
      echo "SCM is not running"
    fi

}

status() {
    ps auxwww | grep  java | grep ${appname} || echo "SCM is not running"

}

restart() {
    stop
    SECONDS=0
    STAT=$( ps auxwww | grep  java | grep ${appname} |  wc -l )
    while [ $STAT -ne 0 ]
    do
      sleep 3
        if [ $SECONDS -gt 300 ]
        then
          SCM_PID=$( ps auxwww | grep  java | grep ${appname} | awk '{ print$2 }' )
          kill -9 $SCM_PID
        fi
      STAT=$( ps auxwww | grep  java | grep ${appname} |  wc -l )
    done
    start

}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        status
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $RETVAL