See a Subversion repository from Redmine

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Windows installer for the Bitnami Redmine Stack no longer includes Subversion. Linux and Mac OS X installers for this stack continue to include Subversion as before.

Redmine lets users check repository changes and link to cases. Simply configure the “Repository URL” in the project’s “Settings -> Repositories” tab.

SCM: Subversion
URL: http://your_repository
Login: repository_login
Password: repository_password

Redmine and Subversion

Configure Redmine for advanced integration with Subversion

Before starting this guide, take into account that this is not necessary to see the repository changes in the Redmine application. If you only want to see the repository changes and link to the issues, it is only necessary to configure the project repository: “Project -> Settings -> Repository -> URL and Control Version System”.

This Redmine configuration is for automatic repository creation and rights management. Since v1.1.3-1, Redmine Stack ships all required modules for this configuration. This guide has been updated to work with Redmine 2.1.4.

Follow these steps:

  • Install the ActiveResource gem:

      $ sudo installdir/ruby/bin/gem install activeresource
  • Make sure that the mod_dav module is enabled in your Apache configuration file (httpd.conf). This module should be loaded before the modules mentioned in the next step.

      LoadModule dav_module modules/
  • Add the following lines in the Apache configuration file:

      LoadModule dav_svn_module modules/
      LoadModule perl_module modules/
  • You will also need to add the following lines to the installdir/apache2/bin/envvars file (the path may change depending on the version):

      export LD_LIBRARY_PATH
  • Copy the file into the Perl modules folder:

      $ cp installdir/apps/redmine/htdocs/extra/svn/ installdir/perl/lib/site_perl/5.16.3/*/Apache2/
  • Create a directory for the repository, for instance:

      $ sudo mkdir -p installdir/repository/svn
      $ sudo chmod -R 0755 installdir/repository
      $ sudo chown -R root:daemon installdir/repository

    If you installed the stack using a non-root user account, replace the root:daemon username in the command above with the username you used at installation time.

  • Add these lines to the installdir/apps/redmine/conf/httpd-app.conf file:

      PerlLoadModule Apache2::Redmine
      <Location /svn>
        DAV svn
        SVNParentPath "installdir/repository/svn"
        Order deny,allow
        Deny from all
        Satisfy any
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        AuthType Basic
        AuthName "Redmine SVN Repository"
        #read-only access
           Require valid-user
           Allow from all
           # Allow from another-ip
           Satisfy any
        # write access
          Require valid-user
        ## for mysql
        RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost;mysql_socket=installdir/mysql/tmp/mysql.sock"
        RedmineDbUser "bitnami"
        RedmineDbPass "bitnami_database_password"
        #You can find this value at installdir/apps/redmine/htdocs/config/database.yml
  • Restart the server:

        $ sudo installdir/ restart apache
  • Log in to the Redmine application as administrator and navigate to “Settings -> Repositories -> Enable WS for repository management”.

  • Click “Generate a key” and save the key.

  • Add the following line in the crontab. You can edit the crontab using the command crontab -e:

      */2 * * * * installdir/ruby/bin/ruby installdir/apps/redmine/htdocs/extra/svn/reposman.rb --redmine http://localhost:YOUR_APACHE_PORT --svn-dir installdir/repository/svn --owner root --group daemon --command="installdir/subversion/bin/svnadmin create --pre-1.6-compatible --fs-type fsfs" --url http://localhost:YOUR_APACHE_PORT/svn --key="YOUR_API_KEY" --verbose >> /var/log/reposman.log

    Note that localhost, YOUR_APACHE_PORT and YOUR_API_KEY are placeholders, please replace them with the actual domain of your Redmine server, the port used by Apache and the Redmine API key.

    If you have configured Redmine for access over SSL, you can specify --redmine https://localhost in the previous crontab line.

    If you installed the stack using a non-root user account, replace the root username and daemon group name in the command above with the ones you used at installation time.

Check that everything works properly creating a project from the Redmine application and checking the /var/log/reposman.log file.

Thanks to Jedbifa who posted a complete guide in the Bitnami forums.

Last modification September 5, 2019