将 capistrano 中的 :rails_env 传递给 Chef/cookbook/monit/mongrel.conf
我们如何传递 :rails_env 变量,以便它识别我们所处的版本,即 staging、生产、演示
我们正在尝试从 capistrano 中的 deploy.rb 获取 :rails_env 以传递给 Cookbook,然后进行监视,然后创建一个mongrel.conf 文件具有不同的环境值(演示..生产)。在 mongrel.erb 中,我们可以选取这个变量/参数并
在命令行中设置 RAILS_ENV=xxxx,想要指定我们正在执行的部署 -- cap Chef:bootstrap production
这个“生产”在部署中设置 :rails_env。 RB
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在运行脚本之前在 shell(命令行)中设置环境变量,并让脚本获取它的值,即:
您可以在脚本中使用 $RAILS_ENV 访问 RAILS_ENV 的值。以下是有人在 Pivotal Labs 做类似事情的示例:
http://pivotallabs.com/users/steve/blog/articles/1286-chef-solo-is-great-you-might-not-need-client-server-
Set the environment variable in your shell (command line) before running your scripts and let your scripts pick up it's value i.e.:
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-