PHP SVN: What's the best way to deploy svn tag to production?
What's the best way to deploy an SVN tag to production? SVN switch or SVN Checkout? Using SVN switch will add .svn files that may consume large storage space but it is convenient and easier to use.
Using SVN Checkout will remove the .开发者_如何学运维svn files and just symlink it to the newly checkout folder.
What are the pros and cons between SVN switch and SVN checkout deployment to production? Which is easier and practical to use? For me the "SVN Checkout" way.
Thanks.
Option 1: USING SVN SWITCH - SSH to production server then do SVN SWITCH like this:
$ cd /var/www/html/sites/mydomain.com/
$ svn switch https://svn.svndomain.com/repos/mydomain.com/site/tags/4.11.0-qa1
// Reload Apache
$ /etc/init.d/httpd reload
OR
Option 2: USING SVN EXPORT - SSH to production server then do SVN export to a new folder with version and symlink it like this:
// Export Site
$ svn export https://svn.svndomain.com/repos/mydomain.com/site/tags/4.11.0 /var/www/html/sites/mydomain.com_4.11.0
$ cd /var/www/html/sites/;
$ unlink mydomain.com;
$ ln -s mydomain.com_4.11.0 mydomain.com;
// Reload Apache
$ /etc/init.d/httpd reload
Use svn checkout to a new, empty directory, to make sure you don't have any non-committed file. Then use svn export to a new empty directory (or remove all the .svn directories manually). Then replace the old contents of the web-served directory with the new files, or use a symlink. .svn directories shouldn't be accessible from the outside.
My web apps usually need some build process before being deployed. This build process replaces the svn export phase.
精彩评论