Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Add plugin provider #115

Closed
wants to merge 4 commits into from
Closed

Add plugin provider #115

wants to merge 4 commits into from

Conversation

davidski
Copy link
Contributor

Add kibana_plugin provider, adapted from lusis/chef-logstash. Addresses #110

@martinb3
Copy link
Collaborator

Hi @davidski -- I'd love to see the test fixture cookbook install a plugin and then have a serverspec test to verify that the plugin was successfully installed. We probably also want to add the implementation method for the :remove action, even if we don't implement it (emit a log saying so?). Thank you for the first pass!!

@msaffitz
Copy link

Thanks for this PR. We're testing it our on one of our nodes and seeing a failure on a rerun:

Plugin marvel already exists, please remove before installing a new version


    ================================================================================
    Error executing action `run` on resource 'execute[bin/kibana plugin --install elasticsearch/marvel/latest]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '70'
    ---- Begin output of bin/kibana plugin --install elasticsearch/marvel/latest ----
    STDOUT: Installing marvel
    STDERR: Plugin marvel already exists, please remove before installing a new version
    ---- End output of bin/kibana plugin --install elasticsearch/marvel/latest ----
    Ran bin/kibana plugin --install elasticsearch/marvel/latest returned 70

    Resource Declaration:
    ---------------------
    # In /var/cache/chef/cookbooks/kibana_lwrp/libraries/plugins.rb

     37:         ex = execute "bin/kibana plugin --install #{kb_args[:name]}" do
     38:           command "bin/kibana plugin --install #{kb_args[:name]}"
     39:           user    kb_args[:user]
     40:           group   kb_args[:group]
     41:           cwd     "#{kb_args[:install_dir]}/kibana-#{kb_args[:base_directory]}"
     42:           notifies :restart, 'service[kibana]'
     43:           timeout 600
     44:           # this is a temp workaround to make the plugin command idempotent.
     45:           not_if { ::File.exist?("#kb_args[:install_dir]}/#{kb_args[:install_check]}") }
     46:         end
     47:         new_resource.updated_by_last_action(ex.updated_by_last_action?)

    Compiled Resource:
    ------------------
    # Declared in /var/cache/chef/cookbooks/kibana_lwrp/libraries/plugins.rb:37:in `block in <class:KibanaPlugin>'

    execute("bin/kibana plugin --install elasticsearch/marvel/latest") do
      action [:run]
      retries 0
      retry_delay 2
      default_guard_interpreter :execute
      command "bin/kibana plugin --install elasticsearch/marvel/latest"
      backup 5
      cwd "/opt/kibana/kibana-4.2.1-linux-x64"
      returns 0
      timeout 600
      user "kibana"
      declared_type :execute
      cookbook_name "apptentive-event-service"
      not_if { #code block }
    end

@davidski
Copy link
Contributor Author

Thanks, @martinb3 and @msaffitz! I'll take a crack at the idempotency and testing items tonight.

@catalinvr
Copy link

Hello @martinb3, do you have any ideea when this commit will be merget into master? Thank you.

@davidski
Copy link
Contributor Author

Sorry, @catalinvr. The delay has been on my end as I've been pulled away on other projects. :(

@msaffitz - The failure on repeated runs is due to lack of a good mechanism to query what plugins are installed for a proper guard. The Logstash cookbook, where this pattern was lifted, hacks around it in a rather awkward way. I'm a bit stumped on how to robustly fix this with the current state of the kibana plugin command.

@martinb3 - I've updated this PR with a simple warn action for removals (removals of plugins take a different format than installs, which is why full removal support doesn't exist). The test fixture cookbook now installs the timelion plugin. I'm not sure of the best way to test this as there isn't a nice url you can hit directly to confirm install. I support I could hack in support to look for the files getting dropped, but seems...well...hackish. :) Any advice on how to proceed? Oh, I also updated the chefignore file to ignore the .kitchen directory, which is necessary to get test-kitchen happy on Windows platforms.

@@ -2,6 +2,12 @@
include_recipe 'elasticsearch::default'
include_recipe 'kibana_lwrp::install'

# sample plugin installation
kibana_plugin 'kibana/timelion' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should just be 'timelion' since that is the plugin name and directory name, right?

kibana_plugin 'timelion' do
  url 'kibana/timelion'
  action :install
end

If we had a resource with the actual plugin name, we might be able to better finagle an uninstall action using that name and looking for a directory by the same name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidski -- any thoughts on having the resource name be the plugin name?

@catalinvr
Copy link

Hello guys,
@martinb3 , when do you think that this commit will be merged into master?
Thanks

@martinb3
Copy link
Collaborator

@catalinvr I'd still like to review #115 (comment) more thoroughly. I think the resource name should be the plugin name, vs. 'repo/name'.

@catalinvr
Copy link

catalinvr commented May 10, 2016

That's a good idea. In this case will be like in the elasticsearch cookbook. Also, a good probability is that when you install Kibana, to install Elasticsearch.

@eedwardsdisco
Copy link

Just wanted to +1, I'd love to use this for standing up a monitoring cluster for ES 2.x
(ES Cookbook + Kibana 4 Cookbook + Marvel Plugin)

@bradenwright
Copy link

Any word on the status?

@eedwardsdisco
Copy link

@martinb3 any chance this can get merged soon?

@martinb3
Copy link
Collaborator

Hi @davidski -- any thoughts about my comment here? Also, what do you think about not doing the 'tarball' style? I feel like someone can just use the ark resource at that point (we're not really adding value if we're just calling ark for someone and passing everything through).

@eedwardsdisco
Copy link

is this project dead?

@martinb3
Copy link
Collaborator

@eedwardsdisco No, there's only a single PR outstanding and there's questions waiting to be answered on it.

@eedwardsdisco
Copy link

@martinb3 @davidski

Any progress on this? It's been 3 months without any traction.

@gsaslis
Copy link

gsaslis commented Sep 11, 2016

just a +1 here on needing this feature.

@martinb3 martinb3 self-assigned this Sep 13, 2016
@martinb3
Copy link
Collaborator

I haven't heard anything follow ups from @davidski so I'll go ahead and finish this up myself when I get a chance. If anyone else is interested in contributing commits, don't let me stop you :) 👍

@martinb3 martinb3 assigned martinb3 and unassigned martinb3 Sep 13, 2016
@bradenwright
Copy link

@martinb3 appreciate the follow up and the work, thanks!

@eedwardsdisco
Copy link

any progress on this would be monumental, thanks @martinb3

@davidski
Copy link
Contributor Author

Egads. This PR totally dropped off my radar. I'm not using this cookbook at the moment, but if this is still a valid feature, I'd be happy to take a stab and addressing @martinb3 comments and requests. A 👍 or 👎 on whether this is still needed would be appreciated.

@martinb3
Copy link
Collaborator

@davidski I'm in the same boat. Let's see if we get any 👍 or 👎 .

@eedwardsdisco
Copy link

eedwardsdisco commented Feb 27, 2017 via email

Copy link
Collaborator

@martinb3 martinb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as "request changes" so we remember that it needs more work before merging. I still haven't had a real good chance to tackle this :/

@chrisferry
Copy link

👍

@martinb3 martinb3 removed their assignment Dec 20, 2018
@davidski davidski closed this Apr 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants