redmine +svn complete integration : configuration problem

Added by Jean-Luc Pinardon almost 9 years ago

Dear all,

I am using :
@* Redmine 0.7.3
  • subversion 1.5.1
  • mongrel_rails 1.1.3
  • apache 2.2.8
    @
    On a Ubuntu Hardy Heron

My first problem concerns the apache configuration detailed in Repositories access control with apache mod dav svn and mod perl.
I have applied the section for 0.7.x and before.
My goal is to allow not only subversion repository browsing but also to automate SVN repository management.

Let's consider that I have a fresh svn installation with no repository at all within.
Mongrel cluster is started, and I can display the home page.
I have created a project and a user which is project manager.

I have added the apache conf suggested in the wiki article in a /etc/apache2/conf.d/redmine.conf file.
I also have configured a dedicated site as a VirtualHost, as described in HowTo run Redmine with a Mongrel cluster.
My server name is www.ccm_process.org and I have added a line :



in my /etc/hosts file.

The apache configuration file says that the access to the /svn path needs authentication.
What I am not sure to understand is how to configure the authentication. Should I need to create manually a htpasswd file in the repository parent path ?
Note that for now on, even when creating manually a repository (trial), I can't access to it via a simple svn list http://www.ccm_process.org/svn/trial
For sure, it asks me credentials ... and I can't give it any.

I am sure I have missed something ...

Thanks for your help.
Best Regards,
J-L

Replies (9)

RE: redmine +svn complete integration : configuration problem - Added by Jean-Luc Pinardon almost 9 years ago

Some additional information :

Checking the error log file defined in the redmine site configuration file, I get this error after a svn list

[Tue Dec 23 15:06:25 2008] [error] [client 127.0.0.1] Can't connect to data source '' 
because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix 
and the DBI_DRIVER env var is not set) at /usr/lib/perl5/Apache2/Redmine.pm line 340\n

The redmine site conf file contains the lines below :

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

     ## for mysql
    PerlSetVar dsn "DBI:mysql:database=redmine;host=localhost" 
    PerlSetVar db_user "redmine" 
    PerlSetVar db_pass "<redmine MySQL password>" 
...

... So I don't understand what's wrong ?

I really need some helps, because I don't know how to go on.

Have a nice day.
J-L

RE: redmine +svn complete integration : configuration problem - Added by Jean-Luc Pinardon almost 9 years ago

With the following complete configuration file /etc/apache2/conf.d/redmine.conf :

PerlRequire /usr/lib/perl5/Apache2/Redmine.pm
#PerlLoadModule Apache2::Redmine
   <Location /svn>
     DAV svn
     SVNParentPath "/var/svn" 

     AuthType Basic
     AuthName "CCM Process Environment" 
     Require valid-user

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

     ## for mysql
     PerlSetVar dsn "DBI:mysql:database=redmine;host=localhost" 
     PerlSetVar db_user "redmine" 
     PerlSetVar db_pass "redmine Mysql Database password"   # I have checked that mysql -D redmine -u redmine -p is OK with the given password
  </Location>

  # a private location in read only mode to allow Redmine browsing
  <Location /svn-private>
    DAV svn
    SVNParentPath "/var/svn" 
    Order deny,allow
    Deny from all
    # only allow reading orders
    <Limit GET PROPFIND OPTIONS REPORT>
      Allow from redmine.server.ip
    </Limit>
  </Location>

The apache server starts correctly, unless the warning below :

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Tue Dec 23 15:59:21 2008] [notice] Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal operations

Nevertheless http://127.0.0.1/ shows the Redmine home page.
But, when trying (As suggested in the documentation) a simple svn list on a freshly created empty repository :

svn list http://127.0.0.1/svn/essai

I have the error below :
svn: Le serveur a envoyé une valeur inattendue (501 Not Implemented) en réponse à la requête OPTIONS pour 
'http://127.0.0.1/svn/essai'
<my login@my machine>:/tmp$ DBI::db=HASH(0x84e2fe0)->disconnect invalidates 1 active statement handle 
(either destroy statement handles or call finish on them before disconnecting) at /usr/lib/perl5/Apache2/Redmine.pm line 155.

It seems that the problem comes from the connect_database function called from is_public_project.
I guess some mistake in the configuration file ... but I don't know what.

RE: redmine +svn complete integration : configuration problem - Added by Jean-Luc Pinardon almost 9 years ago

Dear all,

I have started again from scratch the configuration. But there are still problems.
The permission are as follows :
  • /var/svn belongs to root:www-data
  • apache is running as www-data user
  • redmine is served via mongrel run as redmine
  • redmine has www-data as additional group
    >ps -ef | grep apache
    1003      8868  7690  0 09:42 pts/1    00:00:00 tail -f /var/log/apache2/error.log
    root     10989     1  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 10990 10989  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 10991 10989  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 10992 10989  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 10993 10989  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 10994 10989  0 11:10 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 11425 10989  0 11:28 ?        00:00:00 /usr/sbin/apache2 -k start
    
    >id redmine
    uid=1004(redmine) gid=1004(redmine) groupes=1004(redmine),33(www-data)
    
    >ps -ef | grep mongrel
    redmine  10396     1  0 10:43 ?        00:00:06 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine/redmine-0.7.3/ --user redmine --group www-data -p 8000 -P tmp/pids/mongrel.8000.pid -l log/mongrel.8000.log
    redmine  10400     1  0 10:43 ?        00:00:06 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine/redmine-0.7.3/ --user redmine --group www-data -p 8001 -P tmp/pids/mongrel.8001.pid -l log/mongrel.8001.log
    redmine  10403     1  0 10:43 ?        00:00:06 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine/redmine-0.7.3/ --user redmine --group www-data -p 8002 -P tmp/pids/mongrel.8002.pid -l log/mongrel.8002.log
    

Also, for the moment, I haven't still set up the repository access control with mod_perl and so on.

First of all, when running as unpriviledged user :

ruby /home/redmine/redmine-0.7.3/extra/svn/reposman.rb --redmine 127.0.0.1  --svn-dir /var/svn --owner root --url http://svn.ccm_process.org/svn/ --verbose

I get this normal error :

querying Redmine for projects...
retrieved 1 projects
treating project Essai
...
    unable to create /var/svn/essai : svnadmin create /var/svn/essai failed


It is about permissions. OK as I am not root.
So, now running it with sudo, I get this :
querying Redmine for projects...
retrieved 1 projects
treating project Essai
    repository /var/svn/essai not registered in Redmine. Look in your log to find why.
    repository /var/svn/essai created

And I can effectively find /var/svn/essai with all the usual svn stuff within.
But :
  1. the directory essai belongs to root:root. Not root:www-data, as the parent directory, and an pre-existing repository.
  2. I don't know exactly what to search for in the (redmine ?) log, but it does not seem to have any error line.

I someone can help, I would be very glad ... something like a Christmas gift ? ;)

Best Regards and Happy Christmas !
J-L

RE: redmine +svn complete integration : configuration problem - Added by Jean-Luc Pinardon almost 9 years ago

Dear all,

First of all, have a nice and happy new year. I wish you all the best for you, your family and your projects, be it personal or professional.

Well, I come back with my problem.
I think I have solved most of my issues.

As a summary I would say :
  1. Be very careful with the permission.
    My working example is as follows :
    • apache is running as user www-data:www-data
    • redmine user's primary group is www-data
    • mongrel cluster is running as redmine:www-data
    • SVN repository parent path is /var/svn
    • /var/svn belongs to redmine:www-data and is rw for user and group :
      > ls -ailtd /var/svn
      58300 drwxrwxr-x 5 redmine www-data 4096 2009-01-06 15:05 /var/svn@
      !! To be checked : I am not sure it is mandatory to set redmine as /var/svn owner !!
  1. Redmine installation
    • redmine is installed in /home/redmine/redmine-<version>
    • I have copied (actually I have made a symbolic link) Redmine.pm onto /usr/lib/perl5/Apache2/Authn,
      to be compliant with the package name. Not sure it is mandatory, but it avoids a possible inconsistency reason.
    • If you get the 501 Not Implemented error, check this point.
  1. Serveur Configuration
    • Subversion can be accessed through http via svn.ccm_process.org
    • Redmine can be access through http via redmine.ccm-process.org
      Be carefull that mongrel_cluster does not understand at all site name with a _ char in the name.
      It seems that it strictly conforms with a RFC about domains name.
  1. Network environment
    Take care to proxy if you work behind a firewall. In such a case, when trying the automatic project detection and repository creation, you could get an error operation not permitted when trying to detect the project and create a new repository with reposman.rb.
    That's the reason why I have added the setting of the no_proxy environment variable in the crontab line.
  1. Repository Detection
    • I have set the following line within the redmine user's crontab :
      # m h dom mon dow command
      0,15,30,45 * * * * export PATH="/usr/bin:/bin";export no_proxy='*process.org:127.0.0.1/8' && date>>/var/log/reposman.log && ruby /home/redmine/redmine-0.8.0/extra/svn/reposman.rb --verbose --redmine-host=http://redmine.ccm-process.org/ --scm=subversion --svn-dir=/var/svn --owner=redmine --url=http://svn.ccm_process.org/svn/ >> /var/log/reposman.log 2>&1@
      You can check it works well by creating a project and only setting the SCM tool. Wait for a moment and check both the log file and the /var/svn directory. The new project should appear in the log, and the repository created with the id as root directory name.

So, I think that the configuration problem is resolved

Best Regards, and happy new year again :)
J-L

RE: redmine +svn complete integration : configuration problem - Added by Tim Klein over 8 years ago

hi jean

i'm having the same issues you had:

svn: Server sent unexpected return value (501 Not Implemented) in response to OPTIONS request
but cant get it working:

apache:

ps -ef | grep apache
root      4591     1  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4596  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4597  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4598  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4599  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4600  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4604  4591  0 16:08 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  4786  4591  0 16:10 ?        00:00:00 /usr/sbin/apache2 -k start
root      4873  4464  0 16:17 pts/0    00:00:00 grep apache

mongrel:

 ps -ef | grep mongrel
redmine   4693     1  1 16:09 ?        00:00:08 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine --user redmine --group www-data -p 8000 -P tmp/pids/mongrel.8000.pid -l log/mongrel.8000.log
redmine   4696     1  1 16:09 ?        00:00:08 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine --user redmine --group www-data -p 8001 -P tmp/pids/mongrel.8001.pid -l log/mongrel.8001.log
redmine   4699     1  1 16:09 ?        00:00:09 /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -c /home/redmine --user redmine --group www-data -p 8002 -P tmp/pids/mongrel.8002.pid -l log/mongrel.8002.log
root      4875  4464  0 16:17 pts/0    00:00:00 grep mongrel

redmine directory:

 ls -ailtd /home/redmine/
210503 drwxr-xr-x 17 redmine www-data 4096 2009-01-22 18:11 /home/redmine/

 ls -ailtd /home/subversion/
210856 drwxrwxrwx 5 redmine www-data 4096 2009-01-23 16:10 /home/subversion/

mongrel/apache error/access logs are not reporting any faults...

anthing you see so far?

RE: redmine +svn complete integration : configuration problem - Added by Jean-Luc Pinardon over 8 years ago

Hi Tim,

No.
Alas... Unfortunately not !
Really nothing new.
and I really like to find a solution ... some people around me are very interesting with this complete integration.
It is a mandatory criteria for them to adopt Redmine.

RE: redmine +svn complete integration : configuration problem - Added by Tim Klein over 8 years ago

hi jean,

after doing some further investigation and analysis of the production.log

It seems that redmine is trying to handle the /svn directory as well (and giving a 404)
I dont know why apache is not using dav svn instead.

however

I created another vhost for svn only on another domain
All running fine so far...

would be good if someone from the devs could have a look at this issue...

cheers,
Tim

RE: redmine +svn complete integration : configuration problem - Added by Thomas Pihl about 8 years ago

Any progress?

I am stuck in the same situation, seems like redmine tries to handle refs to /svn/repo and returns and 404.

/T

RE: redmine +svn complete integration : configuration problem - Added by Tim Klein about 8 years ago

hey thomas,

i solved it setting redmine up as a vhost (redmine.domain.com)as well as subversion (svn.domain.com)

so the svn requests are not confusing the redmine controllers

cheers

(1-9/9)