公共Redmine访问私有/本地subversion服务器的可能解决方案?

时间:2012-04-30 00:37:31

标签: svn repository redmine

我在我的专用网络上的Debian服务器上运行了一个Subversion(Apache2 + mod_dav)服务器。 我还在Internet公共服务器上运行Redmine安装。 这是无法更改的:Subversion服务器必须保持本地/私有,Redmine必须保持公开。

我想使用Redmine的SVN功能(链接提交问题),但我找不到Redmine访问SVN存储库的方法(没有NAT / PAT-ing用于subversion服务器)。

我在想一种克隆镜像整个Subversion(甚至是一个选择)存储库的方法,但它真的是一个很好的解决方案吗? 我想链接到Redmine的存储库大约需要800MB,Redmine服务器上有足够的空间。

2 个答案:

答案 0 :(得分:0)

您可以尝试使用http://pagekite.net/直接将本地服务器公开给公共网站。 (免责声明:我创建了PageKite)

如果您深入了解选项,可以通过密码或源IP限制访问,因此不一定存在巨大的安全风险(不确定您是否担心这一点)。如果您决定试一试并需要一些指示,请随时给我们发送电子邮件!

注意:我假设Redmine可以连接到远程存储库,这只是让它可以访问的问题。一个快速的谷歌暗示应该是可能的,但由于我自己没有这样做,但我不是百分百肯定。

答案 1 :(得分:0)

我最终设置了一个“post-commit”挂钩,用于执行存储库的rsync。

的/ var / SVN / myproject的/钩/提交后

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的/钩/提交后

#!/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

当有人在SVN存储库上提交时,rsync程序会将$ remoteHost上的修改推送到$ remoteRepositoryBasePath目录。