問題描述
在我的公司,我們有 8 位 Web 開發人員,負責我們的商業網站(完全用 PHP 編寫,但這無關緊要).小組中的每個人都同時從事不同的項目,每當他們完成任務時,他們就會立即部署它(因為現在業務發展很快).
At my company we have a group of 8 web developers for our business web site (entirely written in PHP, but that shouldn't matter). Everyone in the group is working on different projects at the same time and whenever they're done with their task, they immediately deploy it (cause business is moving fast these days).
目前,開發工作在一個共享服務器上進行,所有開發人員都在同一個代碼庫上工作(使用 RCS 將文件與其他人鎖定").當部署到期時,更改的文件被復制到暫存"服務器,然后同步腳本將文件上傳到我們的主網絡服務器,然后從那里分發到其他 9 個服務器.
Currently the development happens on one shared server with all developers working on the same code base (using RCS to "lock" files away from others). When deployment is due, the changed files are copied over to a "staging" server and then a sync script uploads the files to our main webserver from where it is distributed over to the other 9 servers.
很高興,web 開發團隊向我們尋求幫助以改進流程(在我們抱怨了一段時間之后),現在我們設置他們的開發環境的想法如下:
Quite happily, the web dev team asked us for help in order to improve the process (after us complaining for a while) and now our idea for setting up their dev environment is as follows:
- 具有虛擬目錄的開發服務器,因此每個人都有自己的代碼庫,
- 用于跟蹤更改的 SVN(或任何其他 VCS)
- 用于測試保持最新簽入代碼的中央服務器
現在的問題是:我們如何設法將更改的文件部署到服務器上,而不會意外上傳其他項目的錯誤?我的第一個想法是簡單地從存儲庫中導出最新版本,但這并不能完全控制文件.
The question is now: How do we manage to deploy the changed files on to the server without accidentaly uploading bugs from other projects? My first idea was to simply export the latest revision from the repository, but that would not give full control over the files.
你是如何處理這種情況的?你有什么樣的部署腳本?
How do you manage such a situation? What kind of deployment scripts do you have in action?
(作為一個特殊的挑戰:網站在過去 10 年里有機地增長,所以項目沒有分成小塊,而是一個特定功能的文件分布在整個目錄樹中.)
(As a special challenge: the website has organically grown over the last 10 years, so the projects are not split up in small chunks, but files for one specific feature are spread all over the directory tree.)
推薦答案
Cassy - 顯然,要使源代碼管理完全有序,您還有很長的路要走,但聽起來您已經在路上了!
Cassy - you obviously have a long way to go before you'll get your source code management entirely in order, but it sounds like you are on your way!
擁有單獨的沙箱肯定會有所幫助.接下來,請確保該網站始終只是從 Subversion 中對特定修訂版、標簽或分支的干凈檢出.
Having individual sandboxes will definitely help on things. Next then make sure that the website is ALWAYS just a clean checkout of a particular revision, tag or branch from subversion.
我們使用 git,但我們有類似的設置.我們用版本號標記特定版本(在 git 中,我們還可以向標記添加描述;適用于發布說明!)然后我們有一個腳本,任何有權訪問發布"的人都可以運行該腳本需要兩個參數 -- 將要更新的系統(數據中心,如果我們要更新測試或生產服務器),然后是版本號(標簽).
We use git, but we have a similar setup. We tag a particular version with a version number (in git we also get to add a description to the tag; good for release notes!) and then we have a script that anyone with access to "do a release" can run that takes two parameters -- which system is going to be updated (the datacenter and if we're updating the test or the production server) and then the version number (the tag).
腳本使用 sudo 然后在共享帳戶中運行發布腳本.它檢查相關版本,最小化 javascript 和 CSS1,將代碼推送到相關服務器以供環境,然后重新啟動需要重新啟動的內容.發布腳本的最后一行連接到其中一個網絡服務器并跟蹤錯誤日志.
The script uses sudo to then run the release script in a shared account. It does a checkout of the relevant version, minimizes javascript and CSS1, pushes the code to the relevant servers for the environment and then restarts what needs to be restarted. The last line of the release script connects to one of the webservers and tails the error log.
在 我們的 網站 我們在每個頁面的底部包含了一個帶有當前服務器名稱和版本的 html 注釋 - 可以很容易地看到現在正在運行什么?"
On our websites we include an html comment at the bottom of each page with the current server name and the version -- makes it easy to see "What's running right now?"
1 和一堆其他類似的家務任務......
1 and a bunch of other housekeeping tasks like that...
這篇關于您如何將網站部署到您的網絡服務器?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!