Code Monkey home page Code Monkey logo

Comments (10)

karmi avatar karmi commented on May 16, 2024

Hi, Chef attribute behaviour is notoriously tricky, if memory serves well. The Chef 11 changelog hints at some bugfixes. Are you 100% sure that you're setting the attribute in environment properly? Can you test this with Chef 11?

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

OK, spent couple of hours hunting this. Notes:

  • There were fatal errors regarding setting attributes on Chef 11, which are now fixed (see attached commit)
  • I was able to successfully and consistently upgrade/downgrade Elasticsearch in Chef Server and Chef Solo

With Chef Solo, the game is all the same: change configurations in Vagrant file or data bag, run vagrant provision

With Chef Server (hosted at Opscode), this are the steps I took:

First, upload all the cookbooks to Chef Server:

berks upload

Create a new virtual machine in Vagrant:

bundle exec vagrant up precise64 --no-provision

Create a knife.rb configuration file for Chef (use bundle exec vagrant ssh-config precise64 on Vagrant),
specifying correct Chef API endpoint, SSH users, ports, identity files, etc.

Then, bootstrap the machine via Chef:

knife bootstrap 127.0.0.1 --run-list 'role[elasticsearch-vagrant]' --config ./tmp/knife-vagrant.rb --sudo

Now, the important part, to change the version with

a) environment,
b) node attributes

To change the version with environment, simply create it with Chef web console or knife,
and set overrides attribute to a different version. Run Chef on the machine:

sudo chef-client

I believe this will work the same with roles.

To change the version by editing node attributes, edit it with:

knife node edit precise64 --config ./tmp/knife-vagrant.rb

and run chef.

In all cases, the correct version is downloaded, symlinked, and Elasticsearch itself is restarted.

Verify this workflow on your end, please, and get back to me.

from elasticsearch.

jakelandis avatar jakelandis commented on May 16, 2024

I was able to verify the latest code + chef 11 (client) resolves this issue.

Using the latest code revision (ac4bb01) , Chef Server 10.? , and changing the version of chef on the client node.

Chef: 10.24.0 (incorrectly downloads and installs the default version in the specified version directory)

New install of 0.20.2 (version set via environment) notice the jar version in the lib directory:

   [2013-02-27T09:58:52-06:00] INFO: *** version: 0.20.5
   [2013-02-27T09:58:52-06:00] INFO: *** download_url: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz

  ls -l /usr/local/elasticsearch
  /usr/local/elasticsearch -> /usr/local/elasticsearch-0.20.2
 ls  /usr/local/elasticsearch-0.20.2/lib
 elasticsearch-0.20.5.jar  ....

Update to 0.20.3 (version set via environment) notice the jar version in the lib directory:

 [2013-02-27T10:03:02-06:00] INFO: *** version: 0.20.5
 [2013-02-27T10:03:02-06:00] INFO: *** download_url: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz

 ls -l /usr/local/elasticsearch
 /usr/local/elasticsearch -> /usr/local/elasticsearch-0.20.3
 ls /usr/local/elasticsearch-0.20.3/lib
 elasticsearch-0.20.5.jar  .....
Chef: 11.4.0 (downloads and installs the correct version)

New install of 0.20.2 (version set via environment):

      [2013-02-27T09:48:08-06:00] INFO: *** version: 0.20.2
      [2013-02-27T09:48:08-06:00] INFO: *** download_url: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz

Update to 0.20.3 (version set via environment):

      [2013-02-27T09:51:24-06:00] INFO: *** version: 0.20.3
      [2013-02-27T09:51:24-06:00] INFO: *** download_url: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.3.tar.gz

Note:
I added the following lines to attributes/default.rb for debugging:
Chef::Log.info "* version: #{node.elasticsearch[:version]}"
Chef::Log.info "
* download_url: " + default.elasticsearch[:download_url]

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

So, on Chef 10.24.0 it still downloads the incorrect version? Trying it with Chef Server now.

Note: The ark cookbook should print a line with the download URL.

from elasticsearch.

jakelandis avatar jakelandis commented on May 16, 2024

Hmm... trying to repeat the test above, but specifying the version via the elasticsearch/settings data bag. It appears in both 10.x and 11.x then version is now being ignored:

[2013-02-27T11:08:41-06:00] INFO: Loaded settings: data_bag_item["elasticsearch", "settings", {"id"=>"settings", "version"=>"0.20.2"}]
[2013-02-27T11:08:41-06:00] INFO: *** version: 0.20.5
[2013-02-27T11:08:41-06:00] INFO: *** download_url: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz

Should i log a separate issue?

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

I'll try also the data_bag way with Chef Solo and Vagrant, still debugging Chef 10.22.0

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

Added a guard against overwriting the version by using the normal precedence, should be working now either with Chef Solo or Chef Server.

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

@jakelandis Could you verify the current master, please?

from elasticsearch.

jakelandis avatar jakelandis commented on May 16, 2024

Testing against 2.0.4 tag, with chef server (10.x)

Chef: 11.4.0

  • Install version 0.20.2
    • version configured via databag - GOOD
    • version configured via environment - GOOD
  • Update to version 0.20.3
    • version configured via databag - GOOD
    • version configured via environment - GOOD

Chef: 10.24.0

  • Install version 0.20.2
    • version configured via databag - GOOD
    • version configured via environment - BAD [2]
  • Update to version 0.20.3
    • version configured via databag - BAD [1]
    • version configured via environment - BAD [3]

[1] It is downloading the prior version ... but there are stale values in the node (it would work if you delete and re-add back the node, or delete the node settings prior to running chef-client)
ls elasticsearch-0.20.3/lib/
elasticsearch-0.20.2.jar
From chef server node JSON:
{"version":"0.20.3","host":"http://download.elasticsearch.org","repository":"elasticsearch/elasticsearch","filename":"elasticsearch-0.20.2.tar.gz","download_url":"http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz",.....

[2] It is downloading the default version in the specified version's path
ls elasticsearch-0.20.2/lib
elasticsearch-0.20.5.jar

[3] It is downloading the default version in the specified version's path
ls elasticsearch-0.20.3/lib
elasticsearch-0.20.5.jar

from elasticsearch.

karmi avatar karmi commented on May 16, 2024

Thanks for all this testing! I think what we're hitting here is this issue, where the node attributes are indeed β€œstale”. I think it's fair to advice using Chef 11 if anybody needs to configure the version attribute from role/environment...

from elasticsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.