Closed m13 closed 11 years ago
@m13 Have you tried importing the Node.js cookbook? We use: https://github.com/librato/nodejs-cookbook
I don't understand some concepts, but why do I have to configure nodejs with another cookbook if I have it already installed?
I think I should copy inside my cookbook folder a new folder called /nodejs/ with the content of nodejs-cookbook, right?
I can solve everything easier with a script like: (I have to use this because AWS sucks and doesn't use "npm install" and "npm start")
node[:deploy].each do |app_name, deploy|
script "dl" do
interpreter "bash"
user "root"
cwd "#{deploy[:deploy_to]}/current"
code <<-EOH
git clone https://github.com/etsy/statsd.git statsd;
cd statsd;
echo { graphitePort: 2003, graphiteHost: \"xxxxxx\", port: 8125, backends: [ \"./backends/graphite\" ] } > config.js;
cd ../;
node stats.js config.js& >> ../log/statsd.log
EOH
end
end
Referencing external cookbooks is not simply for install purposes. Oftentimes external cookbooks will provide helper methods that perform tasks like installing dependencies -- like NPMs.
Sounds like you've got a custom code block working for your scenario, so I'll close this issue for now. Thanks!
At the end, my script didn't work because it executed a background process and opswork was running eternally. I will research what I am missing and I will try to post the solution.
Just cloned the repo, removed the lines of "include_recipe" from the recipes, and changed the git line for an execute (cloning the repo). No dependencies :)
Have you tried the module with AWS? I always have the error:
Chef::Exceptions::CookbookNotFound - Cookbook nodejs not found
I just started to use Chef and I don't if I should reply all the recipe of nodejs inside my recipes... but the instance have already nodejs+git...
Thanks anyway!