I wrote how to install redmine on a debian server with mysql and everything went fine so far, until one day somebody wanted to clone a repo.
fatal: http://domain.tld/git/example.git/info/refs not found:
did you run git update-server-info on the server?
So I thought it would solve the problem to run the command in the according git-repo. Nope, it didn’t. But accessing it via email@example.com/git/example.git did actually work fine. That’s what puzzled me. Long story short: The apache tried to deliver a directory respectively a file that simply didn’t exist in the path. My redmine is located in /var/www/redmine and there is simply no directory git/ in there. But the firstname.lastname@example.org/git/example.git was delivered by the gitosis daemon! So one could easily work while the other not.
So as soon I understood that I struggled with a totally different problem than git told me (the apache simply didn’t find the file), it was quite easy to fix it. Just add the following line to your redmine apache config, restart apache and everything should be fine.
Alias /git /srv/gitosis/repositories
So I wanted a bugtracker with a little of everything and git integration. First of all I must admit that this wasn’t easy and I wasted some time figuring out how to get this stuff working. Since I love to see tutorials and manuals myself, I’ll share my experience.
Be aware though that Ruby on Rails consumes a lot of RAM and will not run on 128MB RAM. I had to upgrade my VPS which now runs fine with 512MB RAM. I installed Redmine 1.0.1-stable on my Debian Squeeze 6 with the MySQL backend, but not without getting serious trouble when enabling the gitosis plugin: Whenever a username in git contained a umlaut, it just threw a server error. Finally I was able to tackle down the problem with a lot of help from friends over at #bsdprojects.
WARNING: This post is not intended to provide a foolproof guide or a newbie tutorial. This is meant for someone being able to handle a full root server.
Install the needed debian packages:
apt-get install acl apache2 apache2-mpm-prefork apache2-prefork-dev build-essential cron git-core gitosis git-daemon-run libapache-dbi-perl libapache2-mod-passenger libapache2-mod-perl2 libcurl4-openssl-dev libdigest-sha1-perl libgemplugin-ruby libgemplugin-ruby1.8 libmysqlclient15-dev libnet-ssh-ruby1.8 librmagick-ruby1.8 libruby-extras libruby1.8-extras mysql-server python-setuptools rake redmine redmine-mysql ruby ruby1.8-dev rubygems sudo wget
CONFIGURING & SETUP
This is where I failed in the first attempt, MySQL obviously has severe problems with the encoding and a configuration change was the solution eventually. Be sure to add the following to /etc/mysql/my.cnf before you do anything else:
default-character-set = utf8
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8
Now create the DB:
mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';
Installing the gems
Now comes the funny part, you need to exactly these versions or you’ll encounter strange errors:
gem install rails -v=2.3.11
gem install rack -v=1.1.0
gem install mysql
gem install -v=0.4.2 i18n
gem install inifile lockfile net-ssh
Get Redmine in place
ln -s /usr/share/redmine /var/www/redmine
chown -R www-data:www-data /var/www/redmine
chmod -R 755 /var/www/redmine
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
Now your Apache should be able to handle the redmine bugtracker.
/dev/foo / ext3 acl,errors=remount-ro 0 1
sudo -H -u gitosis ssh-keygen -t dsa
Set no password, use standard path/file
sudo -u gitosis cat ~gitosis/.ssh/id_dsa.pub | sudo -H -u gitosis gitosis-init
sed -i.orig 's:/var/cache:/srv/gitosis:g' /etc/sv/git-daemon/run
sv restart git-daemon
setfacl -m user:www-data:r-x,mask:r-x ~gitosis/.ssh
setfacl -m user:www-data:r--,mask:r-- ~gitosis/.ssh/id_dsa
script/plugin install git://github.com/xdissent/redmine_gitosis.git
sudo -u www-data X_DEBIAN_SITEID=default RAILS_ENV=production rake db:migrate:plugins
Point your browser to your installation, log in, go to Administration -> Plugins -> Configure Redmine Gitosis, change ‘localhost’ to your domain, change xdissent.com to your domain.
- create a normal user
- give him administrator access
- logout as admin, login as user
- create new project
- give yourself at least ‘Developer’ role (Settings -> Members)
- go to Settings -> Repository, choose git as SCM (this step was actually nowhere mentioned …)
- now you’ll see a new menu (on the blue background) called ‘Repository’, click on it and follow the instruction written there.
You should be able to push your git repo to the redmine server finally.
MySQL + UTF-8 = Not So Obvious
TUTORIAL: REDMINE WITH GIT AND GITOSIS ON UBUNTU 11.04
GitHub Clone with Redmine