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

Documentation for using JSON node configuration #355

Closed
oliverbrooks opened this issue Aug 10, 2015 · 3 comments
Closed

Documentation for using JSON node configuration #355

oliverbrooks opened this issue Aug 10, 2015 · 3 comments

Comments

@oliverbrooks
Copy link

Intend to provision elasticsearch through chef/vagrant using json configuration.

config.vm.provision :chef_solo do |chef|
  chef.add_recipe "elasticsearch"
  chef.json = {
    elasticsearch: {
      configuration: {
        "key" => "value"
      }
    }
  }
end

Nothing I enter into the chef.json.elasticsearch is respected as per other libraries. Sure I'm missing a simple trick somewhere but can't see anything in the docs or code to point me in the right direction.

Any tips on solving and documentation would be very much appreciated.

@martinb3 martinb3 self-assigned this Aug 10, 2015
@martinb3
Copy link
Contributor

I think you're probably running into this change in the configuration attribute.

One of the simplifications we made was to support all-string keys for the configuration. @oliverbrooks @schorsch Can you do pp node['elasticsearch'] and show us the output? I'm wondering if you maybe have symbols instead of strings.

I apologize for taking so long to get back to you. I've been out of the office :)

@schorsch
Copy link

I run:
sudo chef-solo -c my-solo-config.rb
which uses a config file like:

{
  // ...
  "java" : {
    "install_flavor" : "oracle",
    "jdk_version" : "8",
    "ark_timeout" : 1800, 
    "oracle": {
        "accept_oracle_download_terms": true
      }
  },
  "elasticsearch": {
      "cluster.name" : "es_reimbursement_live",
      "bootstrap.mlockall" : false,
      "allocated_memory" : "400m",
      "network.host" : "127.0.0.1"
  },
   //...
    "recipe[java]",
    "recipe[elasticsearch]"
   ]
}

I am not too much into the recent chef changes nor the use of poise, I just wonder how to pass those config values. I also tried to nest under the ES key:

{
  "elasticsearch": {
     "configuration": {  // default_configuration
      "cluster.name" : "es_reimbursement_live",
      "bootstrap.mlockall" : false,
      "allocated_memory" : "400m",
      "network.host" : "127.0.0.1"
    }
  }
}

but nothing happens.

Do i have to manually create the 'reader' for those settings-values and pass it into the new elasticsearch_configure block? e.g. in cookbooks/my-app/recipes/default.rb

elasticsearch_configure 'my_elasticsearch' do
   configuration(node[:elasticsearch])
  # vs.
  # default_configuration(node[:elasticsearch])
  # vs. 
  # configuration ({
   # 'node.name' => node[:elasticsearch]['node.name']
  #})
  action :manage  #??
end

Sorry if i missed something concerning chef changes or this poise thingy (already took me 3 days to update my recipes from 2012). If this is the case maybe you point to some resources.

@martinb3 martinb3 added this to the 1.0.x bugfix release milestone Sep 14, 2015
@martinb3 martinb3 removed their assignment Sep 14, 2015
@martinb3
Copy link
Contributor

Hi @oliverbrooks / @schorsch -- it looks like maybe you're on one of the older versions of this cookbook? The new version has been re-written as a library cookbook. Most of the attributes you're setting being used by the library calls; you'd want to do something like this in your downstream recipe:

elasticsearch_configure 'my_elasticsearch' do
   configuration(node[:elasticsearch])
end

(as you surmised.)

I hope this helps. We're going to remove the poise dependency, so that should also help. Please re-open or ping if you need further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants