1

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

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

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

4

2 回答 2

1

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

如果您深入研究这些选项,则可以通过密码或源 IP 限制访问,因此不一定会带来巨大的安全风险(不确定您是否担心)。如果您决定尝试一下并需要一些指导,请随时向我们发送电子邮件!

注意:我假设 Redmine 可以连接到远程存储库,这只是使其可访问的问题。快速谷歌暗示这应该是可能的,但由于我自己还没有做过,所以我不能 100% 确定。

于 2012-05-01T20:37:42.483 回答
0

我终于设置了一个“提交后”钩子,对存储库进行 rsync。

/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

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

于 2012-07-26T10:31:25.147 回答