使用 Subversion 并推送到 Staging,然后推送到 Live Sever
我们希望向我们的开发管道添加临时服务器和版本控制。我们的网站是一个复杂的 Web 应用程序,运行在带有 PHP、MySQL 和 Apache 的远程 Linux 服务器上。我们刚刚在办公室 LAN 上设置了 Subversion,并让它在 Dreamweaver CS5 中运行。我们的开发机器运行 Windows。
问题是如何最好地向此设置添加临时服务器。我们是一个小团队,只有 3 名开发人员,因此我们不需要过于强大/复杂的解决方案。我不明白的是如何将更改从我们的 Subversion 存储库(位于开发人员的一台机器上)推送到临时服务器或实时服务器。
我读到了很多关于人们为此编写钩子的文章,但这是否意味着我们需要在登台服务器和实时服务器上安装 Subversion?我不想这样做。
当开发人员将文件提交到 Subversion 时,我希望将文件自动上传到临时服务器。如何做到这一点?
然后我需要一个自动流程来将文件从临时服务器上传到实时服务器。这是我实在不明白的部分。特别是因为我不想在 Live 上安装 Subversion。这通常是如何完成的?
临时服务器中的所有文件是否都已推送到实时服务器?或者有没有办法只推送自上次推送以来更改的文件?
我希望使用 Windows XAMPP 来设置临时服务器,但我们的 Live 服务器是 Linux,并且我们的一些站点代码具有 Linux 特定的文件路径,这似乎无法在 Windows 中运行。通常如何解决这个问题?是创建新的 Linux Staging 服务器的唯一解决方案吗?如果可能的话,我宁愿避免这种情况。
在我们的网站上,用户可以上传图像,这些图像存储在网站根目录之外的单独文件夹中。 Windows XAMPP 可以与这样的设置一起使用吗?我们现在最大的挑战是确保相同的代码可以在 Linux/Windows 上运行。有哪些需要注意的事项?这在理论上可能吗?
谢谢你!
We want to add a staging server and version control to our development pipeline. Our site is a complex web application running on a remote Linux server with PHP, MySQL, and Apache. We just set up Subversion on the office LAN and got it working in Dreamweaver CS5. Our development machines run Windows.
The question is how to best add a staging server to this set up. We're a small team, 3 developers, so we don't need an overly-robust/complex solution. What I don't understand is how to push changes from our Subversion repo (which is located on one of the developer's machines) to a staging server or the live server.
I read a lot about people writing hooks for this, but does that mean we need to install Subversion on the staging server and the live server? I'd rather not do this.
I want to upload files automatically to the Staging server as developers commit them to Subversion. How can this be done?
Then I need an automated process for uploading files from the Staging server to the Live server. This is the part I really don't understand. Especially because I don't want to have Subversion installed on Live. How is this typically done?
Are ALL the files from the Staging server pushed to Live? Or is there a way to only push the ones that changed since the previous push?
I was hoping to use Windows XAMPP to set up the Staging server, but our Live server is Linux, and some of our site code has Linux-specific file paths, which seem like they won't work in Windows. How is this problem typically addressed? Is the only solution to create a new Linux Staging server? I'd rather avoid that if possible.
On our site, users can upload images, which are stored in a separate folder outside the site root. Can Windows XAMPP work with such as set up? Our biggest challenge right now is making sure the same code works on Linux/Windows. What are some things to watch out for? Is this even possible in theory?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不需要。挂钩可以在您的版本控制服务器上运行。挂钩应该能够将构建推送到登台服务器。
Hooks 可以提供这些功能,但为什么不将其与版本控制分开。
自动上传意味着无法控制何时推送构建。在开发的大部分时间里,中间构建都会被破坏。我建议您在工作流程中包含像 BuildBot 这样的“持续集成工具”。这将完成报告损坏的构建和构建运行状况的当前状态的工作。如果您愿意,您始终可以使用此机制将良好的构建自动上传到临时服务器。
暂存用于在完整的实时环境中测试构建,这很难在您的 QA 环境中复制。因此,如果发现有错误,暂存上的构建可能不会被推送到实时环境。
XAMPP 可以在 Windows 上运行。在谷歌上查一下。不过,您的暂存环境和实时环境应该完全相同,因为这就是暂存环境的用途。
理论上,它应该有效。您必须测试您的特定功能。
Not required. The hooks can run on your version control server. The hooks should be capable of pushing the build to staging server.
Hooks can provide these capabilities but why not separate it from version control.
Automatic uploads means no control over when to push a build. Most of the time in development, intermediary builds are broken. I would suggest that you include a "continuos integration tool" like BuildBot in your workflow. This will do the job of reporting broken builds and current status of your build health. If you want, you could always use this mechanism to upload good builds to staging server automatically.
Staging is used to test the build in a complete live environment which is difficult to replicate in your QA environment. So a build on staging may not be pushed to live environment, if it is found to be buggy.
XAMPP does work on windows. Check it out on google. Although, your staging and live environment should be completely same because that is what staging environment is meant for.
In theory, it should work. You will have to test your specific functionality.
对于问题 1 和 2,您在 Subversion 存储库上使用提交后挂钩(不需要位于 Web 服务器上),这会将最新版本复制到登台服务器。
Re 3),这是一个坏主意,您不应该自动部署到生产环境。如果您这样做,错误的提交可能会导致您的网站瘫痪。
4、5和6确实是不同的问题,应该分开问。
For questions 1 and 2, you use a post-commit hook on your subversion repository (does not need to be on web servers), that will copy the latest version to your staging server.
Re 3), this is a bad idea, you should not automate deploys to production. A bad commit could bring down your site if you do this.
4, 5, and 6 are really different questions and should be asked separately.