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

Default user / group not written to /etc/sysconfig/elasticsearch #80

Closed
mrbanzai opened this issue Feb 12, 2014 · 14 comments
Closed

Default user / group not written to /etc/sysconfig/elasticsearch #80

mrbanzai opened this issue Feb 12, 2014 · 14 comments

Comments

@mrbanzai
Copy link

Currently, it appears that /etc/sysconfig/elasticsearch is only written out with the values passed in for init_defaults, meaning that user and group are not defined if not provided explicitly (such as when using the defaults). This seems to cause the initscript to fail starting the service, as $ES_USER is not defined prior to the call to daemon.

This causes the following message when attempting to start the service via the initscript:

$ service elasticsearch start
Starting elasticsearch: runuser: unrecognized option '--pidfile'
Try `runuser --help' for more information.

This is triggered by templates/etc/init.d/elasticsearch.RedHat.erb, line 85.

I can work around it for now by handing ES_USER in init_defaults, but it seems like it's necessary to make sure that it is set properly in advance of launching the daemon in the initscript.

@electrical
Copy link
Contributor

Hi,

This is something i still want to solve indeed.
The idea i'm having is to have a default hash with all the values the defaults file has when being installed.
Then i can merge the init_defaults hash with that and overwriting only the values you've specified.

What do you think?

@mrbanzai
Copy link
Author

I know that user / group are defaulted in manifests/params.pp, so it would be nice to keep those consistent with the init defaults.

On a related note, how would you recommend keeping the other information consistent as well (such as paths)? Right now, the RPM by default creates a defaults file with paths that align with the package's install locations and such (MAX_MAP_COUNT, HOME_DIR, CONF_DIR, CONF_FILE, WORK_DIR, LOG_DIR, DATA_DIR), so needing to override a single value with the Puppet module requires you to redefine everything.

As much as adding additional dependencies annoys me, perhaps it would be worthwhile to look into using Augeas for defining overrides? It would obviously be possible to keep the packaged defaults in-sync with the Puppet module, but with the ability to install from a specific file, differing defaults across distros, etc. it could be annoying to maintain.

Let me know if I'm over-thinking / over-engineering, or if I'm missing something obvious / simple; otherwise, I might spend some time this weekend seeing if it's a valid approach.

Thanks for the response!

@electrical
Copy link
Contributor

Hi,

I could set a hash with the current values of the defaults file and write that no matter what.
When you override settings in the the init_defaults hash it merges the 2 hashes so it always has the full variable list including the things you override.
Not sure how future proof that is though.

I think the main downside at the moment is that the init scripting fully depends on variable set in the defaults file.
Without it, it doesn't run correctly.
The defaults file should be something to override settings imho.

Augeas could be a good solution indeed but would like to keep dependencies as minimally as possible.
If having a hash for the defaults file content is unreliable / unmaintainable we could have a look at augeas.

Any idea's?

@electrical
Copy link
Contributor

Did a bit of digging on the augeas part and it should be doable.
Will see if i can implement something.

@electrical
Copy link
Contributor

Hi,

Been working on it for a bit and seems to work.
Just working on getting the tests to run on the different distro's ( system tests )

@electrical
Copy link
Contributor

These are the main changes: 862d677

@mrbanzai
Copy link
Author

That worked absolutely perfectly, and it was resolved much quicker than I would have been able to knock it out. Much appreciated!

As to your previous comments: I absolutely agree that the init script is too dependent on those settings being defined in the sysconfig file. However, these changes at least provide a way for the user to only need to override specific settings, and leave the underlying framework in place. If the initscript does become more intelligent in the future, this patch will still continue to function as desired.

Again, thanks for the quick response! I'll leave the closing of the issue to you, to allow closing it with the master merge.

@electrical
Copy link
Contributor

Just need to fix the $elasticsearch_user and $elasticsearch_group options so they do get into the defaults file.. otherwise its still useless. ( just a bit less useless with this rewrite of it )

@electrical
Copy link
Contributor

Found a solution for the last bit. Can you check after I've pushed it?

@electrical
Copy link
Contributor

Should be fixed now. Can you check it? Cheers.

@electrical
Copy link
Contributor

Pushed an other fix so it works with older versions ( pre 1.0 ) of augeas.

@mrbanzai
Copy link
Author

mrbanzai commented Mar 3, 2014

I'll check it out this morning. Thanks for the quick turnaround!

@electrical
Copy link
Contributor

No problem :-)
let me know if you find any weird issues.

@electrical
Copy link
Contributor

Talked via other channels. issue solved.

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

2 participants