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

Init script can't start #390

Closed
spuder opened this issue Nov 20, 2015 · 8 comments
Closed

Init script can't start #390

spuder opened this issue Nov 20, 2015 · 8 comments
Labels
Bug Something isn't working
Milestone

Comments

@spuder
Copy link
Contributor

spuder commented Nov 20, 2015

The init script provided in the cookbook appears to be different than the one in the repo.
Adding this to the cookbook causes elasticsearch to not start

elasticsearch_service 'elasticsearch' do
  #instance_name 'foobar'
  service_actions [:enable, :start]
end
root@default-ubuntu-1404:~# service elasticsearch status
elasticsearch not running
root@default-ubuntu-1404:~# service elasticsearch start
PID file found in /usr/local/var/run/default_ubuntu_1404.pid
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Starting Elasticsearch...start-stop-daemon: unable to stat /usr/local/bin/elasticsearch (No such file or directory)
 [OK]

This is based off of the examples in the tests directory and the readme

@spuder
Copy link
Contributor Author

spuder commented Nov 20, 2015

This is on the 1.2.0 release from supermarket

@martinb3
Copy link
Contributor

Hello! We have a branch going that we're about to release -- named 2.0.0_wip. Will you give that branch a try and give us your feedback? It should resolve the issue you're experiencing. Thanks!

@spuder
Copy link
Contributor Author

spuder commented Nov 20, 2015

Thanks, I tried the 2.0.0_wip branch with the same results.

---
driver:
  name: vagrant
  network:
  - ["forwarded_port", { guest: 9200, host: 9200 }]

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-14.04
    run_list:
    - recipe[apt]

suites:
  - name: default
    run_list:
      - recipe[java]
      - recipe[nd-elasticsearch::default]
    attributes:
      java:
        install_flavor: "oracle"
        jdk_version: "8"
        oracle:
          accept_oracle_download_terms: true
elasticsearch_user 'elasticsearch' do
  username 'elasticsearch'
  groupname 'elasticsearch'
  shell '/bin/sh'
  comment 'Elasticsearch User'
  action :create
end

elasticsearch_install 'nd-elasticsearch' do
  type :package
  version "2.0.0"
  action :install
end

elasticsearch_configure 'nd-elasticsearch' do
  allocated_memory '123m'
  thread_stack_size '512k'
  gc_settings <<-CONFIG
                -XX:+UseParNewGC
                -XX:+UseConcMarkSweepGC
                -XX:CMSInitiatingOccupancyFraction=75
                -XX:+UseCMSInitiatingOccupancyOnly
                -XX:+HeapDumpOnOutOfMemoryError
                -XX:+PrintGCDetails
              CONFIG
  configuration ({
    'cluster.name' => node['nd-elasticsearch']['config']['cluster_name']
    })
  action :manage
end

elasticsearch_service 'elasticsearch' do
  service_actions [:enable, :start]
end
#Berksfile
source "https://supermarket.getchef.com"

metadata

cookbook 'elasticsearch', github: "elastic/cookbook-elasticsearch", branch: "2.0.0_wip"
cookbook 'apt'
cookbook 'java'

It gives the same error

root@default-ubuntu-1404:~# service elasticsearch status
elasticsearch not running
root@default-ubuntu-1404:~# service elasticsearch start
PID file found in /usr/local/var/run/default_ubuntu_1404.pid
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Starting Elasticsearch...start-stop-daemon: unable to stat /usr/local/bin/elasticsearch (No such file or directory)
 [OK]
root@default-ubuntu-1404:~# dupe2fs /dev/sda

If I skip the elasticsearch_service section entirely, then the normal init script is provided, which I can manually start.

#elasticsearch_service 'elasticsearch' do
#  service_actions [:enable, :start]
#end

You can tell if using the package init script vs the cookbook init script by the colors they show.

Package init script: (works)
screenshot 2015-11-20 08 20 25

Cookbook init script: (not working)

screenshot 2015-11-20 08 15 27

@martinb3
Copy link
Contributor

Thank you for that thorough documentation; it's weird, since we took the init scripts from the packages. I'll have to look and see if they've been updated and also run our test suite and see if it fails (it was working last I checked).

@martinb3 martinb3 added this to the 2.0.0 release milestone Nov 20, 2015
@martinb3 martinb3 added the Bug Something isn't working label Nov 20, 2015
@martinb3
Copy link
Contributor

@spuder So just running through the test suite for ubuntu-1404 on 2.0.0_wip, I'm seeing the init script start up ES successfully. I also note that I do not see grep anywhere in it, which is the command you're getting an error on. The old branch (master) does have grep in a few different places. Can you confirm on what commit hash of the cookbook you're seeing this?

@spuder
Copy link
Contributor Author

spuder commented Nov 20, 2015

I've copied both init scripts here.

https://gist.github.com/spuder/6e7a69f7f9d98c0548c7

To reproduce you can setup test kitchen. Run a converge with the following commented out in the recipe.

#elasticsearch_service 'elasticsearch' do
#  service_actions [:enable, :start]
#end

Then elasticsearch service will have the purple colors and will work.

Then uncomment those lines and converge again, thew new script will be created with the yellow coloring and won't start properly.

I'm 90% sure that I'm using the 2.0.0_wip branch.

@martinb3
Copy link
Contributor

@spuder That's definitely the old/master branch's init script.

@spuder
Copy link
Contributor Author

spuder commented Nov 20, 2015

😐 User error. Apparently adding to the Berksfile isn't enough.

I had to delete the Berksfile.lock and then berks install. And also update the metadata.rb

Thanks for the help.

@spuder spuder closed this as completed Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants