GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » History » Version 1

Version 1/6 - Next » - Current version
Paul zur Horst-Meyer, 2012-03-31 23:41
/etc/init.d/redmine


GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster

requirements

  • fresh und updated debian squeeze installation (preferable 64bit)
  • login as root

PS: i am sorry, but i don´t like to comment any part and command ob this install notes.
Copy and past should be work :P

Debian package install:

apt-get install imagemagick ruby ruby-dev libruby rubygems mysql-server libmysqlclient-dev libmagickwand-dev git sudo nginx

Ruby Gems package install:

gem install lockfile inifile net-ssh mysql rmagick rdoc mongrel mongrel_cluster
gem install rails -v=2.3.14
gem install i18n -v=0.4.2

you have to link some installed gems:

ln -s /var/lib/gems/1.8/bin/rake /usr/bin/
ln -s /var/lib/gems/1.8/bin/mongrel_rails /usr/bin/

User configuration

adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git
adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine

run visudo and add this content:

redmine  ALL=(git)      NOPASSWD:ALL
git ALL=(redmine) NOPASSWD:ALL

Setup Gitolite

... as Git user:

su git
cd ~

generate gitolite key pair for administration:

ssh-keygen -t dsa
  • Install path: /opt/gitolite/.ssh/gitolite_admin_id_rsa
  • using passphrase: no

getting sources:

wget https://github.com/sitaramc/gitolite/tarball/master -O gitolite.tar.gz
tar -xf gitolite.tar.gz

create .profile file in git home directory and put content:

PATH=/opt/gitolite/bin:$PATH

prepare setup and install gitolite

source .profile
sitaramc-gitolite-d59bc35/src/gl-system-install
gl-setup -q ~/.ssh/gitolite_admin_id_rsa.pub
rm -rf sitaramc-gitolite-d59bc35 gitolite.tar.gz
exit

give Redmine the administration key pair

mkdir 0700 /opt/redmine/.ssh
cp /opt/gitolite/.ssh/gitolite_admin_id_rsa* /opt/redmine/.ssh
chown -R redmine:redmine /opt/redmine/.ssh

Setup Redmine

... as Redmine user

su redmine
cd ~

getting sources:

wget https://github.com/redmine/redmine/tarball/1.3.2 -O redmine.tar.gz
tar -xf redmine.tar.gz
mv redmine-redmine-3490d2a/* .
rm -rf redmine-redmine-3490d2a redmine.tar.gz

prepare database configuration for Redmine:

add a MySQL user and a database for Redmine (find your own way :P):

cp config/database.yml.example config/database.yml
nano config/database.yml

setup tables and example data:

rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Setup plugin to manage repositories

cd vendor/plugins

getting sources:

wget https://github.com/ericpaulbishop/redmine_git_hosting/tarball/master -O redmine_plugin.tar.gz
tar -xf redmine_plugin.tar.gz
mv ericpaulbishop-redmine_git_hosting-fdca404 redmine_git_hosting
rm redmine_plugin.tar.gz

edit redmine_git_hosting/init.rb file and customize like you prefare, e.g:

httpServer 'yourRedmine.tld'
gitServer 'yourRedmine.tld'

comment out line 87 to disable Git Urls in repository view if you like

connect to localhost and accept the public key, cancel with ctrl+c and migrate the plugin

cd ~
ssh localhost
RAILS_ENV=production rake db:migrate_plugins

install mongrel/rails patch

cd ~/config/initializers/
wget http://www.redmine.org/attachments/download/6901/mongrel.rb
exit

Prepare Mongrel

directories:

mkdir /etc/mongrel
mkdir /var/run/mongrel
chown redmine:redmine /var/run/mongrel
mkdir /var/log/mongrel
chown redmine:redmine /var/log/mongrel

configuration:

mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /opt/redmine -C /etc/mongrel/redmine-cluster.yml -a 127.0.0.1 --user redmine --group redmine -l /var/log/mongrel/mongrel.log -P /var/run/mongrel/mongrel.pid

auto start up:

download "Redmine start script" 
chmod +x /etc/init.d/redmine
update-rc.d redmine defaults

Setup Nginx

creating own SSL Cert. chain (only for testing, example!):

mkdir /etc/nginx/ssl
cd /etc/nginx/ssl
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

download Nginx configuration and copy to /etc/nginx/sites-available/default, just overwrite existing file.

Setup Git-Daemon

download "Git-Daemon start script" to /etc/init.d/git-daemon

chmod +x /etc/init.d/git-daemon
update-rc.d -f git-daemon defaults

Finished!

reboot

Login at http://yourRedmine.tld with:

Login: admin
password: admin

redmine_mongrel.sh Magnifier - Redmine start script (782 Bytes) Paul zur Horst-Meyer, 2012-03-31 23:41

default.txt Magnifier - Nginx configuration (456 Bytes) Paul zur Horst-Meyer, 2012-03-31 23:41

git_daemon.txt Magnifier - Git-Daemon start script (1.53 KB) Paul zur Horst-Meyer, 2012-03-31 23:41