How to get started deploying PHP applications from a subversion repository?

后端 未结 8 1190
孤城傲影
孤城傲影 2020-12-23 12:06

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

8条回答
  •  难免孤独
    2020-12-23 12:59

    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

    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.

    The scripts themselves could do different things, depending on your application and setup, but a typical process would be:

    • ssh to production server. The rest of the commands are run at the production server, through ssh.
    • run svn export svn://path/to/repository/tags/RELEASE_VERSION /usr/local/application/releases/TIMESTAMP
    • stop services (Apache, daemons)
    • run unlink /usr/local/application/current && ln -s /usr/local/application/releases/TIMESTAMP /usr/local/application/current
    • run ln -s /usr/local/application/var /usr/local/application/releases/TIMESTAMP/var
    • run /usr/local/application/current/scripts/migrate.php
    • start services

    (Assuming you have your application in /usr/local/application/current)

提交回复
热议问题