問題描述
我聽說過部署應(yīng)用程序"這句話,聽起來比將單個(gè)更改的文件上傳到服務(wù)器要好/容易/可靠得多,但我不知道從哪里開始.
I've heard the phrase "deploying applications" which sounds much better/easier/more reliable than uploading individual changed files to a server, but I don't know where to begin.
我有一個(gè)受版本控制的 Zend Framework 應(yīng)用程序(在 Subversion 存儲(chǔ)庫中).我該如何部署"我的應(yīng)用程序?如果我有一個(gè)不想覆蓋的上傳"目錄,我該怎么辦?
I have a Zend Framework application that is under version control (in a Subversion repository). How do I go about "deploying" my application? What should I do if I have an "uploads" directory that I don't want to overwrite?
我通過第三方托管我的應(yīng)用程序,所以除了 FTP 之外我一無所知.如果其中任何一項(xiàng)涉及登錄我的服務(wù)器,請(qǐng)解釋該過程.
I host my application through a third party, so I don't know much other than FTP. If any of this involves logging into my server, please explain the process.
推薦答案
自動(dòng)部署 + 運(yùn)行測(cè)試到臨時(shí)服務(wù)器被稱為持續(xù)集成.這個(gè)想法是,如果您簽入破壞測(cè)試的內(nèi)容,您會(huì)立即收到通知.對(duì)于 PHP,您可能需要查看 Xinc 或 phpUnderControl
Automatic deploy + run of tests to a staging server is known as continuous integration. The idea is that if you check in something that breaks the tests, you would get notified right away. For PHP, you might want to look into Xinc or phpUnderControl
您通常不想要自動(dòng)部署到生產(chǎn)環(huán)境.正常的做法是編寫一些腳本來自動(dòng)執(zhí)行任務(wù),但您仍然需要手動(dòng)啟動(dòng).您可以為此使用諸如 Phing 之類的框架或其他構(gòu)建工具(一種流行的選擇是 Capistrano),但您也可以將幾個(gè) shell 腳本混合在一起.我個(gè)人更喜歡后者.
You'd generally not want to automatically deploy to production though. The normal thing to do is to write some scripts that automates the task, but that you still need to manually initiate. You can use frameworks such as Phing or other build-tools for this (A popular choice is Capistrano), but you can also just whisk a few shell-scripts together. Personally I prefer the latter.
腳本本身可以做不同的事情,這取決于您的應(yīng)用程序和設(shè)置,但一個(gè)典型的過程是:
The scripts themselves could do different things, depending on your application and setup, but a typical process would be:
- ssh 到生產(chǎn)服務(wù)器.其余命令通過 ssh 在生產(chǎn)服務(wù)器上運(yùn)行.
- 運(yùn)行
svn export svn://path/to/repository/tags/RELEASE_VERSION/usr/local/application/releases/TIMESTAMP
- 停止服務(wù)(Apache、守護(hù)進(jìn)程)
- run
unlink/usr/local/application/current &&ln -s/usr/local/application/releases/TIMESTAMP/usr/local/application/current
- 運(yùn)行
ln -s/usr/local/application/var/usr/local/application/releases/TIMESTAMP/var
- 運(yùn)行
/usr/local/application/current/scripts/migrate.php
- 啟動(dòng)服務(wù)
(假設(shè)您的應(yīng)用程序位于 /usr/local/application/current
)
(Assuming you have your application in /usr/local/application/current
)
這篇關(guān)于如何開始從 subversion 存儲(chǔ)庫部署 PHP 應(yīng)用程序?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!