問題描述
情況是這樣的:我們有多個具有不同程度命令行經驗的開發人員,我們正在為我們的網站整合部署解決方案.生產環境是2臺SUSE Linux box.開發環境也是 SUSE Linux box.每個開發人員在他們的主目錄中都有/將有一個 SVN 樹的副本,用于開發和測試.
Here is the situation: we have multiple developers with varying degrees of commandline experience and we are putting together a deployment solution for our websites. The production environment is 2 SUSE Linux boxes. The development environment is a SUSE Linux box as well. Each developer has/will have a copy of the SVN tree in their home directory for development and testing.
目標是擁有一個易于使用且易于恢復的發布系統,可與多個生產服務器配合使用.如果非網絡開發人員(仍然是不在網絡世界中的編碼員)也可以輕松恢復任何網站,那將是一個獎勵.在理想情況下,發布就像在要發布的網站上運行單個命令一樣簡單.此命令將更新生產服務器并在其喚醒后留下恢復路徑.
The goal is to have a release system that is easy to use and easy to revert that will work with multiple production servers. It would be a bonus if a non-web developer (still a coder just not in the web world) could easily revert any of the websites as well. In an optimal world, release would be as simple as running a single command on the website that you want to release. This command would update the production servers and leave a revert path in it's wake.
我們目前的部署解決方案有點笨拙,很難恢復,而且慢得像泥巴.我們目前使用 SVN 檢入所有文件.然后運行一個腳本,該腳本基本上在 SVN 中創建一個標簽.然后運行第二個腳本,該腳本進入 2 個生產服務器中的每一個,并運行svn up".
Our current deployment solution is a bit clunky, quite difficult to revert and slow as dirt. We currently check in all files using SVN. Then a script is run that essentially creates a tag in SVN. A second script is then run that goes onto each of the 2 production servers and runs an 'svn up'.
有什么建議嗎?
推薦答案
Capistrano 是一個很好的解決方案.盡管最初是為 Ruby on Rails 平臺開發的,但我已經在許多 PHP 項目中成功地使用了它.它自動執行通過 SSH 執行的操作.部署是原子的,因為每個部署都被檢出到一個新目錄.
Capistrano is a great solution. Although originally developed for the Ruby on Rails platform, I've used it successfully on a number of PHP projects. It automates actions performed via SSH. Deployments are atomic because each deployment is checked out to a new directory.
當前副本是通過使用符號鏈接打開的.最新版本的源代碼來自 Subversion.您還可以設置靜態配置文件以在生產環境中使用.
The current copy is switched on by use of a symbolic link. The latest version of the source is pulled from Subversion. You can also set up static configuration files to use in the production environment.
Capistrano 還支持回滾,但如果您在部署之間進行數據庫更改,則必須小心.考慮使用類似 dbdeploy 或 rails migrations 來解決這個問題.
Capistrano also supports rollbacks, although you have to be careful here if you are making database changes between deployments. Consider using something like dbdeploy or rails migrations to solve this problem.
這篇關于SVN網站開發部署解決方案的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!