Saturday, December 6, 2014

Debian 8 Jessie minimal Redmine Server with SQLite3

Debian 8 Jessie is on Beta 2, it has most package you need for 99% of my works.

Here is how it setup a Minimal Redmine Server from Debian 8 Jessie Beta2:

  1. First Insall Ruby ( version 2.1 perfect for Redmine version 2.4, 2.5 and 2.6 )


  2. # apt-get install ruby ruby-dev make gcc libsqlite3-dev


  3. Download Latest Redmine Stable 2.6.0 at this time



  4. # mkdir -p /var/www
    # cd /var/www
    # wget http://www.redmine.org/releases/redmine-2.6.0.tar.gz
    # tar xzvf redmine-2.6.0.tar.gz


  5. Install Redmine follow Redmine's official Installation document


  6. http://www.redmine.org/projects/redmine/wiki/RedmineInstall

  7. my brief installation recorders

  8. Define SQLite Database in config/database.yml
    # SQLite3 configuration example
    production:
    adapter: sqlite3
    database: db/redmine.sqlite3


    install Bundler first

    # gem install bundler
    # bundle install --without development test rmagick


    Session store secret generation
    # rake generate_secret_token


    Database schema objects creation
    # RAILS_ENV=production rake db:migrate


    Database default data set
    # RAILS_ENV=production rake redmine:load_default_data


    Test the installation
    # ruby script/rails server webrick -e production


  9. Setup Redmine init script, run WEBrick service

  10. Reference: https://gist.github.com/FeroVolar/7911366
    http://www.redmine.org/boards/1/topics/9334?r=14295

    My /etc/init.d/redmine file:

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: redmine
    # Required-Start: $all
    # Required-Stop: $all
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: redmine webrick
    # Description: redmine webrick server autostart-script
    ### END INIT INFO

    PATH=/bin:/usr/bin:/sbin:/usr/sbin
    DESC="redmine webrick daemon"
    NAME=redmine
    PIDFILE=/var/run/redmine.pid
    SCRIPTNAME=/etc/init.d/"$NAME"

    . /lib/lsb/init-functions

    # Modify it to your configuration
    DIR=/var/www/redmine-2.6.0/

    # Start Redmine in daemon mode.
    do_start(){
    cd $DIR
    ruby script/rails server webrick -d -e production -p 80 > /var/log/redmine.log
    }

    # Stop Redmine daemon
    do_stop(){
    RUBYPID=`ps aux | grep "ruby script/rails server webrick" | grep -v grep | awk '{print $2}'`
    if [ "x$RUBYPID" != "x" ]; then
    kill -2 $RUBYPID
    fi
    }

    # Check if Redmine is running
    do_status(){
    RUBYPID=`ps aux | grep "ruby script/rails server webrick" | grep -v grep | awk '{print $2}'`
    if [ "x$RUBYPID" = "x" ]; then
    echo "* Redmine is not running"
    else
    echo "* Redmine is running"
    fi
    }


    case "$1" in
    start)
    do_start
    ;;

    stop)
    do_stop
    ;;

    status)
    do_status
    ;;

    restart|force-reload)
    do_stop
    do_start
    ;;

    *)
    echo "Usage: $0 {start|stop|restart|force-reload|status}"
    exit 1

    esac


  11. Update systemd init service:


  12. # update-rc.d redmine defaults
    # systemctl daemon-reload
    # service redmine start
    # service redmine stop




Please notice: Redmine with SQLite3 is not for multi-user production system. Webrick server is not for high traffic site as well.

But hey, I got redmine running on a 64 MB VM in 5 mintues!

2 comments:

  1. Hi, I tried your method above trying to get redmine running on Jessie, but it fails with the message:

    script/rails no longer exists, please use bin/rails instead

    I tried substituting /usr/bin/rails which resulted in a usage message from rails. Have you any update on using your script with Jessie and the latest version of redmine?

    Many thanks

    ReplyDelete
  2. Hi There,

    On Jessie everything seems so new, I need refresh my script.

    Let me know if you have any luck.

    ReplyDelete