Tuesday, June 15, 2010

Redmine Setup using Turnkey Linux

Redmine Install Process

-- Download and install turnkey linux's redmine appliance
http://www.turnkeylinux.org/redmine

-- install updates and required packages
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install aptitude
sudo aptitude install libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libdigest-sha1-perl

-- enable required packages in apache 2
sudo a2enmod dav
sudo a2enmod dav_svn
sudo a2enmod perl

-- copy Redmine.pm file to apache perl lib files
sudo cp /var/www/railsapp/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm

-- create redmine config file for apache
sudo nano /etc/apache2/conf.d/redmine

# /svn location for users
PerlLoadModule Apache::Redmine

DAV svn
SVNParentPath "/srv/repos/svn"

AuthType Basic
AuthName redmine
Require valid-user

PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler

## for mysql
RedmineDSN "DBI:mysql:database=railsapp_production;host=localhost"


RedmineDbUser "root"
RedmineDbPass "*********"
Allow from all


-- Restart apache
sudo apache2ctl restart

-- setup permissions
sudo chown root:www-data /srv/repos/svn

-- update crontab
sudo crontab -e

*/2 * * * * ruby /var/www/railsapp/extra/svn/reposman.rb --redmine localhost --svn-dir /srv/repos/svn --owner www-data --url file:///srv/repos/svn/ >> /var/log/reposman.log

-- Turn on WS for repo
Navigate your web browser to the box
Go to « Administration -> Settings -> Repository » and check Enable WS for repository management.

-- create svn project in redmine
Go to « Administration -> project » New Project

-- connect project to svn
Go to « Projects -> [Project Name] -> settings -> Repository » and set the following settings
SMC: Subversion
url: file:///srv/repos/svn/[Project Name]
login: [Redmine admin account from DB]
password: [Redmine Password]

-- add users to redmine
Go to « Administration -> Users » add New user and assign them to a project

-- connect eclipe to svn
install svn plugin
add svn locaiton: http://[Server URL]/svn/[project name]

-- create backup script in linux
sudo nano /root/backup.sh

#!/bin/sh

rm /root/redmineBackup.sql.gz
rm /root/redmine_vtd2.svn.gz

# SQL Backup
mysqldump -uroot -p************ railsapp_production | gzip > /root/redmineBackup.sql.gz

# File Backup
svnadmin dump /srv/repos/svn/vtd2/ | gzip > /root/redmine_vtd2.svn.gz

# move redmine files and database to file server for
# offsite backup



ftp -in < open [FTP]
user [USER] [PASS]
bin
put /root/redmineBackup.sql.gz /redmineBackup.sql.gz
put /root/redmine_vtd2.svn.gz /redmine_vtd2.svn.gz
close
bye
EOF

-- Add backup to contab
sudo nano /etc/crontab

# Custom backup
0 22 * * * root sh /root/backup.sh

Thursday, June 10, 2010

How to install Redmine on Ubuntu 10.04

This was a huge struggle for me until i found the following blog:

Here is what i did to make this work plus some of my edits as i ran into a couple problems:


Introduciton

Redmine is an open source, web-based project management and bug-tracking tool. It includes calendar and gantt charts to aid visual representation of projects and their deadlines. It supports multiple projects. Redmine is free and open source software which provides integrated project management features, issue tracking, and support for multiple version control options.

The design of Redmine is significantly influenced by Trac, a software package with some similar features.

Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database.

Installation Steps
The following are my steps to install it on the new Ubuntu 10.04 system:
1) install mysql server & phpmyadmin tool
$ sudo apt-get install mysql-server phpmyadmin
You can just set all initial passwords to 'admin'. When finished, you can use http://localhost/phpmyadmin to manage your databases.

2) change mysql database directory (optional, I just want to store it in the /srv directory)
$ mysqladmin -u root -p shutdown
$ sudo mv /var/lib/mysql /srv/
$ sudo nano /etc/mysql/my.cnf (change datadir value from "/var/lib/mysql" to "/srv/mysql")
$ sudo nano /etc/apparmor.d/usr.sbin.mysqld (replace all "/var/lib/mysql" to "/srv/mysql")
$ sudo /etc/init.d/mysql restart (FIXME: doesn't work, I just reboot the system instead)

3) install redmine & redmine-mysql
$ sudo apt-get install redmine redmine-mysql

4) install rails...
$ sudo apt-get install mongrel ruby1.8-dev

5) change redmine files default directory (optional, I prefer to store them in the /srv directory)
$ sudo mv /var/lib/redmine /srv/
$ sudo nano /usr/share/redmine/config/ennanoronment.rb (replace all "/var/lib" to "/srv")

6) test redmine
$ cd /usr/share/redmine
$ sudo mkdir /usr/share/redmine/log
$ sudo ruby /usr/share/redmine/scripts/server -e production
(now in PC web-browser, you can use http://localhost:3000 to do the test)

7) configure apache to run redmine
$ sudo apt-get install libapache2-mod-passenger (seems it has been already installed)
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
$ sudo a2enmod passanger (seems already been enabled too)
$ sudo nano /etc/apache2/sites-available/default

Add the following lines:
+ RailsEnv production
+ RailsBaseURI /redmine

Should look like this (replace all the [ and ] with < and >):

[VirtualHost *:80]
RailsEnv production
RailsBaseURI /redmine

DocumentRoot /var/www
[Directory /]
Options FollowSymLinks
AllowOverride None
[/Directory]
[Directory /var/www/]
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
[/Directory]

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
[Directory "/usr/lib/cgi-bin"]
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
[/Directory]

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
[Directory "/usr/share/doc/"]
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
[/Directory]

[/VirtualHost]

$ sudo chown www-data /usr/share/redmine/config/ennanoronment.rb
$ sudo /etc/init.d/apache2 reload

Thats it...

Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.