Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP-FPM recipe #253

Merged
merged 1 commit into from Apr 15, 2016

Conversation

Projects
None yet
2 participants
@jridgewell
Copy link
Contributor

commented Nov 4, 2015

No description provided.

@miketheman

This comment has been minimized.

Copy link
Collaborator

commented Nov 5, 2015

Hi @jridgewell !

Thanks for taking the time to submit this - we appreciate it! I don't know if you've been following, we've been trying to simplify the template structure to a more open-ended one, where the attribute configuration drives the content of file.
See https://github.com/DataDog/chef-datadog/blob/master/templates/default/jmx.yaml.erb for an example.

This allows the template to be as flexible as the data you put into it, so the cookbook doesn't need an update whenever a flag changes.

Does that make sense?

@jridgewell jridgewell force-pushed the Skillshare:php-fpm branch from b3c3322 to 718e6ea Nov 5, 2015

@jridgewell

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2015

Updated.

This allows the template to be as flexible as the data you put into it, so the cookbook doesn't need an update whenever a flag changes.

With these being so generic, why use multiple template files? You could do something like

# template.yaml.erb
<%= JSON.parse(({ 'instances' => @instances, 'init_config' => @init_config }).to_json).to_yaml %>
action :add do
  Chef::Log.debug "Adding monitoring for #{new_resource.name}"
  template new_resource.name do
    source  'template.yaml'
    path ::File.join(node['datadog']['config_dir'], 'conf.d', "#{new_resource.name}.yaml")
    if node['platform_family'] == 'windows'
      owner 'Administrators'
      rights :full_control, 'Administrators'
      inherits false
    else
      owner 'dd-agent'
      mode 00600
    end
    variables(
      :init_config => new_resource.init_config,
      :instances   => new_resource.instances
    )
    cookbook new_resource.cookbook
    notifies :restart, 'service[datadog-agent]', :delayed if node['datadog']['agent_start']
  end

  service 'datadog-agent' do
    service_name node['datadog']['agent_name']
  end
end
@miketheman

This comment has been minimized.

Copy link
Collaborator

commented Nov 5, 2015

@jridgewell Thanks! Yes, that one direction we're considering going with the templates, especially as more and more get ported to this format.

There's still many that have a semi-rigid init_config, so that's something we'd have to tackle in the Agent, or here.

@miketheman miketheman added the feature label Nov 5, 2015

@miketheman miketheman added this to the Next minor milestone Nov 5, 2015

@miketheman miketheman merged commit 8d67a3e into DataDog:master Apr 15, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.