LoginSignup
1
1

More than 5 years have passed since last update.

dns.jsonを参照する from Deploy Hook や Custom Chef Recipe

Posted at

概要

Engine Yard Cloudでは、インフラをカスタマイズするCustom Chefと、deployプロセスにフックを入れるDeploy Hookという仕組みがある。
そのなかで、インフラ設定の値を参照したいときに、nodeという変数を使うことができる

参照の仕方

Custom Chef

各レシピの中で、node変数から参照できます。

node[:engineyard]

Deploy Hook

Ruby コードで、config.nodeいかにアクセスできます。

config.node[:engineyard]

ElasticSearchのUtility Instanceに対して処理をする

if node[:name].match(/elasticsearch/i)
  # ... do things here ...
end

PHPのWeb Rootを取得する

repo = "git://github.com/engineyard/howto.git" # plz replace your own

app_info = node[:engineyard][:environment][:apps].select{|app| app.values.include? repo}.first
web_root = app_info[:components].select{|comp| comp.keys.include? "php_webroot"}.first['php_webroot']

参考

https://blog.engineyard.com/2014/engine-yards-chef-node-object
https://support.cloud.engineyard.com/entries/22329616-デプロイフックの利用?locale=67
https://support.cloud.engineyard.com/entries/30566833-Chef-Recipe%E3%81%AE%E3%83%87%E3%83%90%E3%83%83%E3%82%AF?locale=67

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1