English 中文(简体)
passing :rails_env in capistrano to chef/cookbook/monit/mongrel.conf
原标题:

How do we pass the :rails_env vairable so that it recognizes what version we are into i.e. staging, production, demo

We are trying to get the :rails_env from the deploy.rb in capistrano to pass to cookbook and then to monit and then create a mongrel.conf file with different values for the environment (demo..production). In mongrel.erb, we can pick up this variable/parameter and set the RAILS_ENV=xxxx

in the command line, want to specify what deployment we are doing -- cap chef:bootstrap production

this "production" sets the :rails_env in deploy.rb

问题回答

Set the environment variable in your shell (command line) before running your scripts and let your scripts pick up it s value i.e.:

export RAILS_ENV=production

You can access the value of RAILS_ENV using $RAILS_ENV in your scripts. Here s an example of somebody doing something similar at Pivotal Labs:

http://pivotallabs.com/users/steve/blog/articles/1286-chef-solo-is-great-you-might-not-need-client-server-





相关问题
rails application on production not working

i have a rails application on production which is running using mongrel, I can successfully start the mogrel for the application but when i try to access the application on the URL it is not ...

Mongrel_rails can t find memcache-client

We started to use memcache-client in our rails app and it works just fine with "script/server" but "mongrel_rails start" fails with an error. In environment.rb we define "memcache-client" and ...

Tell Merb not to timeout

after posting a question related to nginx, I m a bit further with my investigations: The problem is, that the merb framework timeouts after about 30 seconds. If i tell the underlying nginx-server not ...

Issue with mulitple Ruby-on-Rails projects

I created a Ruby-on-Rails project using NetBean 6.8, which operates as expected on port 3000. I created a second RoR project in the NetBeans IDE to experiment with some ideas; it operates on port ...

Display all active record queries

in my test mongrel server output for a page, 8 queries are listed but many more DB are counted: Query1 Query2 ... Query8 Rendered Partial1 Rendered Partial2 .. Rendered Partial40 Completed in 4754ms (...

Ruby Interpreter crashes with a certain word

Ok, this one s a little ridiculous, and I m almost afraid no one will believe me. But here it goes: I have written a Ruby Rails application that handles content for tons of domains. Now I know this ...

热门标签