Clone wiki

hgredmine / Installation



  • Install Redmine or ChiliProject
  • Download HgRedmine, Copy a example script from HgRedmine and configure Database
  • Deploy script with your prefered Webserver
  • setup reposman.rb

h2. Longer detailed way

This is the setup I use for our #openttdcoop Development Zone. I made a fresh setup and tried to use Distro Packages where ever possible. This guide will setup Redmine 1.2 and HgRedmine 1.2.1 (not yet tested, but it should also be possible to use ChiliProject 2.0 instead)

Other Apps we use:


hgmine:~ # zypper in mercurial

(rcs-5.7, python-xml-2.7, mercurial-1.7.5, mercurial-lang)


hgmine:~ # zypper in mysql-community-server ruby-mysql python-mysql

(libmysqlclient_r16-5.1.53, libmysqlclient16, mysql-community-server-client, mysql-community-server, ruby-mysql-2.8.1, python-mysql-1.2.3)

hgmine:~ # rcmysql start
Starting service MySQL                                                                                                                                                done
hgmine:~ # /usr/bin/mysql_secure_installation
... set root pw etc...
hgmine:~ # chkconfig -a mysql
mysql                     0:off  1:off  2:on   3:on   4:off  5:on   6:off

create the db and user for redmine

hgmine:~ # mysql -u root -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Server version: 5.1.53-log SUSE MySQL RPM

mysql> create database redmine character set utf8;
mysql> create user 'redmine'@'localhost' identified by 'my_password';
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
mysql> quit


hgmine:~ # zypper in nginx

(libxslt-1.1.26, libGeoIP1-1.4.7, nginx-1.0-1.0.0, GeoIP)

hgmine:~ # chkconfig -a nginx
nginx                     0:off  1:off  2:off  3:on   4:off  5:on   6:off

hgmine:~ # zypper in rubygem-passenger-nginx

(rubygem-fastthread-1.0.7, rubygem-daemon_controller-0.2.5, libev4-4.01, rubygem-passenger-3.0.7, rubygem-passenger-nginx)

Redmine 1.2

install Requirements

hgmine:~ # zypper in rubygem-rails

(ruby-1.8.7.p334, ruby-devel, rubygems-1.5.0, rubygem-rake-0.8.7, rubygem-rack-1.1.0, rubygem-activesupport, rubygem-activeresource, rubygem-activerecord, rubygem-actionpack, rubygem-actionmailer, rubygem-rails-2.3.11)

gems i18n is most probably not available from your distro, but simply use gem:
hgmine:~ # gem install i18n -v=0.4.2
Successfully installed i18n-0.4.2

optional gems:

hgmine:~ # zypper in rubygem-rmagick

(libltdl7-2.2.6b, libgomp45-4.5.1_20101208, libMagickCore4-, rubygem-rmagick-2.13.1)

hgmine:~ # gem install ruby-openid
Successfully installed ruby-openid-2.1.8

install Redmine

hgmine:~ # su - redmine
redmine@hgmine:~> hg clone
added 5064 changesets with 23507 changes to 3440 files (+2 heads)
1883 files updated, 0 files merged, 0 files removed, 0 files unresolved

redmine@hgmine:~> cd redmine/
redmine@hgmine:~/redmine> hg up 1.2.0
74 files updated, 0 files merged, 0 files removed, 0 files unresolved

redmine@hgmine:~/redmine> cp config/database.yml.example config/database.yml         
redmine@hgmine:~/redmine> vim config/database.yml
redmine@hgmine:~/redmine> rake generate_session_store
(in /home/redmine/redmine)
redmine@hgmine:~/redmine> RAILS_ENV=production rake db:migrate
redmine@hgmine:~/redmine> RAILS_ENV=production rake redmine:load_default_data
redmine@hgmine:~/redmine> ./script/server webrick -e production

you should now browse to repository settings and check Mercurial: a working hgredmine

Redmine works and we switch back to root and configure nginx to run redmine, but first the uwsgi to run hgweb for public read and push with hgredmine

redmine@hgmine:~> exit
hgmine:~ # zypper in uwsgi
(uwsgi might also not be available from your distro, building is simple)
hgmine:~ # su - hg

hg@hgmine:~> hg clone
added 30 changesets with 40 changes to 11 files
9 files updated, 0 files merged, 0 files removed, 0 files unresolved

I also clone the mercurial repo to have a good base to modify templates etc.

hg@hgmine:~> hg clone
added 14550 changesets with 28655 changes to 2035 files
915 files updated, 0 files merged, 0 files removed, 0 files unresolved
hg@hgmine:~> cd hg
hg@hgmine:~/hg> hg --version
Mercurial Distributed SCM (version 1.7.5)
hg@hgmine:~/hg> hg up 1.7.5
513 files updated, 0 files merged, 78 files removed, 0 files unresolved

hg@hgmine:~/hg> mkdir ../hgweb
hg@hgmine:~/hg> cp contrib/hgweb.wsgi ../hgweb/
hg@hgmine:~/hg> vim ~/hgweb/hgweb.config 
/hg/ = /home/hg/*

baseurl = /
;style = gitweb
;allow_archive = xz, bz2, gz, zip
staticurl = /static
;descend = false

;%include /home/hg/.hgrc

add path to this config to hg@hgmine:~/hgweb> vim hgweb.ini


the http line is for standalone http server to test uwsgi without nginx

hg@hgmine:~/hgweb> cd ../hgredmine/
hg@hgmine:~/hgredmine> cp sample-hgwebdir.wsgi
hg@hgmine:~/hgredmine> vim
from hgredmine.hgweb import HgRedmine

DSN = {
        'ENGINE' : 'mysql',
        'HOST'   : '',
        'PORT'   : 3306,
        'NAME'   : 'redmine',
        'USER'   : 'redmine',
        'PASSWORD' : 'my_password',
        'OPTIONS': {},

TITLE = 'Mercurial (Hg) Proxy for Redmine'
HGWEB_CFG_PATH = '/home/hg/hgweb/hgweb.config'

application = HgRedmine(TITLE, DSN, HGWEB_CFG_PATH)

We use same hgweb.config as for the public read server.

hg@hgmine:~/hgredmine> vim hgpush.ini


the push server listen on another port, you could also use file sockets btw.

now add uwsgi to crontab to start automatically on boot as user hg: hg@hgmine:~/hgredmine> crontab -e

@reboot cd /home/hg/hgweb && /usr/sbin/uwsgi --ini hgweb.ini
@reboot cd /home/hg/hgredmine && /usr/sbin/uwsgi --ini hgpush.ini

uwsgi setup and working, hgpush should not show any repo, as it does show only repos from redmine (test with user admin:admin)

configure nginx: