views:

400

answers:

6

I am aware of Capistrano but it is a bit too heavyweight for me. Personally I set up two Mercurial repositories, one on the production server and another on my local dev machine. Regularly, when a new feature is ready, I push changes from repository on my local machine to repository on the server, then update on the server. This is pretty simple and quick way to keep files in sync on several computers, but does not help to update database.

What is your solution to the problem?

+1  A: 

I used to use git push to publish to my web server but lately I've just been using rsync. I try to make my site as agnostic about where it's running as possible (using relative paths, etc) and so far it's worked pretty well. The only challenge is keeping databases in sync, and for that I usually use the production database as the master and make regular backups and imports into my testing database.

Kyle Cronin
I'm doing the same but lately it got me thinking that this is really not atomic. Not optimal for a website used constantly (people might access it at a broken stage where not all files have been rsynced yet).
Gilles
I'll add that a more optimal way of doing it is to rsync to a folder A while folder B contains your live website and then do the switch form A to B by overwriting a symlink that points to the current live version. And then next time, rsync to B.
Gilles
A: 

@Kyle - Could you expand on how you were using GIT? I've started using GIT but uploading to the dev server manually (well with scripts) - I wanted to try and extend my GIT use.

Thanks Andrew

Andrew Taylor
A: 

@Andrew

To use git push to deploy your site you will need to do first set up a remote server in your .git/config file to push to. Then you need to configure a hook that will basically perform a git reset --hard to copy the code you just copied to the repository to the working directory.

I know this is a little vague, but I actually deleted the server-side .git folder once I switched to rsync, so I don't have the exact scripts that I used to make the magic happen. That might be a good candidate for a full question though, so you might get more responses that way.

edit: I know it's been a while, but I eventually found what I was using again:

http://stackoverflow.com/questions/279169/deploy-php-using-git#327315

Kyle Cronin
A: 

I'm assuming you're speaking of Ruby on Rails.

Check out the HowTo wiki:

http://wiki.rubyonrails.com/rails/pages/Howtos#deployment

Steve Klabnik
A: 

Or Fabric, if you prefer Python.

More detail on fabric: http://stackoverflow.com/questions/1233655/what-is-the-simplest-way-to-ssh-using-python
hughdbrown
+1  A: 

what's heavyweight about capistrano? if you want to sync files then sure rsync is great. but if you're then going to need to do db updates maybe cap isn't so bad ?

matpalm