So we are using Git here at debuggable now. It takes all the pain out of deployment:

ssh <server>
cd /var/www/<project>
git pull

Done.

Not easy enough? Create a deploy.sh file:

ssh <server> "cd /var/www/<project> && git pull"

And once you get super lazy you'll find yourself doing:

git pull && git push && ./deploy.sh

Don't forget to get setup with ssh keys so, entering passwords all the time is a major PITA.

If you are just starting out with all this web craziness and still depend on ftp & shared hosting, try to get a VPS somewhere. I can recommend LiquidWeb (~$60 month). If there is anything I wish I had done 3 years earlier, it is to get a server with root access - it is so worth it.

Patrick: slicehost which was recommended by Falk looks solid and is a lot cheaper then liquid web. However, I can only personally recommend liquid web since we use them for a bunch of stuff, including hosting this blog (on one of their VPS machines).

hbl said
on Oct 19, 2008:

Same deployoment procedure is possible with every other modern VCS, i. e. with Subversion, so no reason for hyping git ;)

Our deployment strategy for web apps: Staging from development environment to production is done via a Makefile action which does some configuration tasks for the production environment and all the cleanup stuff (emptying cache, etc.)

All deployment actions (and some more) are defined in a Makefile (google for 'GNU make'), so we simply do a 'make app', 'make complete', 'make dev2prod', 'make clear_cache', 'make show_error_log', 'make count_lines_of_code', or 'make generate_api_docs' ... you got it :)

In Makefiles you can define dependent actions, so a 'make dev2prod' requires a 'make disable_debug' before and does a 'make clear_cache' after, and so on ... Nice, isn't it?

@felix, could your deploy.sh script also run the schema update task, then delete all the model cache files too? How do you get it to work with different owners, are your app files owned by a particular user and your tmp files owned by apache?

hbl: I'm not hyping git. But if you have the option to use git and use SVN instead I might have to say a few not so nice things about svn ... I will look into makefile's so, just never needed them so far for something like deployment.

thomas sittig said
on Oct 19, 2008:

@patrick
for us germans, i recommend teh vps services on hosteurope. they are starting by 13€/month

to the topic
deployment is not only to put some files to a location. it is a little bit more if someone will use it in a professional way. like complex builds. run automatic tests. and so on.
that's why i'm stick with a common svn-vcs in combination with a good build- and deployment-system like capistrano oder continuum.

Does git pull into a temporary directory first (.git) and then move the new contents in the real directory all at once, or does it update file by file? (like svn). Avoiding inconsistent code states is maybe not needed for small sites, but definitely needed for bigger sites.

Also, what happens when the new code brings along a database schema update? This is especially fun on bigger websites where alter table queries can take hours :-)

Dieter_be: It does a 'git fetch' first which downloads all new objects (blobs, commits, trees) into the .git/objects database. Then it merges the origin/master into the local master branch. Since you normally won't have local commits on your server, the merge will be a fast forward and essentially just a very quick file replace operation without anything being in an inconsistent state for longer then a ms (if that).

For a site that is still under development I sometimes just have a script that dumps my local db, scp's it up the staging server and then overwrites the old db ; ). For bigger sites you'll have to keep track of all local db changes (we use a trac ticket + comments) and then run them on the server. If your queries take hours and would slow your site down, you'll need a master / slave setup and could keep the slaves responsive during the update. But sometimes you might need to announce some downtime ...

So far, I am still using fredistrano for all my web developments (intranet + dreamhost). For those who never heard about it, its a web application that automates the deployment process from a subversion repository to your production server (quite similar to webistrano).

* doesn't care what version control system you use as it supports all the biggies
* doesn't care what type of app you are deploying
* allows you to not only deploy, but roll back
* very scriptable with their deployment scripts with an incredibly minimal investment in Ruby

Johnny said
on Oct 22, 2008:

I would recommend Media Temple - mediatemple.net. I have used their services for over 6 years including the (DV)dedicated virtual and the (GS)grid server with zero issues. When I need something, they are on top of it very quickly. I really can't say enough good things about them.

Regarding Git or SVN, I haven't used Git but within the hour I saw a discussion of Git on Slashdot: