User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Now that you have your Redmine server working you may want to add SVN to it.

First you will need to install some things.

mkdir /var/svn

chown root:www-data /var/svn

chmod 0750 /var/svn

 

cd /var/www/vhosts/redmine/extra/svn/ruby reposman.rb --redmine www.yoursite.com --svn-dir /var/svn --owner www-data --url http://www.yoursite.com/svn/ --key=KeyFromWebAdminRedmine

 

cp /var/www/vhosts/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm

 

 

apt-get install libapache2-svn

apt-get install libapache-dbi-perl

apt-get install libapache2-mod-perl2

apt-get install libdbd-mysql-perl libdigest-sha1-perl

apt-get install libdbd-mysql-perl

a2enmod perl

cd /etc/apache2/sites-available/

nano default

------------------------------------------------------------------- add to your existing port 80 site. after </Directory>---------------------------

# /svn location for users
   PerlLoadModule Apache::Redmine
<Location /svn>
     DAV svn
     SVNParentPath "/var/svn"
     Order deny,allow
     Deny from all
     Satisfy any
     # If a client tries to svn update which involves updating many files,
     # the update request might result in an error Server sent unexpected
     # return value (413 Request  Entity Too Large) in response to REPORT
     # request,because the size of the update request exceeds the limit
     # allowed by the server. You can avoid this error by disabling the
     # request size limit by adding the line LimitXMLRequestBody 0
     # between the <Location...> and </Location> lines.
     LimitXMLRequestBody 0

     # Only check Authentication for root path, nor again for recursive
     # folder.
     # Redmine core does only permit access on repository level, so this
     # doesn't hurt security. On the other hand it does boost performance
     # a lot!
     SVNPathAuthz off

     PerlAccessHandler Apache::Authn::Redmine::access_handler
     PerlAuthenHandler Apache::Authn::Redmine::authen_handler
     AuthType Basic
     AuthName "Redmine SVN Repository"

     #read-only access
     <Limit GET PROPFIND OPTIONS REPORT>
        Require valid-user
        Allow from 192.168.1.55
        # Allow from another-ip
         Satisfy any
     </Limit>
     # write access
     <LimitExcept GET PROPFIND OPTIONS REPORT>
       Require valid-user
     </LimitExcept>

     ## for mysql
     RedmineDSN "DBI:mysql:database=redmine;host=localhost"
     RedmineDbUser "redmine-user"
     RedmineDbPass "redminepassword"
  </Location>

---------------------------------------------------------------------- end add --------------------------------------------------------

service apache2 restart

 

You may want to automate the repository discovery by adding a cron job.

I added created a file called pullrepos.sh

------------------------------------------------------- this is the content of that file -----------------------------------------------------

rvm_bin_path=/usr/local/rvm/bin
GEM_HOME=/usr/local/rvm/gems/ruby-1.9.3-p429
TERM=xterm
SHELL=/bin/bash
IRBRC=/usr/local/rvm/rubies/ruby-1.9.3-p429/.irbrc
OLDPWD=/var/www/vhosts/redmine
MY_RUBY_HOME=/usr/local/rvm/rubies/ruby-1.9.3-p429
SSH_TTY=/dev/pts/0
USER=root
rvm_path=/usr/local/rvm
rvm_prefix=/usr/local
MAIL=/var/mail/root
PATH=/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PWD=/usr/bin
LANG=en_US.UTF-8
SHLVL=1
HOME=/root
LOGNAME=root
GEM_PATH=/usr/local/rvm/gems/ruby-1.9.3-p429:/usr/local/rvm/gems/ruby-1.9.3-p429@global
RUBY_VERSION=ruby-1.9.3-p429

cd /var/www/vhosts/redmine/extra/svn/
ruby reposman.rb --redmine www.yoursite.com --svn-dir /var/svn --owner www-data --url http://www.yoursite.com/svn/ --key=KeyFromWebAdminRedmine

------------------------------------------------------- end of content-----------------------------------------------------

I'll run this file every :10 of the hour to check for new projects

crontab -e -u www-data

10 * * * * /var/www/vhosts/redmine/pullrepos.sh