Avoiding RAILS_ENV

How do I avoid adding:
export RAILS_ENV=‘production’

How do I avoid setting my environment globally as production?

I have two sites on the same server:

/www/stage.example.com
/www/test.excample.com

Both apps are using the same database after deployment, I’d like them
not to be shared.


Anthony E.
408-656-2473
http://anthony.ettinger.name

Well, assuming that you don’t have the database.yml in your SCM (which
you shouldn’t)… you should be able to just set the production db to
the different database for each one.

Robby

On Fri, Jun 27, 2008 at 11:11 AM, Anthony E. [email protected]
wrote:


Robby R.
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting

http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

If you are like me, using capistrano,

  1. add those lines below to deploy.rb:

task “stage.example.com” do
set :target, current_task.name
end

task “test.example.com” do
set :target, current_task.name
end

task :replace_configs do
run “(cd #{release_path}; cp config/deploy/#{target}/database.yml
config)”
end
before “deploy:finalize_update”, :replace_configs

  1. place database.yml for each target

config/deploy/stage.example.com/database.yml
and
config/deploy/test.example.com/database.yml

  1. then, you can deploy each target

$ cap stage.example.com deploy
or
$ cap test.example.com deploy

A recipe “Run Multi-Stage Deployments” in the book “Advanced Rails
Recipes” describes such one
http://pragprog.com/titles/fr_arr/advanced-rails-recipes

Your production/staging servers should have a database.yml file that
you symlink to during the deploy process.
Robby

On Fri, Jun 27, 2008 at 5:20 PM, Anthony E. [email protected]
wrote:

the different database for each one.

I have two sites on the same server:
408-656-2473


Robby R.
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting

http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

I currently do push the database.yml file, how should I do it without
having that file on the server?

On Fri, Jun 27, 2008 at 2:17 PM, Robby R. [email protected]
wrote:

export RAILS_ENV=‘production’

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]


Anthony E.
408-656-2473
http://anthony.ettinger.name