Development and production running simultaneously?


#1

I’d like to be able to run both development and production as follows:

www.mysite.com will be running production
dev.mysite.com will be running development

It should run the same code base. The server is RedHat Enterprise 3,
Apache, FastCgi.

My problem is I don’t know where to set the environment so the
application bootstraps depending on the virtual host (www/dev).

I’d really appreciate if someone can point me in the right direction.

Thanks,
Serge


#2

This seems like a bad idea to me. Isn’t the development code always
going to have a newer code base than production? Ideally you want to
keep your development and production environments totally separate in
order to avoid accidentally putting development level code into
production.

It’s easy enough to maintain two separate sets of the config files, one
for development and one for production, and use the correct ones for the
environment you’re deploying to.

Ken


#3

I don’t understand how you can run production and development
simultanously.
Are you developing at a datacenter right in front of your production box
?
Or are you hosting at your office and have a big pipe coming in ?


#4

My problem is I don’t know where to set the environment so the
application bootstraps depending on the virtual host (www/dev).

This is definitely the hard way to make it work. Check out another copy
of your app into another folder (like …/mysite/dev) and set up a
virtual host in Apache. If for some reason you really want to use the
same code in two places, you could check out the common parts into one
directory, then make symlinks to those directories in “fake” rails
folders, having individual config files.