views:

53

answers:

2
+3  Q: 

Deploying Web Apps

We use SVN. Is it a good idea to do an "svn up" on production server? If so, how do we do roll back? What is considered best practice for deploying web apps (our application is in PHP).

Boss wants to use FTP.

+1  A: 

If your app is not super enormous, then svn update or ftp to a new directory. When it's finished, rename the old directory and rename the new directory.

Or, simply have a symbolic link, and change it to the new directory.

If you have to roll back, change it back, if not, delete the old copy when you update again.

If you have a huge app, you can do the same thing, but have two copies, and use RSYNC to copy to the new tree.

Will Hartung
A: 

Update a test server form the repository, tag it, and package the application tree on the test server. Once it passes testing, deploy the package on the production server. Tar is a reasonable packaging tool.

Unpackaging on the production server into a new directory and then swapping directories works well. You should reload the server as part of the swap. Rollback is just requires reversing the directory swap.

Database changes are more difficult. I try to make sure changes are compatible with the current and previous release. Some changes need to be completed on a subsequent release (new NOT NULL constraints, dropped columns, etc.) Database content changes are more difficult.

Environment specific data needs to be part of the webserver configuration, not the application configuration. Some of the data can be stored in the database if the environments have different databases.

BillThor