Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to release web applications?

Tags:

svn

release

I don't really know how to perform deployment from offline development to live webserver correctly in web development. I mostly resort on intuition, but this is more or less what I did until now: I have a web application in python, or php, and I am hosting it on a live webserver. I use an offline development version whose source is under svn.

Now, as I develop the offline version, I will perform commits to the svn. When time has come for release, I could either:

  1. copy the code from the offline server to a temporary directory on the live webserver, then swap the old codebase with the new one (eg. with a link), or...
  2. have the live webserver work on a checkout svn, and just run svn update.

I normally do the second, although if I have to upgrade the database before the live deployment, I normally write upgrade sql scripts, and run them first on the live database, then checkout.

What are the best practices for this task ?

like image 860
Stefano Borini Avatar asked Aug 11 '09 18:08

Stefano Borini


1 Answers

I recommend leveraging SVN export instead of checkout. This way, you will not expose any of the SVN files to the world. It also generally creates a cleaner folder structure.

I have leveraged rsync before when moving files between stage and production.

My typical deployment proceeds as follows:

  • backup production site
  • Restore from backup to stage server
  • Lock the server down from all external IP addresses
  • Export the code from the repository into a temp folder (optionally diff the two folders for small changes)
  • rsyc files from the temp folder to the stage server folder
  • Validate that only the files you expect to have changed have actually changed.
  • Apply SQL scripts to the DB
  • Test the upgrade
  • Unlock the webserver

Now, to deploy to production, replay these steps in fast forward. Using scripts make it much easier.

like image 116
TheJacobTaylor Avatar answered Sep 20 '22 18:09

TheJacobTaylor