Install Redmine with git and svn support over https on Debian wheezy using the Debian repository

This a short (incomplete) howto for those who want to stay within the debian repository.
IMPORTANT: The Debian package is v1.4.4. That version is out of support and has multiple security issues.

  • Basic install using postgresql backend
    See references for configuration
    Redmine version 1.4.4 is present the debian repository.
    aptitude install postgresql redmine redmine-pgsql redmine-plugin-botsfilter
    
  • make sure all the necesarry modules for apache are loaded
    See references for configuration
    eg.
    aptitude install libdbd-pg-perl
    
  • set up the vhosts
    See references for configuration
    • svn, apache enabled site
      in /etc/apache2/sites-enabled dir a site containing
      <VirtualHost *:443>
              ServerAdmin email@of.you
              DocumentRoot /var/www/redmine
              ServerName your.dns.org
      
              SSLEngine On
      
              SSLCertificateFile    /etc/apache2/ssl/yourcert.pem
              SSLCertificateKeyFile /etc/apache2/ssl/yourcert.key
              SSLCertificateChainFile /etc/apache2/ssl/yourcert.certificate_chain # optional, can be self signed
      
              <Directory /var/www/redmine>
                      RailsBaseURI /
                      PassengerResolveSymlinksInDocumentRoot on
                      # http://httpd.apache.org/docs/current/misc/perf-tuning.html
                      AllowOverride None
              </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
      </VirtualHost>
      
  • in conf.d dir eg svn.conf
    # /svn location for users
    PerlLoadModule Apache::Redmine
    <Location /svn>
        DAV svn
        SVNParentPath "/var/svn" 
        Order deny,allow
        Deny from all
        Satisfy any
    
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        AuthType Basic
        AuthName "Projectwerk Subversion Repository" 
    
        #read-only access    
        <Limit GET PROPFIND OPTIONS REPORT>
            Require valid-user
            # Allow from [my server ip]
            Allow from putyourserver.ipadress
            Allow from 127.0.0.1
            # Allow from another-ip
            Satisfy any
        </Limit>
        # write access
        <LimitExcept GET PROPFIND OPTIONS REPORT>
            Require valid-user
        </LimitExcept>
        ErrorDocument 404 default
    
        # postgresqlconnection
        RedmineDSN "DBI:Pg:dbname=redmine_default;host=localhost" 
        RedmineDbUser "redmine" 
        RedmineDbPass "geheim" 
    </Location>
    
  • git

in conf.d dir a git.conf file

PerlLoadModule Apache::Redmine

SetEnv GIT_PROJECT_ROOT /var/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

<Location /git>
  AuthType Basic
  Require valid-user
  AuthName "Projectwerk Git Repository" 

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

  # postgresqlconnectie leggen
  RedmineDSN "DBI:Pg:dbname=redmine_default;host=localhost" 
  RedmineDbUser "redmine" 
  RedmineDbPass "geheim" 
</Location>

don't forget to restart apache

  • set up cron repository creation
    See references for configuration
    • choose either only svn or git (one can only be the master repo)
    • if you want both u will need to register the second repo (git or svn) by hand on the redmine project site, for that you also need to make you use force.
      eg
      */5 * * * * root ruby /usr/share/redmine/extra/svn/reposman.rb --redmine localhost --scm Subversion --svn-dir /var/svn --owner www-data --url file:///var/svn --key=ARAZERAEZRZAER >> /var/log/redmine/reposman.log
      */30 * * * * root ruby /usr/share/redmine/extra/svn/reposman.rb -r localhost --scm Git --svn-dir /var/git --owner www-data --url /var/git --key=ARAZRRAEZRAEZRAEZ --verbose -f >> /var/log/redmine/reposman.log
      
  • svn repo appear after enabling repository module on the site,
    if u also have the git cron added, then u can add the git repo manually,
    redmine will complain, but it exists. So checkout the git repo, add a file, commit and push to server, redmine will no longer complain.

References:
http://www.redmine.org/issues/4905
http://www.redmine.org/issues/3958
https://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.html
http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_using_Debian_package
http://www.redmine.org/projects/redmine/wiki/HowToInstallRedmineOnUbuntuServer