SVN and Rails problem

Hi guys,

I’ve finally managed to get my server up and running with
mongrel_cluster and all that jazz. My rails app works fine, but when I
try to access my svn repos as I was doing before everything was setup
rail is giving me a 404.

What can I add to my httpd.conf to prevent this? Here’s a snip from my
httpd.conf relating to the domain:

—HTTPD.CONF---------------------------

<VirtualHost 75.126.60.178:80>
ServerName fapbox.com
ServerAlias www.fapbox.com
DocumentRoot /home/fapbox/current/public
ServerAdmin [email protected]
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/fapbox.com combined
CustomLog /usr/local/apache/domlogs/fapbox.com-bytes_log “%{%s}t %I
.\n%{%s}t %O .”
<IfModule !mod_disable_suexec.c>
SuexecUserGroup fapbox fapbox

ScriptAlias /cgi-bin/ /home/fapbox/public_html/cgi-bin/

<Location /svn>
    DAV svn
    SVNParentPath /usr/local/svn/repos/private
    AuthType Basic
    AuthName "Fapbox Subversion Repository"
    AuthUserFile /usr/local/svn/users/passwords
    Require valid-user
</Location>

RewriteEngine On

# Rewrite domain.com to www.domain.com
RewriteCond %{HTTP_HOST} ^fapbox.com$ [NC]
RewriteRule ^(.*)$ http://www.fapbox.com$1 [R=301,L]

# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]

# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]

# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI}

[P,QSA,L]

# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml

application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

Jim N. wrote:

Hi guys,

I’ve finally managed to get my server up and running with
mongrel_cluster and all that jazz. My rails app works fine, but when I
try to access my svn repos as I was doing before everything was setup
rail is giving me a 404.

I usually find it easier to create a separate subdomain for Subversion,
say svn.example.com. Then you can have a separate virtualhost for your
repository and won’t have to fiddle too much with Apache routing.


Cheers,

  • Jacob A.

Jacob A. wrote:

Jim N. wrote:

Hi guys,

I’ve finally managed to get my server up and running with
mongrel_cluster and all that jazz. My rails app works fine, but when I
try to access my svn repos as I was doing before everything was setup
rail is giving me a 404.

I usually find it easier to create a separate subdomain for Subversion,
say svn.example.com. Then you can have a separate virtualhost for your
repository and won’t have to fiddle too much with Apache routing.


Cheers,

  • Jacob A.

Thanks Jacob,

I don’t suppose you have an example of how I would do this. I’m not very
good with server type stuff.

Jim N. wrote:

repository and won’t have to fiddle too much with Apache routing.

I don’t suppose you have an example of how I would do this. I’m not
very
good with server type stuff.

You will need to setup the subdomain in DNS. Then you will need to
restore your previous virtualhost config (the one where svn was
working). Keep your current virtualhost (the one where your Rails app is
working) and add the svn one so you have two separate virtualhosts.

My virtualhost for svn looks like this (except I changed the domain):

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /usr/local/www/data/repositories
ServerName svn.example.com
ErrorLog /var/log/apache/svn-error_log
CustomLog /var/log/apache/svn-access_log common
<Directory /usr/local/www/data/>
AllowOverride All


DAV svn
SVNParentPath /home/svn/repositories
Satisfy Any
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /home/svn/svn-users
AuthzSVNAccessFile /home/svn/svn-access
Require valid-user


Cheers,

  • Jacob A.

By the way my repository is located www.fapbox.com/svn/fapbox

Thanks for the reply Jacob. I’m having nothing but trouble trying to
setup the subdomain for some reason. Is there a way to make rails ignore
the svn directory directly through the conf file?

Actually I’ve managed to setup the subdomain but now when I try to
commit stuff I’m getting a PROPFIND 301 error.

Here’s my conf file:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

NameVirtualHost 75.126.60.178

<VirtualHost 75.126.60.178:80>
ServerName fapbox.com
[…SNIP…]

<VirtualHost 75.126.60.178:80>
ServerName svn.fapbox.com
ServerAlias www.svn.fapbox.com
DocumentRoot /usr/local/svn/repos/private
ServerAdmin [email protected]
CustomLog /usr/local/apache/domlogs/svn.fapbox.com combined
CustomLog /usr/local/apache/domlogs/svn.fapbox.com-bytes_log “%{%s}t
%I .\n%{%s}t %O .”

<Location />
    DAV svn
    SVNParentPath /usr/local/svn/repos/private
    AuthType Basic
    AuthName "Fapbox Subversion Repository"
    AuthUserFile /usr/local/svn/users/passwords
    Require valid-user
</Location>

Jim N. wrote:

<VirtualHost 75.126.60.178:80>
CustomLog /usr/local/apache/domlogs/svn.fapbox.com-bytes_log “%{%s}t
%I .\n%{%s}t %O .”

<Location />
    DAV svn
    SVNParentPath /usr/local/svn/repos/private

^^ Are you sure you mean SVNParentPath here?

SVNParentPath assumes that repositories are in subdirectories to this
path. If you only have one repository you shouldn’t use SVNParentPath, I
don’t recall the right directive, check the docs.


Cheers,

  • Jacob A.