简体   繁体   English

Linux Dev上的Subversion存储库

[英]Subversion Repository on Linux Dev

What's the best practice for setting up a subversion repository on a linux development machine. 在linux开发机器上设置subversion存储库的最佳实践是什么? External users need to be able to access a specific repository, but nothing else on the machine. 外部用户需要能够访问特定的存储库,但机器上没有其他任何东西。 I know one answer is to set up a dedicated repository, but I'm looking for a single machine solution: location of repositories, accounts, backup procedures. 我知道一个答案是建立一个专用的存储库,但我正在寻找一个单一的机器解决方案:存储库,帐户,备份程序的位置。

One of the popular access methods to Subversion is via Apache module. Subversion的一种流行访问方法是通过Apache模块。 You can set put different rights at the directory level to control access. 您可以在目录级别设置不同的权限来控制访问。 See Choosing a Server Configuration and httpd, the Apache HTTP Server . 请参阅选择服务器配置httpd,Apache HTTP Server For authentication, I recommend using external authentication source like Microsoft AD via mod_auth_sspi . 对于身份验证,我建议通过mod_auth_sspi使用Microsoft AD之类的外部身份验证源。

If you need to mix and match rights, see my answer for How can I make only some folders show up for certain developers with SVN . 如果您需要混合和匹配权限,请参阅我的答案如何只为某些SVN开发人员显示一些文件夹

I work for an IT operations infrastructure automation company; 我在IT运营基础设施自动化公司工作; we do this all the time. 我们一直这样做。

Location of repository: We use "/srv/svn" by default to store all SVN repositories, unless a customer has a specific requirement, for example an existing repository might be stored on a ReadyNAS shared filesystem. 存储库的位置:默认情况下,我们使用“/ srv / svn”存储所有SVN存储库,除非客户有特定要求,例如现有存储库可能存储在ReadyNAS共享文件系统中。

Accounts: All our customers use LDAP. 帐户:我们所有的客户都使用LDAP。 Either OpenLDAP server running on a master host, but sometimes Active Directory because some customers have a Windows domain in their office, which we can configure as well. OpenLDAP服务器在主主机上运行,​​但有时是Active Directory,因为有些客户在他们的办公室中有一个Windows域,我们也可以配置它。 Developers get access to the "SCM" group (usually svn, git or devel), and the 'deploy' group. 开发人员可以访问“SCM”组(通常是svn,git或devel)和“部署”组。 These groups only have permissions to log in and perform SCM related activities (ie, write commits to the repo based on group ownership), or do application deployments to production. 这些组仅具有登录和执行SCM相关活动的权限(即,基于组所有权写入对repo的提交),或者将应用程序部署到生产中。

Backup procedures: We use svnadmin hotcopy unless the customer already has something in place (usually svnadmin dump, heh). 备份程序:我们使用svnadmin hotcopy,除非客户已经有了某些东西(通常是svnadmin dump,呵呵)。

svnadmin hotcopy /srv/svn /srv/svn_backups/$(date +%Y%m%d)

For access to the repo, it's usually simple svn+ssh. 要访问repo,它通常是简单的svn + ssh。 Some customers already have an Apache setup, but not many. 一些客户已经有Apache设置,但并不多。 I recommend SSH. 我推荐SSH。 Developers push their public ssh keys out and all is well. 开发人员推出他们的公共ssh密钥,一切都很顺利。 There's little to no maintenance with LDAP user management (the only way to go). LDAP用户管理几乎没有维护( 唯一的方法)。

I'd recommend looking at the chapter on server configuration in the subversion book . 我建议在subversion书中查看有关服务器配置章节 It makes suggestions about which configuration is more appropriate for your use. 它建议哪种配置更适合您的使用。

For what it's worth, setting up a repository using the stand alone svn daemon is very straight forward. 对于它的价值,使用独立的svn守护进程设置存储库非常简单。 The annoying thing is managing user rights. 令人讨厌的是管理用户权限。

I have a blog posting that describes the steps necessary to set up and initiate a Linux-based Subversion server in order to maintain code repositories etc. 我有一篇博客文章描述了设置和启动基于Linux的Subversion服务器以维护代码存储库等所需的步骤。

Basically the steps are: 基本上步骤是:

  1. Download the Subversion tarball. 下载 Subversion tarball。
  2. Unzip and install Subversion. 解压缩并安装Subversion。
  3. Deal with any installation problems that arise when running ./configure , if any. 处理运行./configure时出现的任何安装问题(如果有)。
  4. Create the Subversion repository using svnadmin create . 使用svnadmin create创建Subversion存储库。
  5. Edit the repository configuration file using your text editor of choice. 使用您选择的文本编辑器编辑存储库配置文件。
  6. Ditto the password file. 同上密码文件。
  7. Import your code, projects etc into the repository using svn import . 使用svn import将代码,项目等导入存储库。
  8. Start the server as a daemon eg svnserve -d . 作为守护进程启动服务器,例如svnserve -d It is also possible to get it to do this automatically upon reboot. 重启后也可以自动执行此操作。
  9. Start using it using standard Subversion commands to eg check out, check in, backup etc... 使用标准Subversion命令开始使用它,例如签出,签入,备份等...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM