我为我的简单自定义配方创建了一个 GitHub 存储库:
my-cookbook/
|- recipes/
|- appsetup.rb
我已将存储库添加到自定义厨师食谱中https://github.com/my-github-user/my-github-repo.git
我已添加my-cookbook::appsetup
到设置“周期”。
我知道它已被执行,因为如果我弄乱了语法,它将无法加载。
这是我的 appsetup.rb:
node[:deploy].each do |app_name, deploy|
script "install_composer" do
interpreter "bash"
user "root"
cwd "#{deploy[:deploy_to]}/current"
code "curl -sS https://getcomposer.org/installer | php && php composer.phar install --no-dev"
end
end
当我使用 ubuntu 用户通过 SSH 登录到实例时,没有安装 composer。
我也尝试了以下无济于事(安装nodejs):
node[:deploy].each do |app_name, deploy|
execute "installing node" do
command "add-apt-repository --yes ppa:chris-lea/node.js && apt-get update && sudo apt-get install python-software-properties python g++ make nodejs"
end
end
没有安装节点,并且日志中没有错误。日志中对食谱的唯一引用只是说:
[2014-03-31T13:26:04+00:00] INFO: OpsWorks Custom Run List: ["opsworks_initial_setup", "ssh_host_keys", "ssh_users", "mysql::client", "dependencies", "ebs", "opsworks_ganglia::client", "opsworks_stack_state_sync", "mod_php5_apache2", "my-cookbook::appsetup", "deploy::default", "deploy::php", "test_suite", "opsworks_cleanup"]
...
2014-03-31T13:26:04+00:00] INFO: New Run List expands to ["opsworks_initial_setup", "ssh_host_keys", "ssh_users", "mysql::client", "dependencies", "ebs", "opsworks_ganglia::client", "opsworks_stack_state_sync", "mod_php5_apache2", "my-cookbook::appsetup", "deploy::default", "deploy::php", "test_suite", "opsworks_cleanup"]
...
[2014-03-31T13:26:05+00:00] DEBUG: Loading Recipe my-cookbook::appsetup via include_recipe
[2014-03-31T13:26:05+00:00] DEBUG: Found recipe appsetup in cookbook my-cookbook
我在某处错过了一些关键步骤吗?配方被清楚地识别和加载,但似乎没有被执行。
(以下为虚构名称:my-github-user、my-github-repo、my-cookbook)