chef

Managing application configuration in a chef environment cookbook

拟墨画扇 提交于 2019-12-06 09:35:51
I am new to chef and have been struggling to find best practices on how to configure application configuration in an environment cookbook [source #1]. The environment cookbook I'm working on should do the following: Prepare the node for a custom application deployment by creating directories, users, etc. that are specific for this deployment only. Add initialization and monitoring scripts specific for the application deployment. Define the application configuration settings. This last responsibility has been a particularly tough nut to crack. An example configuration file of an application

Chef workflow for new cookbooks

穿精又带淫゛_ 提交于 2019-12-06 08:37:04
问题 While building my own cookbooks I find myself constantly within this cycle: Change cookbook on my local computer Upload modified cookbook to chef server Run chef-client on remote machine Repeat Since I am new to chef, I repeat that cycle extremely often, but I find rather cumbersome uploading and downloading so frequently from the chef server. How experienced chef users ease this cycle? I learnt Chef with the free hosted solution, but I am not sure if I should be better off using just Chef

git error while deploying through chef

狂风中的少年 提交于 2019-12-06 07:17:59
i am trying to deploy rails app through chef code. recipe contains code deploy_revision "testapp" do repo "REPO_URL" ssh_wrapper "/home/ubuntu/.ssh/chef_ssh_deploy_wrapper.sh" environment({ "RAILS_ENV" => "staging" }) deploy_to "/home/ubuntu/testapp" branch "master" user "ubuntu" group "ubuntu" scm_provider Chef::Provider::Git end and sshwrapper file contains exec ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no github.com -i "/home/ubuntu/.ssh/id_rsa" "$@" when i ran bootstrap im getting error as follows STDERR: Warning: Permanently added 'github.com,192.30.252.129' (RSA) to

Notify service defined in included LWRP recipe

≯℡__Kan透↙ 提交于 2019-12-06 06:10:07
问题 Is there a way to notify a service to restart which is defined by an included LWRP? I wrote an LWRP called "sidekiq" which sets up a service, like this, and appears to be working fine on its own. service "#{new_resource.name}_sidekiq" do provider Chef::Provider::Service::Upstart action [ :enable ] subscribes :restart, "template[/etc/init/#{new_resource.name}_sidekiq.conf]", :immediately end The problem is I am using it another recipe which I use for deployments, and need it to notify the

How do I check if Chef's version mets a gem requirement from inside a recipe?

蹲街弑〆低调 提交于 2019-12-06 05:12:01
问题 Chef::Version contains the version number of the Chef gem, and I want to check that it meets the gem requirement of ~> 10.14 inside a recipe. 回答1: Alternatively, you can use Chef’s built-in version comparison mechanisms (available since at least Chef 12): Chef::VersionConstraint.new('>= 14.0.0').include? Chef::VERSION 回答2: Use Gem::Requirement and Gem::Version : Gem::Requirement.new("~> 10.14").satisfied_by?(Gem::Version.new(Chef::VERSION)) This returns a boolean value - true if Chef::VERSION

Chef client hanging on npm install at node-gyp rebuild

浪尽此生 提交于 2019-12-06 03:47:04
问题 I'm having a problem with running npm install from a chef recipe. When I run it from the command line, it finishes fine in under a minute with just a few warnings related to package.json no repository field (which should be harmless). But when I run it from chef, it hangs with the last line output back to the command line as this: * execute[npm-install-app] action run Which is this resource block in the recipe: execute "npm-install-app" do cwd "#{home}/#{prefix}#{app}" command "npm --registry

Installing a gem after native extension packages during chef execution

孤者浪人 提交于 2019-12-06 03:44:04
问题 I am trying to install the fog gem in a chef recipe though the gem installation occurs before the native packages are being installed so the gem installation fails package "libxslt-dev" package "libxml2-dev" chef_gem "fog" This is the output [Thu, 14 Mar 2013 13:04:30 +0000] INFO: Processing chef_gem[fog] action install (ebs4000::update_volumes line 23) [Thu, 14 Mar 2013 13:04:52 +0000] ERROR: Running exception handlers [Thu, 14 Mar 2013 13:04:52 +0000] FATAL: Saving node information to /var

Vagrant to test chef recipies - but how to deal with private git

一个人想着一个人 提交于 2019-12-06 03:06:55
I use vagrant to test my chef recipes. The issue is that I have clone my private repo and the machine is not auteticated. How can i automated git authentication to boostrap chef? I am using the vagrant ubuntu 11.10 with chef. Thanks EnabrenTane use ssh keys with passphrase on a vagrant+chef setup will have similar answers that might be helpful. Without knowing more details of chef-solo, or chef-client + chef-server. It comes down to ssh keys. Make sure you are authing with something like git@github.com:user/repo.git Then you will want to ensure that your VM and underlying host is ssh agent

How to change chef nginx default http port 80?

放肆的年华 提交于 2019-12-06 02:36:36
问题 I tried to install apache on a machine that chef-server was installed. Apache could not start up due to the occupation of port 80 by chef nginx. If I want to let apache use port 80 as default, is it possible to change chef nginx default http port to another one? I found a solution on the Internet to set virtual host on both apache and nginx, but they need a different FQDN as server name. My machine uses an IP instead of FQDN, so I need to change the default HTTP port for chef nginx. I tried

Should we really use chef to manage the sudoers file?

蹲街弑〆低调 提交于 2019-12-06 02:32:50
This is my question. I am worried that if Chef breaks something in the sudoers file, probably by a Chef user using the cookbook incorrectly, then the server will be entirely inaccessible. I would hate for us to completely lose a production server for a customer because we messed up the sudoers file and can no longer ssh into the box. Chef has a feature to help with this, verifiers. You can set up the verifies on your sudoer template like this: template '/etc/sudoers' do source 'whatever.erb verify 'visudo -c -f %{path}' end If visudo rejects the syntax, the tempfile will never get put in place