Issue Listing multiple SVN repositories from client - apache

I've already setup Apache to manage svn requests.
Basically the structure of the svn related directory is this:
/Repository
-----OneRepo
-----TheOtherRepo
Repository is a "normal" directory, while OneRepo and TheOtherRepo are svn repositories.
I've used SVNParentPath and SVNListParentPath directives and if I go to localhost/Repository/ (with my browser) I can see all my repositories.
Now, if I try to access a single repository (for example: OneRepo) from a client (in my case Cornerstone but Versions is the same) everything works fine.
The problem is that I would like to access the repository listing from the client so that I have a big "folder" with all my projects in it. Does it make sense?
So, instead of writing http://192.168.x.x/Repository/OneRepo in my client (and it works) I would like to write http://192.168.x.x/Repository/ and view a listing of project and so checkout whatever project I would like to.
Is that possible?
Thanks

This works only in a http browser. So your standard SVN Client (commandline , TortoiseSVN, etc.) can not list your repositories

Related

Per repository AuthzSVNAccessFile apache rule with a single apache config file or other shell script solution

I am writing a set of svn hooks to allow remote management of the SVN repository, just like gitolite does with GIT.
I created the script that generates the AuthzSVNAccessFile for each repository I have, now I need to tell Apache to look for each of them depending on the repository.
I cannot have a apache config file for each repository, because it would need to restart the apache server.
I know I can use a single AuthzSVNAccessFile to manage multiple repository, but the script that build the file takes time (need to discover the full path of every dir inside the repository), and would make the commit take too long.
I tried to use mod_rewrite, but it did not work, maybe I used it wrong.
Basically I need to have a rule in my apache configuration file that reads different file depending on the URL requested, is that possible? How?
Or I need a script able to rewrite a block of a file. I am using sed to replace the strings I have in my template, but do not know how to use it to replace multiple lines.
Thanks for your time
No idea why you're trying to use mod_rewrite unless I'm entirely misunderstanding your question. But it sounds like you are using SVNParentPath and are having trouble figuring out how to configure the authz settings for all the repositories.
You have a couple of options.
Use one authz file
You can actually generate a single authz file and specify which repositories the rules apply to. The syntax is of the form [repos-name:path] (as you can find in the Path-Based Authorization section of the Subversion Book). One disadvantage of this is that if you have a lot of repositories and a lot of paths with rules it can slow things down. Which it sounds like you've run into. One thing that can help mitigate this some is using the following configuration
SVNPathAuthz short_circuit
SVNPathAuthz controls how requests for paths other than the URI are authorized when other paths need to be accessed than the URI of the request (e.g. log, commit, etc). The default behavior is to issue a sub-request. This generates a new GET request in httpd and sends it through all of the authorization infrastructure for httpd. However, in almost all cases this is not needed since the only authorization configuration that can vary with the path under the Location being used to serve SVN is the mod_authz_svn configuration. short_circuit, tells Subversion to avoid all of this and simply send the authorization info straight to mod_authz_svn who provides the answer directly limiting the delay.
That may still not be enough so there are a couple of alternatives, but you'll need at least 1.7 to use them.
AuthzSVNReposRelativeAccessFile
Subversion 1.7 added a new configuration directive that lets you specify a path relative to the conf subdirectory of the repository. For instance if you have a repo named foo you can put the authz file in /path/to/foo/conf/authz and then set the following configuration value:
AuthzSVNReposRelativeAccessFile authz
The directive prior to 1.7 that was used AuthzSVNAccessFile was relative to the server root path.
In Repository Authz*
Subversion 1.8 allows you to store the authz file in the repository itself. So for instance if you committed the file in the repo in a directory named conf as the file authz then you'd do:
AuthzSVNAccessFile ^/authz
The ^/ syntax is replaced with the full path to the repository.
You probably want to read the details on the linked release notes for 1.8 if you decide to use this.

SVN+Apache: Where to store repositories

I have been keeping all my Subversion repositories on my local computer for a while, but now I decided to move them to my web hosting server. It's an apache server and the hosting company has set up svn. My question is, where should I store my svn repositories. I originally stored them in the public_html/ directory, but (I'm certainly no security expert) I think only publicly available web content should be stored there. On the other hand, if I try storing the repositories in ~/var/svn/ then my subversion client (Eclipse) says "no element found". How do other people store their repositories with regards to Apache? Thank you.
You can select any physical location for your repositories collection, because logical path is defined inside Apache (Location container + SVNPath|SVNParentPath) later. You have only
select big partition (repository may require a lot of space)
don't forget chown|chmod repo dirs, in order to give Apache process the ability to handle files of repository
/var (/var/repos/) is good candidate for repo-root
Typically, you would store data in an appropriate subdirectory of /var (not ~/var), that is if you have access to it. E.g. /var/svn
We haven't adopted SVN for our web source yet, but have been using CVS. Our solution was to simply prevent Apache from serving the CVS store using IndexIgnore
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
You may be able to do something similar, using something based upon .svn.
It will be difficult if you are using a shared web hosting, because you need to have an access to root, to create svn-group and creating the structure of the repository. You also need to install some module on Apache like dav_svn. You will need to create a VirtualHost (sites-available) in order to serve your repos over a specific DNS.
There is a lot of tutorial on the inter-webs -> http://www.debuntu.org/how-to-subversion-svn-with-apache2-and-dav/ (for ubuntu)
Me, I rent a Virtual Private Server to host my SVN.

mounting a git http repository using davfs

I'm trying to convert some projects at work from subversion to git. The projects are websites and our current subversion setup uses davfs to mount the repository and point apache's document root there. This way apache in dev runs the code currently checked-into the svn repository.
mount:
mount.davfs http://code.repository/svn/site.com /mnt/davfs/site.com
httpd.conf:
ServerName site.com
DocumentRoot /mnt/davfs/site.com
I'm looking for a way to mimic this setup with git. But, from what I understand, mounting a git repository (yes, our git repo is accessed over http) this way will result in the git repository internals showing up as the docroot and not the code itself.
example:
ls /mnt/davfs/gitrepository
Parent Directory
HEAD
branches/
config
description
hooks/
info/
objects/
refs/
Does anyone know if there is a way to achieve the desired effect?
Thanks!
If you want to be able to browse the code, you should be using something like gitweb. If you want to push/pull from the repo, then the internals should be showing up as the docroot.
In a bare repository (the kind that you would use for such a central repo, since you generally don't want to push to non-bare repos), there is no actual checkout of the code files on disk, the only things in that bare repo are the "git internals".
If you want to get a copy of the code on the server out of the repository, you probably want to use git archive - possibly in a post-receive hook if you want it to run every time new code is pushed to the repository. See the following man pages for details:
http://www.kernel.org/pub/software/scm/git/docs/git-archive.html
http://git-scm.com/docs/githooks
Well the git repo is another beast. If you want to browse source code, you need something like gitweb. Mind you, if you just pointed to a svn repo, you'd be looking at internals too; The /mnt/davfs/site.com is probably hosted with apache mod-dav-svn which does something similar as gitweb would do.
You'll want to look at gitweb or competition. Gitweb is IMHO the simplest to setup
https://git.wiki.kernel.org/index.php/Gitweb
For sharing your repository (to make it clonable, e.g.) just serve the tree as static HTTP pages (as docroot directly) because davfs will not (reliably) make it possible for others to push to your repo anyway.
Pushing would be done using the Smart HTTP server, git-daemon or over ssh

Access older revision of SVN repo via HTTP / mod_svn

Using the mod_svn module for apache you can access the repository not onl via SVN client but also directly via HTTP using the same URL. You only get a plain directory listing showing the HEAD revision in such a case.
It is possible (may be via URL parameters) to access older revisions of the SVN repository if they has net been copied/tagged within the SVN?
I know that there are 3rd party software that allows to do so like ViewCV or WebSVN but I am interested in how far you get with only a plain SVN repository accessible via mod_svn and HTTP(S).
You can use the r querystring parameter to access older versions of files and directory listings with mod_dav_svn. For example:
http://host.example.com/repos/project/trunk/README.txt?r=1234
The SVN Book has more details on how this works.

Should I use an FTP server as a maven host?

I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to server I want to host the Maven repo on.
The online repository I want to use is not hosted by myself. As I say, I only have FTP access, so if possible, I would like to use that FTP space as a Maven repository. The tools mentioned seem to work when you have full control over the host machine, or at least more than just FTP access since you need to configure the local directories where the repositories will be placed. Is this possible?
You might want to have a look at Nexus, a Maven repository manager. We've replaced our local Maven repository with a Nexus-based one and find it tremendously useful.
I've successfully used Archiva as my repository for several years ... see http://archiva.apache.org/. It's easy to administer and allows you to configure as many repositories as you need (SNAPSHOT, internal, external, etc).
According to the book "Better Builds with Maven", the most common type of repository is HTTP, this paragraph describes what I think you need:
This chapter will assume the repositories are running from http://localhost:8081/ and that artifacts are deployed to the repositories using the file system. However, it is possible to use a repository on another server with any combination of supported protocols including http, ftp, scp, sftp and more. For more information, refer to Chapter 3.
A Maven 2 repository is simply a specific directory structure, so once you get the transport and server specifications right for the repository and deployment portion of your POMs, it should be completely transparent to your users.
You can even use Dropbox. All that you need is a public address to access the files generated with mvn deploy, with any of the protocols in the accepted answer.
I guess there are more services that can work in the same way, but I'm not certain about the URL schemes that alternatives to Dropbox may use.
https://maven.apache.org/wagon/wagon-providers/wagon-ftp/ will tell you that you can use ftp to read from an existing repository, but not to create a new one. I don't think that it is impossible in principle, but no one has cared to write all the fiddly code to do the directory management via ftp.