Project

General

Profile

Actions

HowTo Automate repository creation » History » Revision 1

Revision 1/26 | Next »
Nicolas Chuche, 2007-11-18 20:13


Automating repository creation

overview

As of version 0.5.0, Redmine is able to handle Subversion repository creation. This is done by reposman.rb a script found in extra/svn/.

Projects are retrieved from Redmine using a SOAP web service. This web service is disabled by default in Redmine. To enable it, go to « Administration -> Settings » and check Enable WS for repository management.

With a recent version of Redmine (0.6.0 or re. 860 and later), reposman.rb can register the new repository in Redmine for you and set the owner of repository to who you want. If you have an older version, you will have to register repositories by yourself.

Notice that reposman.rb before re 916 has a right problem. You don't need to update redmine, just reposman.rb

command line arguments

It takes 2 mandatory arguments:

  • svn-dir: path to the directory where your svn repositories are located
  • redmine-host: host name of your Redmine install

And two optional arguments (added in re. 860):

  • owner: the files owner
  • url: the base url Redmine will use to access your
    repositories. With this option, reposman will register the new
    repositories so that you will have nothing to do

The Perl reposman version is deprecated for new installation as it can't register and set the owner.

question you should answer before going further

If Redmine and your svn repositories are on the same server, you can use the file:/// protocol of svn to browse them, but even if it seems a good idea, if later you want to move repositories on another server, you will have a problem because you can't change repository path in redmine for now.

The best way I can think of now is to do as if repositories and redmine are already on two different servers and using network subversion to allow Redmine browsing.

automating repository creation to authenticate with apache/webdav and mod_perl

You need a reposman.rb re. 916 or later. If you have an older one, you just need to update reposman.rb not Redmine.

You just need to invoke resposman.rb with the righ options :

  reposman.rb --redmine my.redmine.host --svn-dir /var/svn --owner www-data --url http://svn.server/svn-private/

FIXME go to ...

testing and debugging

You can launch the script by hand with the --verbose option with a user that can't write in the repository directory, you should have something like this :

ruby reposman.rb --redmine my.redmine.host --svn-dir /var/svn --owner www-data --url http://svn.my.domain/svn/ --verbose
querying Redmine for projects...
retrieved 2 projects
treating project myproject
svnadmin: Repository creation failed
...

It's normal the creation failed, you have no right, but the good point is that reposman find the Web Service and projects.

If this doesn't work, make sure you have check the Enable WS for repository management option.

You can now add it in your crontab :

cat /etc/cron.d/redmine
10 * * * * root ruby reposman.rb --redmine my.redmine.host --svn-dir /var/svn --owner www-data --url http://svn.my.domain/svn/ >> /var/log/reposman.log

Web Service and Security

For the moment, the WS is open to everybody once actived and you surely don't want that someone register repository's project for you. You can block access to the WS with apache (if you don't use apache, I let you do your homework...) with the Location apache directive like this :

   <Location /sys>
      Order allow,deny
      Allow from ip.of.my.svn.server
   </Location>

So if you are using apache and mongrel, you will have something like that :

<VirtualHost *:80>
   ServerName redmine.my.domain
   ServerAdmin webmaster@localhost

   <Location /sys>
      Order allow,deny
      Allow from ip.of.my.svn.server
   </Location>

   ProxyPass / http://localhost:3000/
   ProxyPassReverse / http://localhost:3000/
</VirtualHost>

Updated by Nicolas Chuche about 17 years ago · 1 revisions