問題描述
我正在開始一個 PHP 新項目,我很想從其他開發(fā)人員那里獲得一些關(guān)于他們首選的 PHP 部署策略的反饋.我很想將事情自動化一點(diǎn),這樣一旦提交更改,它們就可以快速遷移到開發(fā)或生產(chǎn)服務(wù)器.
I'm beginning a new project in PHP and I'd love to get some feedback from other developers on their preferred strategy for PHP deployment. I'd love to automate things a bit so that once changes are committed they can be quickly migrated to a development or production server.
我有使用 Capistrano 和 Ruby 以及一些基本的 shell 腳本進(jìn)行部署的經(jīng)驗.
I have experience with deployments using Capistrano with Ruby as well as some basic shell scripting.
在我自己開始潛水之前,很高興聽到其他人如何在他們的項目中解決這個問題.
Before I dive head first on my own it would be great to hear how others have approached this in their projects.
目前,開發(fā)人員在站點(diǎn)的本地安裝上工作,并將更改提交到 subversion 存儲庫.初始部署是通過從 svn 導(dǎo)出標(biāo)記版本并將其上傳到服務(wù)器來進(jìn)行的.
Currently developers work on local installations of the site and commit changes to a subversion repository. Initial deployments are made by exporting a tagged release from svn and uploading that to the server.
額外的更改通常是通過手動上傳更改的文件來逐步完成的.
Additional changes are typically made piecemeal by manually uploading changed files.
推薦答案
對于 PHP、SVN 和 Phing 構(gòu)建腳本是要走的路.Phing 類似于 ANT 但是是用 PHP 編寫的,這使得 PHP 開發(fā)人員可以更輕松地修改需要.
For PHP, SVN with Phing build scripts are the way to go. Phing is similar to ANT but is written in PHP, which makes it much easier for PHP developers to modify for their needs.
我們的部署流程如下:
- 每個人在工作時都在同一臺本地服務(wù)器上進(jìn)行開發(fā),每個開發(fā)人員在他家里的機(jī)器上也有一個結(jié)賬.
- 提交會觸發(fā)一個提交后掛鉤,用于更新臨時服務(wù)器.
- 測試在臨時服務(wù)器上運(yùn)行,如果通過 - 繼續(xù).
- Phing 構(gòu)建腳本已運(yùn)行:
- 關(guān)閉生產(chǎn)服務(wù)器,將域切換到正在建設(shè)中"頁面
- 在生產(chǎn)結(jié)帳時運(yùn)行 SVN 更新
- 運(yùn)行架構(gòu)增量腳本
- 運(yùn)行測試
- 如果測試失敗 - 運(yùn)行回滾腳本
- 如果測試通過,服務(wù)器將返回生產(chǎn)結(jié)帳
還有 phpUnderControl,這是一個持續(xù)集成服務(wù)器.老實說,我沒有發(fā)現(xiàn)它對網(wǎng)絡(luò)項目很有用.
There's also phpUnderControl, which is a Continuous Integration server. I didn't find it very useful for web projects to be honest.
這篇關(guān)于您首選的 php 部署策略是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!