2012-04-30 87 views
1

我在我的專用網絡上的Debian服務器上運行Subversion(Apache2 + mod_dav)服務器。 我也有一個在互聯網上公開的服務器上運行的Redmine安裝。 這是不能改變的:Subversion服務器必須保持本地/私有,並且Redmine必須保持公開。公共Redmine訪問私有/本地Subversion服務器的可能解決方案?

我想使用Redmine的SVN功能(與提交鏈接問題),但我無法找到Redmine訪問SVN存儲庫(沒有NAT/PAT爲Subversion服務器)的方法。

我想了一個辦法,克隆整個顛覆(或者甚至是選擇的)資源庫,但它的確是個不錯的解決方案? 我想鏈接到Redmine的存儲庫需要大約800MB,並且Redmine服務器上有足夠的空間。

回答

0

您可以嘗試使用http://pagekite.net/將本地服務器直接暴露給公共Web。 (免責聲明:我創建了PageKite)

如果您深入瞭解選項,可以通過密碼或源IP限制訪問,所以它不一定是巨大的安全風險(不確定您是否擔心這一點或不)。如果您決定嘗試一下,並且需要一些指引,請隨時給我們發送電子郵件!

注:我假設Redmine可以連接到遠程存儲庫,它只是使其可訪問的問題。快速的谷歌意味着應該是可能的,但由於我自己沒有做到這一點,但我不是100%確定的。

0

我終於建立了一個「提交後」鉤子,執行存儲庫的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" "[email protected]$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目錄中。