RAILS_ENV

639 views
Skip to first unread message

ahab

unread,
Oct 12, 2007, 7:34:27 PM10/12/07
to Capistrano
Any suggestion about how to have Capistrano effectively set RAIlS_ENV?

Doing this has no effect -
set :rails_env, "qa"

I'm on a shared host and have uncommented -
ENV['RAILS_ENV'] ||= 'production'

I tried commenting out ENV['RAILS_ENV'] ||= 'production' in
environment.rb - with the hopes that cap would pick it up, but no
luck.

Heres my deploy.rb
--------------------------
set :stages, %w(qa staging production)
set :default_stage, 'qa'
require 'capistrano/ext/multistage'

set :repository, "http://svn.my_website.com/website/trunk"
set :user, "my_user"
set :use_sudo, false
set :deploy_via, :export
set (:deploy_to){"/home/my_application/#{application}"}
# set :scm, :subversion

role :app, "my_application.com"
role :web, "my_application.com"
role :db, "my_application.com", :primary => true

task :after_update_code, :roles => :app do
run "cd #{release_path}/public"
run "rm -rf #{release_path}/public/uploads"
run "ln -sf /home/my_application/#{application}/shared/uploads
#{release_path}/public/uploads"
end

namespace :deploy do
task :restart, :roles => :web do
# restart your web server here

run "cd #{release_path}/public"
run "chmod -R 775 #{release_path}/public"
run "killall -usr1 dispatch.fcgi"
end
end


and config/deploy/qa.rb
--------------------------------
set :application, 'my_application'
set :rails_env, "qa"


All help is greatly appreciated!

Jamis Buck

unread,
Oct 13, 2007, 10:19:34 AM10/13/07
to capis...@googlegroups.com
The :rails_env environment is only for setting the environment to use
when running migrations. To change the environment to use when
running your app, you'll need to change your script/spin script to
set that variable before firing off your listeners. If you're not
using script/spin, then you'll need to change whatever mechanism you
are using to start your listeners so that the RAILS_ENV variable is set.

- Jamis

> --~--~---------~--~----~------------~-------~--~----~
> To unsubscribe from this group, send email to capistrano-
> unsub...@googlegroups.com
> For more options, visit this group at http://groups.google.com/
> group/capistrano
> -~----------~----~----~----~------~----~------~--~---
>

Reply all
Reply to author
Forward
0 new messages