我做过一些研究,但却找不到令人满意的东西。我们正在使用厨师11。
这就是我现在所拥有的。仅供参考:我对厨师非常不熟悉。所以我有一种直觉,认为我做错了。
execute "Update apt-get" do
command 'curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -'
end
package 'nodejs' do
action :upgrade
end
大部分时间都有效。但它有时会失败。
Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
This issue on ubuntu似乎是罪魁祸首。
问题是,有没有比运行此curl
命令更新apt-get
更好的方法,以便我可以安装更高版本的node.js?
答案 0 :(得分:1)
我使用以下食谱使用厨师管理一些Node.js应用程序:application,application_git,application_javascript
配方如下:
include_recipe 'chef-vault'
# provisions system user to run application
user node['project']['application']['user'] do
system true
shell '/bin/false'
manage_home true
end
application node['project']['application']['deploy_path'] do
# Provision specific Node.js version
javascript '4.2.4'
owner node['project']['application']['user']
group node['project']['application']['user']
# Download application source from git private repository
git node['project']['application']['repository'] do
deploy_key chef_vault_item('project', 'deploy_key')['file-content']
end
# install dependencies
npm_install do
production false
user node['project']['application']['user']
group node['project']['application']['user']
end
# Provision service
javascript_service 'server.js'
end
我的食谱中的 project
是已部署的特定项目的名称。
这个食谱有一些优点: