Reputation: 2256
I have a Subversion (Apache2 + mod_dav) server running on a Debian server on my private network. I also have a Redmine installation running on a Internet-publicly available server. This can't be changed: Subversion server must stay local/private and Redmine must stay public.
I would like to use the SVN features of Redmine (linking issues with commits) but I can't find a way for Redmine to access the SVN repositories (without NAT/PAT-ing for the subversion server).
I was thinking of a way to clone or mirror an entire Subversion (or even a selection of) repository but is it really a good solution? The repositories I would like to link to Redmine take about 800MB and there is enough space on the Redmine server.
Upvotes: 1
Views: 476
Reputation: 2256
I finally set up a "post-commit" hook that does a rsync of the repository.
/var/svn/myproject/hooks/post-commit:
REPOS="$1"
REV="$2"
#"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
if [ $# -ge 1 ]; then
/var/svn/.hooks/rsync-to-redmine "$REPOS" "$REV"
else
echo "ERROR: No repository given"
fi
/var/svn/myproject/hooks/post-commit:
#!/bin/bash
# Configuration
rsyncExecutable="/usr/bin/rsync"
localRepositoryBasePath="/var/svn/"
remoteUser="svnsync"
remoteHost="redmine.mycompany.com"
remoteRepositoryBasePath="/var/svn/"
privateKeyFilePath="/var/svn/.hooks/rsync-to-redmine-certFile"
# /Configuration
repositoryName=`basename "$1"`
if [ -z $repositoryName ]; then # No repository name given
echo "ERROR: No repository name given"
else
if [ -d "$localRepositoryBasePath$repositoryName/" ]; then # Given repository name seems to exists
repositoryDirectoryRealpath=`realpath "$localRepositoryBasePath$repositoryName"`/ # Compute realpath to validate directory (to protect against $1 setted to ".")
if [ "$repositoryDirectoryRealpath" != "$localRepositoryBasePath" ]; then # Directory is not the base path (otherwise we would rsync the entire $localRepositoryBasePath directory
#TODO: Check that $repositoryDirectoryRealpath is under $localRepositoryBasePath
$rsyncExecutable -rltgoDvz -e "ssh -i $privateKeyFilePath" "$repositoryDirectoryRealpath" "$remoteUser@$remoteHost:$remoteRepositoryBasePath$repositoryName"
else
echo "ERROR: Trying to rsync the whole '$localRepositoryBasePath' base directory"
fi
else
echo "ERROR: Directory '$localRepositoryBasePath$repositoryName' doesn't exists"
fi
fi
When someone commits on the SVN repository, the rsync program will push the modifications on $remoteHost into $remoteRepositoryBasePath directory.
Upvotes: 0
Reputation: 634
You could try directly exposing your local server to the public web using http://pagekite.net/. (Disclaimer: I created PageKite)
If you dig into the options it is possible to restrict access by password or source IP, so it wouldn't necessarily be a huge security risk (not sure if you are worried about that or not). Feel free to send us an e-mail if you decide to give this a try and need some pointers!
Note: I am assuming Redmine can connect to remote repositories and it's just a matter of making it reachable. A quick Google implies that should be possible, but since I haven't done it myself yet I am not 100% sure.
Upvotes: 1