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

Use start-stop-daemon to start when on debian family so we can background correctly #91

Closed
wants to merge 2 commits into from
Closed

Use start-stop-daemon to start when on debian family so we can background correctly #91

wants to merge 2 commits into from

Conversation

chrisroberts
Copy link

Initial bootstraps would start the service, but would not leave the service running (service would die after provision completed and ssh connection severed). Updates to use start-stop-daemon to start on debian platform families. Uses the --background option to force the process to properly detach. (may be loosely related to #32)

@karmi
Copy link
Contributor

karmi commented May 3, 2013

service would die after provision completed and ssh connection severed

Chris, any idea why this is happening? Should we use similar platform specific solutions on RHEL etc? Can you check and compare the .deb and .rpm packages done by Elasticsearch?

@Pneumatus
Copy link

I've solved this in a slightly different way locally - I have just added the 'start' action to the elasticsearch service so chef continues to ensure that the service is started. I'm not sure why this cookbook only declares the service with the 'enable' action and only notifies a 'start' when ES is first installed with the ark resource, but I guess there's some historical reason.

@chrisroberts
Copy link
Author

@Pneumatus My wrapper cookbook is providing the :start action to the service, but that is an unrelated issue to this.

@karmi It looks like it has to do with the behavior of the spawned es process and it not properly detaching from the parent process, so it dies when the parent process dies. This is why the --background option resolved the issue. I'll fire up a centos node today and provision it with es to see if the same behavior is encountered. If so, then we should probably do the same there as well.

@maf23
Copy link

maf23 commented May 6, 2013

I am investigating a similar issue here which I think has the same underlying cause. In my case we are starting elasticsearch from chef. The chef-client was started via upstart (on Ubuntu 12.04). Our problem is that when we stop the chef-client then elasticsearch is killed too.

The reason upstarted kills elasticsearch as well is that it belongs to the same process group as chef-client. That is the startup script does not properly daemonize the elasticsearch process. The missing step is changing the process group. The easiest way to change this is to add a 'setsid' before the su command which starts elasticsearch in the init-file.

I guess that start-sto-daemon with --background does something similar.

@karmi
Copy link
Contributor

karmi commented May 9, 2013

@chrisroberts @Pneumatus @maf23 Hi, thanks for all the info! It seems like using the start-stop-daemon is the right approach -- it is also used by the init script in the .deb package. The .rpm package uses daemon.

I'll try to verify this and include it as soon as possible.

@waawal
Copy link

waawal commented May 15, 2013

👍

@duro
Copy link

duro commented May 16, 2013

Any chance this is going to make it's way in soon? We are having to start elastic search manually on Ubuntu 12.04 when we converge a fresh node. I'd like to avoid having to fork this cookbook to implements @chrisroberts fix.

@karmi karmi closed this in 306e0c7 Jun 10, 2013
@karmi
Copy link
Contributor

karmi commented Jun 10, 2013

@chrisroberts Got to the issue at last, sorry Chris!

I'm wondering if platform-specific templates would be a good idea, as per #98.

Note that I wrote the original init script without any thorough testing across Linux variants. I'd like to somehow facilitate using a custom init script, a la https://gist.github.com/fujin/1713157, maybe it's just a matter of proper documentation.

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

Successfully merging this pull request may close these issues.

None yet

6 participants