views:

95

answers:

4

I work on Ubuntu developing a Rails app for my church. We use a hosted VPS also on Ubuntu. I use Capistrano to deploy periodic updates. Inevitably, however, an app that works on my local box, always has a handful of problems after deploying to the host, most likely because the environments differ.

What are some practices/techniques to ease deployment so that what is tested and works locally is just as likely to work on the host. (I have already adopted the "vendor everything" approach.)

My first thought is to develop/work within a local VPS image that itself will eventually be deployed (a virtual appliance of sorts). Is anyone doing this?

What do others do to minimize issues that result from environmental differences? What hosts provide the best deployment options?

A: 

As far as possible make sure you're running the exact same version of Ruby, the exact same version of Rails, the exact same database setup, and the exact same everything else. The more differences between your live setup and your development setup, the more problems you're likely to encounter.

Dominic Rodger
The heart of the issue related to version differences in Ruby and RubyGems. Unforunately, load paths played a part too. Ultimately, installing the lastest versions didn't help until the old ones could be removed.
Mario
+1  A: 

Try setting up an stage environment that would mimic the most you can your production one. I in fact use some of my servers as this, creating a subdomain (staged.mydomain.com) to test wheter the gems an on the right version and alike.

I also use a READ-ONLY user to test with live and real data on this stage installation.

This approach help us to be sure that the new deployment will work just fine, solving issues beforehand.

It would be nice to know what kind of issues you deal with frequently to try to find a way of lessening their appearance.

Yaraher
A: 

Well you actually answered your own question.

If you can't deploy on a staging environment on the production box you should try and mirror that exactly to your computer. You can then test it via programs as VMWare etc.

In my experience this is only needed in really critical situations. If your Ruby/Rails (gem versions you can specify in your environment) are the same you shouldn't be having any problems deploying a Rails app.

Indeed it would be nice to know what kind of issues you are encountering so we can hopefully provide you with a more adequate solution.

Bitterzoet
Do some hosts make it easy to grab a copy of the virtual machine? Likewise, would the same hosts make it easy to push a copy back? I'm guessing this might be a bad practice because of the downtime I might require.
Mario
A: 

Keep in mind that most Rails developers run OS X and deploy to a UNIX server and we never have any types of problems due to this.

Versions of raby, rails, mysql, etc.. should be the same of course.

allesklar