是否可以路由到多个 Subversion 存储库而不需要单独的虚拟主机?

发布于 2024-10-17 01:09:50 字数 1003 浏览 1 评论 0原文

我只是想知道这是否可能,如果可以,有人可以引导我走向正确的方向吗?

基本上这就是我当前的 Linux 机器正在做的事情:

<VirtualHost *:443>
    ServerName co.svnr.net
    ServerAdmin [email protected]
    ServerAlias co

    <Location /shauny/test>
        DAV svn
        SVNPath /home/svn/public/shauny/test
        AuthName "Test repository"
    </Location>

    #a million other Locations later....

    SSLEngine on
    SSLCertificateFile /home/certs/svnr/server.crt
    SSLCertificateKeyFile /home/certs/svnr/server.key
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
</VirtualHost>

这很棒并且有效,但对于 50 多个 svn 存储库来说这是不可行的。理想的解决方案是指向 PHP5 中的处理程序(虽然托管在 Linux 机器上),它接受超全局 $_GET 中的用户名/存储库,然后将它们重定向到存储库(如果存在,否则重定向到 404)。

但是...这可能吗?
PHP5 可以读取 Subversion 存储库和身份验证吗?

在我看来,让 PHP5 处理它们会更可行,因为我可以根据使用情况等生成一些日志...

非常感谢大家,如果您不清楚任何事情,请告诉我。

I'm just wondering if it's possible, and if so could someone lead me into the right direction please?

Basically here's what my current Linux box is doing:

<VirtualHost *:443>
    ServerName co.svnr.net
    ServerAdmin [email protected]
    ServerAlias co

    <Location /shauny/test>
        DAV svn
        SVNPath /home/svn/public/shauny/test
        AuthName "Test repository"
    </Location>

    #a million other Locations later....

    SSLEngine on
    SSLCertificateFile /home/certs/svnr/server.crt
    SSLCertificateKeyFile /home/certs/svnr/server.key
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
</VirtualHost>

This is great and working, but it's just not feasible for say 50+ svn repositories. The ideal solution would to to point at say a Handler in PHP5 (whilst hosted on Linux machine) which accepts the username/repository in the superglobal $_GET and then redirects them to the repository (if it exists, otherwise redirect to 404).

But... is that even possible?
Can PHP5 read Subversion repositories and authentication?

Having PHP5 handle them would be more feasible in my opinion as I can generate some logs based on usage etc...

Much thanks guys, if you're unclear on anything let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫﹏色ふ单纯 2024-10-24 01:09:50

我们在我们的开发盒上进行了这种设置(诚然,只有 3 个存储库),我们只需将 Location 指令设置为指向 subversion 根目录并使用 SVNParentPath:

<Location /shauny>
        DAV svn
        SVNParentPath /home/svn/public/shauny
        AuthName "Test repository"
</Location>

We had this sort of set up on our dev box (admittedly with only 3 repos) and we just set the Location directive to point to the subversion root and used SVNParentPath:

<Location /shauny>
        DAV svn
        SVNParentPath /home/svn/public/shauny
        AuthName "Test repository"
</Location>
南街九尾狐 2024-10-24 01:09:50

是的,这是可能的。

查看 SVNParentPath。这可能就是您所寻求的。不知道它与您的虚拟主机设置的配合效果如何,并且您可能必须移动目录(如果它们不共享父级),但这可能是朝着正确方向迈出的一步。

当您需要不同的基于位置的设置时,唯一的问题就会出现,例如您使用不同的身份验证名称对每个存储库进行身份验证。在这种情况下,最好保持配置不变。

至于通过PHP接口包装SVN模块来随意添加PHP代码。虽然它在理论上应该有效,但在实践中我会避免它。通过在提交、读取等操作中添加前/后挂钩,可以在每个存储库的基础上完成任何类型的 SVN 日志记录。通过添加 Apache 指令可以更好地处理全局“每个存储库”日志记录。

Yes, it is possible.

Look into SVNParentPath. It probably is what you seek. Don't know how well it will play with your virtual host setup, and you might have to move directories around (if they don't share a parent) but it's probably a step in the right direction.

The only issues come in when you need different Location based settings, like if you were authenticating each repo with a different Auth Name. In that case, it might be better to leave the config untouched.

As far as wrapping the SVN module through a PHP interface to add PHP code willy-nilly. While it should work in theory, I'd avoid it in practice. SVN logging of any kind can be done on a per-repository basis by adding in pre/post hooks in the commit, read, etc. operations. Global "every repo" logging can be better handled by adding Apache directives.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文