Search This Blog

Showing posts with label SQLite. Show all posts
Showing posts with label SQLite. Show all posts

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!