Search This Blog

Showing posts with label Redmine. Show all posts
Showing posts with label Redmine. Show all posts

Wednesday, November 18, 2015

Simple Redmine 3.1.2 Setup

Redmine 3.1.2 by Ruby 2.2.3, Rail 4.2.4 with SQLite3 on Debian 8 Jessie x86-64.


Redmine is a great OpenSource Project!
But to set it up is not that simple. I just want a simple Redmine running on SQLite, No Apache, no Nginx. And I want have the latest stable edition.




    1. First I create a Debian 8 Jessie VM, please let me know if you would like to have a Docker.

    2. Then install basic packages:




apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev


Check the SQLite version:
sqlite3 --version
3.8.7.1 2014-10-29 13:59:56 3b7b72c4685aa5cf5e675c2c47ebec10d9704221



    1. Install the latest Ruby stable 2.2.3 by rbenv:



git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

rbenv install 2.2.3
rbenv global 2.2.3

Check Ruby version:
ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]



    1. Install the latest stable Rails 4.2.4:



echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
gem install rails -v 4.2.4
# OR for the latest:
gem install rails


Check Rail version:
rails --version
Rails 4.2.4



    1. Install Redmine:



cd /var/www
wget http://www.redmine.org/releases/redmine-3.1.2.tar.gz
tar xzvf redmine-3.1.2.tar.gz
cd redmine-3.1.2/
cd config
cp database.yml.example database.yml

# Default setup is given for MySQL with ruby1.9.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

# SQLite3 configuration example
production:
adapter: sqlite3
database: db/redmine.sqlite3

gem install bundler



    1. First I try to install by:



bundle install --without development test

But it required rmagick package, which I don't want, so:
bundle install --without development test rmagick



    1. Generate basic configuration:



bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data



    1. I will not run it from by Apache or Nginx, so just test it by:



bundle exec rails server webrick -e production

Which will only give you access from local port 3000.

  1. To make it listen public access by port 80:


cd /var/www/redmine-3.1.2
root@gitredmine:/var/www/redmine-3.1.2# bundle exec rails server webrick -e production -b 192.168.1.219 -p 80

=> Booting WEBrick
=> Rails 4.2.4 application starting in production on http://192.168.1.219:80
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-11-18 16:47:10] INFO WEBrick 1.3.1
[2015-11-18 16:47:10] INFO ruby 2.2.3 (2015-08-18) [x86_64-linux]
[2015-11-18 16:47:10] INFO WEBrick::HTTPServer#start: pid=574 port=80

Please let me know if you like me port it to hub.docker.com.

Friday, March 6, 2015

Redmine Log rotation

Just upgrade to Redmine 3.0.0
Finds of that the Log rotation and level did not work anymore.

I tried both old and new way:
/var/www/redmine-3.0.0/config/additional_environment.rb

The old config:

config.logger = Logger.new(config.log_path, 7, 1024000)
config.logger.level = Logger::WARN


The new config:

config.log_level = :warn


I have to use logrotate at the end:

Here is my config file:
/etc/logrotate.d/redmine


/var/www/redmine-3.0.0/log/production.log {
su www-data www-data
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}


To test run:


logrotate --force /etc/logrotate.d/redmine

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!

Monday, September 30, 2013

Upgrade Redmine from 2.0.3 to 2.3.3, ruby 1.9.1 to 2.0

1.First backup everything:

1.1 backup database
1.2 backup redmine folder
1.3 backup /usr/local/ if you installed ruby manually.


2.Stop httpd service:

service httpd stop


3.Upgrade Rails version to 3.2.13

4.Remove ruby 1.9.1

rm -rf /usr/local/lib/ruby/1.9.1/
rm -rf /usr/local/lib/ruby/gems/1.9.1/
rm -rf /usr/local/include/ruby-1.9.1/


5.Install ruby 2.0

wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xzvf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247
./configure
make
make install
ruby -v
which ruby


6.Copy redmine config file to New stable 2.3.3


wget http://rubyforge.org/frs/download.php/77138/redmine-2.3.3.tar.gz
tar -xzvf redmine-2.3.3.tar.gz

cp /var/lib/redmine/config/database.yml ./config/database.yml
cp /var/lib/redmine/config/configuration.yml.example ./config/configuration.yml
cp /var/lib/redmine/files/* ./files/
rm ./files/delete.me


7.Copy plugins (version >= 2.0)

cp -r /var/lib/redmine/plugins/ ./plugins/


8.Re-compile passenger:

gem install passenger --no-rdoc --no-ri
passenger-install-apache2-module


9.Configure Apache mode: /etc/httpd/conf.d/passenger.conf

# Passenger Basic Setting
#
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.19
PassengerDefaultRuby /usr/local/bin/ruby


10.Re-check redmine for Apache: /etc/httpd/conf.d/redmine.conf


ServerName localhost
DocumentRoot "/var/www/redmine-2.3.3/public/"

# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews

ErrorLog logs/redmine-error_log
CustomLog logs/redmine-access_log common



11.clear the cache and the existing sessions:

rake tmp:cache:clear
rake tmp:sessions:clear


12.ReStart httpd service:

service httpd start


13.Check the error log

cat /var/log/httpd/redmine-error_log


14.Check daily backup tasks