Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in the repo is convenient again
This commit is contained in:
1
cookbooks/elasticsearch/.foodcritic
Normal file
1
cookbooks/elasticsearch/.foodcritic
Normal file
@@ -0,0 +1 @@
|
||||
~FC057
|
||||
587
cookbooks/elasticsearch/CHANGELOG.md
Normal file
587
cookbooks/elasticsearch/CHANGELOG.md
Normal file
@@ -0,0 +1,587 @@
|
||||
# Change Log
|
||||
|
||||
## [v4.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.2.0) (2019-08-02)
|
||||
- Default to Elasticsearch 7.3.0
|
||||
- Some fixes for the version logic when selecting v7 or higher ES
|
||||
|
||||
## [v4.1.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.1.0) (2019-08-02)
|
||||
- Added support for ES 6.8.1, 6.8.2 and new default of 6.8.2
|
||||
- Added support for ES v7, with 7.0.0, 7.0.1, 7.1.0, 7.2.0, 7.2.1, 7.3.0
|
||||
- New URL format for ES v7 introduced, taught lib/helpers how to use it
|
||||
- Bumped testing to use Chef v14
|
||||
- Modified testing with test-kitchen to stop using x-pack as a test plugin, now using analysis-icu
|
||||
- Some minor tweaks to get chefspec tests working again
|
||||
|
||||
## [v4.0.6](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.6) (2019-05-22)
|
||||
- Lots of new hashes of more recent releases of ES, see PRs for full list (#715, #713, #710, #709, #705, #704, #701).
|
||||
- Get Travis building again (#714).
|
||||
|
||||
## [v4.0.5](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.5) (2019-01-02)
|
||||
- Add hashes for 6.5.4 (#699), 6.5.3 (#697)
|
||||
|
||||
## [v4.0.4](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.4) (2018-11-06)
|
||||
- Add hashes for 6.4.2 (#687)
|
||||
|
||||
## [v4.0.3](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.3) (2018-09-24)
|
||||
- Add hashes for 6.4.1 (#682)
|
||||
|
||||
## [v4.0.2](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.2) (2018-09-17)
|
||||
- Add hashes for 6.3.0 (#669), 6.3.1 (#673), 6.4.0 (#677)
|
||||
|
||||
## [v4.0.1](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.1) (2018-06-01)
|
||||
- Add hashes for 6.2.4 (#665)
|
||||
- Improve ES_USER / ES_GROUP logic for init script and package installs (#647)
|
||||
|
||||
## [v4.0.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.0.0) (2018-03-25)
|
||||
- Default to 6.0.0 and add sha256 checksums, drop old 5.x hashes
|
||||
- Point to 6.x yum repo
|
||||
- Introduce 6.0.0's JVM options for ES 6
|
||||
- ES_JVM_OPTIONS is no longer supported in v6.0.0
|
||||
- Correct tests with x-pack installation
|
||||
- Remove test for config entry that is no longer valid
|
||||
- Remove path.conf reference after testing
|
||||
- Stop testing on Ubuntu 12.04 and earlier
|
||||
|
||||
## [v3.4.5](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.5) (2018-03-25)
|
||||
- Add documentation for Java "trust anchors" problem (#646)
|
||||
- Add hashes for 5.6.8 (#649)
|
||||
|
||||
## [v3.4.4](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.4) (2018-02-01)
|
||||
- Add hashes for ES 5.6.6 (#638) and ES 5.6.7 (#640)
|
||||
|
||||
## [v3.4.3](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.3) (2018-01-03)
|
||||
- Add hashes for ES 5.6.5 (#632)
|
||||
|
||||
## [v3.4.2](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.2) (2017-12-03)
|
||||
- Add hashes for ES 5.6.4 (#622)
|
||||
|
||||
## [v3.4.1](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.1) (2017-10-18)
|
||||
- Add hashes for ES 5.6.3 (#616)
|
||||
|
||||
## [v3.4.0](https://github.com/elastic/cookbook-elasticsearch/tree/v3.4.0) (2017-09-28)
|
||||
- Add hashes for ES 5.6.1 and 5.6.2 (#613)
|
||||
- Add the latest init scripts from .deb, .rpm, and systemd
|
||||
|
||||
## [v3.3.1](https://github.com/elastic/cookbook-elasticsearch/tree/v3.3.1) (2017-09-15)
|
||||
- Add hashes for ES 5.6.0 and 5.5.3 (#610)
|
||||
- Workaround for support 'amazon' platform_family (#609)
|
||||
|
||||
## [v3.3.0](https://github.com/elastic/cookbook-elasticsearch/tree/v3.3.0) (2017-08-30)
|
||||
- nil templates skip startup scripts (#585)
|
||||
|
||||
## [v3.2.2](https://github.com/elastic/cookbook-elasticsearch/tree/v3.2.2) (2017-08-29)
|
||||
- Bump ES version to 5.5.2 (#606)
|
||||
|
||||
## [v3.2.1](https://github.com/elastic/cookbook-elasticsearch/tree/v3.2.1) (2017-07-17)
|
||||
- Bump ES version to 5.5.0, add 5.4.2 and 5.4.3 as well (#594)
|
||||
|
||||
## [v3.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/v3.2.0) (2017-05-21)
|
||||
- Provide additional documentation about logging options, update template (#577)
|
||||
- Allow others to read elasticsearch log dir (#570)
|
||||
- Bump ES version to 5.4.0 (#569)
|
||||
|
||||
## [v3.1.1](https://github.com/elastic/cookbook-elasticsearch/tree/v3.1.1) (2017-05-01)
|
||||
- Add hashes for ES 5.3.1 (#562)
|
||||
- Add hashes for ES 5.3.2 (#567)
|
||||
|
||||
## [v3.1.0](https://github.com/elastic/cookbook-elasticsearch/tree/v3.1.0) (2017-04-18)
|
||||
- Add Chef 13.x support for this cookbook (#561)
|
||||
- Reintroduce chef_proxy settings (#557)
|
||||
|
||||
## [v3.0.5](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.5) (2017-04-06)
|
||||
- Bump ES version to 5.3.0 (#550)
|
||||
- Fix permissions for elasticsearch.yml and log4j2.properties (#555)
|
||||
|
||||
## [v3.0.4](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.4) (2017-03-02)
|
||||
- Bump ES version to 5.2.2 (#550)
|
||||
|
||||
## [v3.0.3](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.3) (2017-02-09)
|
||||
- Fix URL support for plugins (#525)
|
||||
- Add support for versions 5.0.2, 5.1.1, 5.1.2, 5.2.0
|
||||
- Make 5.2.0 the default version
|
||||
- Add a note about upgrading to new versions (#527)
|
||||
- Foodcritic/Rubocop style cleanup
|
||||
- Fix ruby version build on travis
|
||||
- remove tarball directory recursively
|
||||
|
||||
## [v3.0.2](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.2) (2016-11-29)
|
||||
|
||||
- Ensure bin/elasticsearch-plugin uses the proper environment (#523)
|
||||
- Bump default Elasticsearch version from v5.0.0 to v5.0.1
|
||||
|
||||
## [v3.0.1](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.1) (2016-11-09)
|
||||
|
||||
- Fix incorrect MAX_MAP_COUNT default to be '262144' to match init scripts (#516)
|
||||
|
||||
## [v3.0.0](https://github.com/elastic/cookbook-elasticsearch/tree/v3.0.0) (2016-11-07)
|
||||
|
||||
Breaking changes that were needed for v5.0.0 support (#497, #512, #424, #478, #503):
|
||||
- We dropped the fancy logic for figuring out the requested version of Elasticsearch to be installed. You should pass it on the resource or in the recipe, but we no longer do a bunch of logic to figure out what you meant -- we favor being explicit now.
|
||||
- We now start the service by default, instead of only `:enable` but not `:start`.
|
||||
- Dropped `gc_options` parameter of elasticsearch_configure, and now have `jvm.options`. We've also dropped thread_stack_size and env_options, as they aren't used in the upstream packaging as defaults anymore.
|
||||
- Install the tarball and package files into the same locations. There's no more `/usr/local`.
|
||||
- Install types are now 'strings', not :symbols. `node['elasticsearch'][<resource>][<param>]` sets any `elasticsearch::default` recipe.
|
||||
|
||||
For more on breaking changes, read [3aa8740](https://github.com/elastic/cookbook-elasticsearch/commit/3aa8740da5182f4a29761e0ea350048764bc0752) and [1ccd013](https://github.com/elastic/cookbook-elasticsearch/commit/1ccd013821cbfe83197c1ebba7fdb3acadc3d88f).
|
||||
|
||||
- Switch to the `manage_home false` property of newer Chef versions (#406)
|
||||
- Use YAML library directly from now on for elasticsearch.yml (#470)
|
||||
- Add support for Ubuntu 16.04 / CentOS 7.2, both using systemd (#501, #502)
|
||||
- Support and use 'repository' type on `elasticsearch_install` by default (#476)
|
||||
- Based on the latest v5.0.0 packages, tweak the permissions for some directories slightly (#513)
|
||||
- Drop preferIPv4 test (#475), discovery.zen.ping settings (#437), and others.
|
||||
- Add Java 8 testing by default (#510), bump newer Chef versions (#503, #505)
|
||||
- Start using exact plugin names, case sensitive (#485)
|
||||
|
||||
## [v2.4.0](https://github.com/elastic/cookbook-elasticsearch/tree/v2.4.0) (2016-09-15)
|
||||
|
||||
- Update attributes for 2.3.5 and 2.4.0 versions. Use 2.4.0 version as default for installation and tests. [\#496](https://github.com/elastic/cookbook-elasticsearch/issues/496) and [\#490](https://github.com/elastic/cookbook-elasticsearch/issues/490)
|
||||
- Added a LICENSE file (Apache 2), metadata, and linting
|
||||
- Remove chef 11 compatibility from metadata, update cookstyle and Berkshelf, various Chef standards [\#481](https://github.com/elastic/cookbook-elasticsearch/issues/481)
|
||||
- Improve environment file formatting: Remove quotes from vars that don't need it, strip superfluous spaces from ES_JAVA_OPTS [\#477](https://github.com/elastic/cookbook-elasticsearch/issues/477)
|
||||
|
||||
## [v2.3.2](https://github.com/elastic/cookbook-elasticsearch/tree/v2.3.2) (2016-06-17)
|
||||
|
||||
- Update init scripts and configs to latest [\#461](https://github.com/elastic/cookbook-elasticsearch/issues/461)
|
||||
- Don't make environment file executable [\#474](https://github.com/elastic/cookbook-elasticsearch/issues/474)
|
||||
- Don't make config YAML file executable [\#465](https://github.com/elastic/cookbook-elasticsearch/issues/465)
|
||||
- Make latest Foodcritic rules pass [\#466](https://github.com/elastic/cookbook-elasticsearch/issues/466)
|
||||
- ES 2.3.3 SHA256 sums and default version [\#464](https://github.com/elastic/cookbook-elasticsearch/issues/464)
|
||||
- Point to determine_download_url instead of non-existent get_package_url [\#463](https://github.com/elastic/cookbook-elasticsearch/issues/463)
|
||||
|
||||
## [v2.3.1](https://github.com/elastic/cookbook-elasticsearch/tree/v2.3.1) (2016-05-06)
|
||||
|
||||
- Update documentation for dir in elasticsearch_install [\#453](https://github.com/elastic/cookbook-elasticsearch/issues/453)
|
||||
- Define custom matchers helpers for notification testing [\#458](https://github.com/elastic/cookbook-elasticsearch/issues/458)
|
||||
- Add checksums for version 2.3.2 [\#457](https://github.com/elastic/cookbook-elasticsearch/issues/457)
|
||||
- Default ES version bump to 2.3.2 [\#459](https://github.com/elastic/cookbook-elasticsearch/issues/459)
|
||||
- Fix quoting bug in plugin remove action [\#455](https://github.com/elastic/cookbook-elasticsearch/issues/455)
|
||||
- Fix typo in README [\#456](https://github.com/elastic/cookbook-elasticsearch/issues/456)
|
||||
|
||||
## [v2.3.0](https://github.com/elastic/cookbook-elasticsearch/tree/v2.3.0) (2016-04-07)
|
||||
|
||||
- Add checksums for 2.3.1 [\#451](https://github.com/elastic/cookbook-elasticsearch/issues/451)
|
||||
|
||||
## [v2.2.2](https://github.com/elastic/cookbook-elasticsearch/tree/v2.2.2) (2016-03-22)
|
||||
|
||||
- elasticsearch_configure provider should not modify default resource parameters [\#445](https://github.com/elastic/cookbook-elasticsearch/issues/445)
|
||||
|
||||
## [v2.2.1](https://github.com/elastic/cookbook-elasticsearch/tree/v2.2.1) (2016-03-04)
|
||||
|
||||
- Incorrectly setting allocated memory in the `ES\_JAVA\_OPTS` variable [\#434](https://github.com/elastic/cookbook-elasticsearch/issues/434)
|
||||
- elasticsearch_service/service_actions accepts (but does not support) Symbols [\#438](https://github.com/elastic/cookbook-elasticsearch/issues/438)
|
||||
|
||||
## [v2.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/v2.2.0) (2016-02-08)
|
||||
|
||||
- Max heap size is too large [\#427](https://github.com/elastic/cookbook-elasticsearch/issues/427)
|
||||
- How to define discovery.zen.ping.unicast.hosts [\#426](https://github.com/elastic/cookbook-elasticsearch/issues/426)
|
||||
- elasticsearch\_plugin install lacks proxy support [\#415](https://github.com/elastic/cookbook-elasticsearch/issues/415)
|
||||
- Default ES version needs upgrading \(2.1.0 \> 2.1.1\) [\#411](https://github.com/elastic/cookbook-elasticsearch/issues/411)
|
||||
- config dirs/files and install dirs/files should be owned by root, not es\_user [\#405](https://github.com/elastic/cookbook-elasticsearch/issues/405)
|
||||
- Reinstalls elasticserach every chef run [\#404](https://github.com/elastic/cookbook-elasticsearch/issues/404)
|
||||
- Permission problem when installing Watcher or Shield [\#423](https://github.com/elastic/cookbook-elasticsearch/issues/423)
|
||||
- Installing shield and watcher plugins fail with AccessDeniedException [\#421](https://github.com/elastic/cookbook-elasticsearch/issues/421)
|
||||
- Plugin removal is broken [\#418](https://github.com/elastic/cookbook-elasticsearch/issues/418)
|
||||
- elasticsearch\_configure documentation example missing path\_home [\#413](https://github.com/elastic/cookbook-elasticsearch/issues/413)
|
||||
- Init script can't start [\#390](https://github.com/elastic/cookbook-elasticsearch/issues/390)
|
||||
- ruby command not found [\#378](https://github.com/elastic/cookbook-elasticsearch/issues/378)
|
||||
- ES 2.2.0 installation fails [\#429](https://github.com/elastic/cookbook-elasticsearch/issues/429)
|
||||
- Can't install plugin twice [\#408](https://github.com/elastic/cookbook-elasticsearch/issues/408)
|
||||
- Error running recipe on AWS Opsworks [\#403](https://github.com/elastic/cookbook-elasticsearch/issues/403)
|
||||
- ES 2.1.0 support [\#402](https://github.com/elastic/cookbook-elasticsearch/issues/402)
|
||||
- Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/elastic/cookbook-elasticsearch/issues/401)
|
||||
- gateway.expected\_nodes default should be 0 [\#399](https://github.com/elastic/cookbook-elasticsearch/issues/399)
|
||||
- Add the defaults for slowlogs in logging.yml [\#398](https://github.com/elastic/cookbook-elasticsearch/issues/398)
|
||||
- elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/elastic/cookbook-elasticsearch/issues/397)
|
||||
- What is supposed to happen when a config file is changed? [\#394](https://github.com/elastic/cookbook-elasticsearch/issues/394)
|
||||
- Doc request - how to create data nodes vs master nodes [\#393](https://github.com/elastic/cookbook-elasticsearch/issues/393)
|
||||
- Plugin install isn't idempotent [\#392](https://github.com/elastic/cookbook-elasticsearch/issues/392)
|
||||
- Question - Are custom configs required everywhere? [\#391](https://github.com/elastic/cookbook-elasticsearch/issues/391)
|
||||
- Is :tarball or :package the preferred installation type? [\#389](https://github.com/elastic/cookbook-elasticsearch/issues/389)
|
||||
- Support Amazon platform for init scripts [\#387](https://github.com/elastic/cookbook-elasticsearch/issues/387)
|
||||
- "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/elastic/cookbook-elasticsearch/issues/386)
|
||||
- Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/elastic/cookbook-elasticsearch/issues/385)
|
||||
- Support ES 2.0 [\#384](https://github.com/elastic/cookbook-elasticsearch/issues/384)
|
||||
- plugin install does not work [\#382](https://github.com/elastic/cookbook-elasticsearch/issues/382)
|
||||
- Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/elastic/cookbook-elasticsearch/issues/379)
|
||||
- Allow template cookbook override in \_configure [\#376](https://github.com/elastic/cookbook-elasticsearch/issues/376)
|
||||
- 1.0.2 Issues with pid files [\#374](https://github.com/elastic/cookbook-elasticsearch/issues/374)
|
||||
- Consider using the resource name as a common shared set of resources [\#373](https://github.com/elastic/cookbook-elasticsearch/issues/373)
|
||||
- elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/elastic/cookbook-elasticsearch/issues/371)
|
||||
- Compile Error [\#370](https://github.com/elastic/cookbook-elasticsearch/issues/370)
|
||||
- wrong number of arguments \(1 for 0\) [\#369](https://github.com/elastic/cookbook-elasticsearch/issues/369)
|
||||
- fixes typo in readme [\#428](https://github.com/elastic/cookbook-elasticsearch/pull/428) ([spuder](https://github.com/spuder))
|
||||
- Plugin removal functionality restored [\#420](https://github.com/elastic/cookbook-elasticsearch/pull/420) ([dbaggott](https://github.com/dbaggott))
|
||||
- Update to ES 2.1.1 [\#412](https://github.com/elastic/cookbook-elasticsearch/pull/412) ([dbaggott](https://github.com/dbaggott))
|
||||
- Makes code examples have color [\#396](https://github.com/elastic/cookbook-elasticsearch/pull/396) ([spuder](https://github.com/spuder))
|
||||
- Updates docs to show package are now default install [\#395](https://github.com/elastic/cookbook-elasticsearch/pull/395) ([spuder](https://github.com/spuder))
|
||||
- Update the README to remove a typo [\#381](https://github.com/elastic/cookbook-elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren))
|
||||
- Correct the full changelog links [\#375](https://github.com/elastic/cookbook-elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick))
|
||||
- add missing matchers [\#368](https://github.com/elastic/cookbook-elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic))
|
||||
|
||||
## [v2.1.1](https://github.com/elastic/cookbook-elasticsearch/tree/v2.1.1) (2016-01-08)
|
||||
|
||||
- elasticsearch\_plugin install lacks proxy support [\#415](https://github.com/elastic/cookbook-elasticsearch/issues/415)
|
||||
- Default ES version needs upgrading \(2.1.0 \> 2.1.1\) [\#411](https://github.com/elastic/cookbook-elasticsearch/issues/411)
|
||||
- Reinstalls elasticserach every chef run [\#404](https://github.com/elastic/cookbook-elasticsearch/issues/404)
|
||||
- Installing shield and watcher plugins fail with AccessDeniedException [\#421](https://github.com/elastic/cookbook-elasticsearch/issues/421)
|
||||
- Plugin removal is broken [\#418](https://github.com/elastic/cookbook-elasticsearch/issues/418)
|
||||
- elasticsearch\_configure documentation example missing path\_home [\#413](https://github.com/elastic/cookbook-elasticsearch/issues/413)
|
||||
- Init script can't start [\#390](https://github.com/elastic/cookbook-elasticsearch/issues/390)
|
||||
- ruby command not found [\#378](https://github.com/elastic/cookbook-elasticsearch/issues/378)
|
||||
- Can't install plugin twice [\#408](https://github.com/elastic/cookbook-elasticsearch/issues/408)
|
||||
- Error running recipe on AWS Opsworks [\#403](https://github.com/elastic/cookbook-elasticsearch/issues/403)
|
||||
- ES 2.1.0 support [\#402](https://github.com/elastic/cookbook-elasticsearch/issues/402)
|
||||
- Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/elastic/cookbook-elasticsearch/issues/401)
|
||||
- gateway.expected\_nodes default should be 0 [\#399](https://github.com/elastic/cookbook-elasticsearch/issues/399)
|
||||
- Add the defaults for slowlogs in logging.yml [\#398](https://github.com/elastic/cookbook-elasticsearch/issues/398)
|
||||
- elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/elastic/cookbook-elasticsearch/issues/397)
|
||||
- What is supposed to happen when a config file is changed? [\#394](https://github.com/elastic/cookbook-elasticsearch/issues/394)
|
||||
- Doc request - how to create data nodes vs master nodes [\#393](https://github.com/elastic/cookbook-elasticsearch/issues/393)
|
||||
- Plugin install isn't idempotent [\#392](https://github.com/elastic/cookbook-elasticsearch/issues/392)
|
||||
- Question - Are custom configs required everywhere? [\#391](https://github.com/elastic/cookbook-elasticsearch/issues/391)
|
||||
- Is :tarball or :package the preferred installation type? [\#389](https://github.com/elastic/cookbook-elasticsearch/issues/389)
|
||||
- Support Amazon platform for init scripts [\#387](https://github.com/elastic/cookbook-elasticsearch/issues/387)
|
||||
- "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/elastic/cookbook-elasticsearch/issues/386)
|
||||
- Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/elastic/cookbook-elasticsearch/issues/385)
|
||||
- Support ES 2.0 [\#384](https://github.com/elastic/cookbook-elasticsearch/issues/384)
|
||||
- plugin install does not work [\#382](https://github.com/elastic/cookbook-elasticsearch/issues/382)
|
||||
- Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/elastic/cookbook-elasticsearch/issues/379)
|
||||
- Allow template cookbook override in \_configure [\#376](https://github.com/elastic/cookbook-elasticsearch/issues/376)
|
||||
- 1.0.2 Issues with pid files [\#374](https://github.com/elastic/cookbook-elasticsearch/issues/374)
|
||||
- Consider using the resource name as a common shared set of resources [\#373](https://github.com/elastic/cookbook-elasticsearch/issues/373)
|
||||
- elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/elastic/cookbook-elasticsearch/issues/371)
|
||||
- Compile Error [\#370](https://github.com/elastic/cookbook-elasticsearch/issues/370)
|
||||
- wrong number of arguments \(1 for 0\) [\#369](https://github.com/elastic/cookbook-elasticsearch/issues/369)
|
||||
- missing chef resource expectations in specs in 1.0.1 [\#367](https://github.com/elastic/cookbook-elasticsearch/issues/367)
|
||||
- Use predictable attributes/values for version, download URL, and checksum [\#366](https://github.com/elastic/cookbook-elasticsearch/issues/366)
|
||||
- Rubocop & foodcritic cleanup [\#365](https://github.com/elastic/cookbook-elasticsearch/issues/365)
|
||||
- elasticsearch\_plugin installs plugins with the wrong permissions [\#363](https://github.com/elastic/cookbook-elasticsearch/issues/363)
|
||||
- Double-dependency on curl [\#360](https://github.com/elastic/cookbook-elasticsearch/issues/360)
|
||||
- OS X Support [\#358](https://github.com/elastic/cookbook-elasticsearch/issues/358)
|
||||
- Plugin removal functionality restored [\#420](https://github.com/elastic/cookbook-elasticsearch/pull/420) ([dbaggott](https://github.com/dbaggott))
|
||||
- Update to ES 2.1.1 [\#412](https://github.com/elastic/cookbook-elasticsearch/pull/412) ([dbaggott](https://github.com/dbaggott))
|
||||
- Makes code examples have color [\#396](https://github.com/elastic/cookbook-elasticsearch/pull/396) ([spuder](https://github.com/spuder))
|
||||
- Updates docs to show package are now default install [\#395](https://github.com/elastic/cookbook-elasticsearch/pull/395) ([spuder](https://github.com/spuder))
|
||||
- Update the README to remove a typo [\#381](https://github.com/elastic/cookbook-elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren))
|
||||
- Correct the full changelog links [\#375](https://github.com/elastic/cookbook-elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick))
|
||||
- add missing matchers [\#368](https://github.com/elastic/cookbook-elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic))
|
||||
- Adds integration test for plugins in default environment [\#361](https://github.com/elastic/cookbook-elasticsearch/pull/361) ([bwvoss](https://github.com/bwvoss))
|
||||
|
||||
## [2.1.0](https://github.com/elastic/cookbook-elasticsearch/tree/v2.1.0) (2015-12-01)
|
||||
|
||||
- ES 2.1.0 support [\#402](https://github.com/elastic/cookbook-elasticsearch/issues/402)
|
||||
|
||||
## [2.0.1](https://github.com/elastic/cookbook-elasticsearch/tree/v2.0.1) (2015-12-01)
|
||||
|
||||
- Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/elastic/cookbook-elasticsearch/issues/401)
|
||||
- gateway.expected\_nodes default should be 0 [\#399](https://github.com/elastic/cookbook-elasticsearch/issues/399)
|
||||
- Add the defaults for slowlogs in logging.yml [\#398](https://github.com/elastic/cookbook-elasticsearch/issues/398)
|
||||
|
||||
## [2.0.0](https://github.com/elastic/cookbook-elasticsearch/tree/v2.0.0) (2015-11-23)
|
||||
|
||||
- Upgrading by package needs cleanup [\#331](https://github.com/elastic/cookbook-elasticsearch/issues/331)
|
||||
- Minimal init scripts, preferrably from the packaged versions of ES [\#321](https://github.com/elastic/cookbook-elasticsearch/issues/321)
|
||||
- Remove extra env file, or follow packaged conventions [\#320](https://github.com/elastic/cookbook-elasticsearch/issues/320)
|
||||
- Remove system limit adjustments [\#319](https://github.com/elastic/cookbook-elasticsearch/issues/319)
|
||||
- Init script can't start [\#390](https://github.com/elastic/cookbook-elasticsearch/issues/390)
|
||||
- elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/elastic/cookbook-elasticsearch/issues/397)
|
||||
- What is supposed to happen when a config file is changed? [\#394](https://github.com/elastic/cookbook-elasticsearch/issues/394)
|
||||
- Doc request - how to create data nodes vs master nodes [\#393](https://github.com/elastic/cookbook-elasticsearch/issues/393)
|
||||
- Plugin install isn't idempotent [\#392](https://github.com/elastic/cookbook-elasticsearch/issues/392)
|
||||
- Question - Are custom configs required everywhere? [\#391](https://github.com/elastic/cookbook-elasticsearch/issues/391)
|
||||
- Is :tarball or :package the preferred installation type? [\#389](https://github.com/elastic/cookbook-elasticsearch/issues/389)
|
||||
- Support Amazon platform for init scripts [\#387](https://github.com/elastic/cookbook-elasticsearch/issues/387)
|
||||
- "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/elastic/cookbook-elasticsearch/issues/386)
|
||||
- Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/elastic/cookbook-elasticsearch/issues/385)
|
||||
- plugin install does not work [\#382](https://github.com/elastic/cookbook-elasticsearch/issues/382)
|
||||
- Allow template cookbook override in \_configure [\#376](https://github.com/elastic/cookbook-elasticsearch/issues/376)
|
||||
- Consider using the resource name as a common shared set of resources [\#373](https://github.com/elastic/cookbook-elasticsearch/issues/373)
|
||||
- Recreate deploying-elasticsearch-with-chef tutorial [\#293](https://github.com/elastic/cookbook-elasticsearch/issues/293)
|
||||
- Makes code examples have color [\#396](https://github.com/elastic/cookbook-elasticsearch/pull/396) ([spuder](https://github.com/spuder))
|
||||
- Updates docs to show package are now default install [\#395](https://github.com/elastic/cookbook-elasticsearch/pull/395) ([spuder](https://github.com/spuder))
|
||||
|
||||
## [1.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/v1.2.0) (2015-10-16)
|
||||
|
||||
- Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/elastic/cookbook-elasticsearch/issues/379)
|
||||
- OS X Support [\#358](https://github.com/elastic/cookbook-elasticsearch/issues/358)
|
||||
- Dealing with plugin versions that don't match, Elasticsearch failing to start [\#330](https://github.com/elastic/cookbook-elasticsearch/issues/330)
|
||||
- ruby command not found [\#378](https://github.com/elastic/cookbook-elasticsearch/issues/378)
|
||||
- Update the README to remove a typo [\#381](https://github.com/elastic/cookbook-elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren))
|
||||
- Correct the full changelog links [\#375](https://github.com/elastic/cookbook-elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick))
|
||||
|
||||
## [1.0.3](https://github.com/elastic/cookbook-elasticsearch/tree/v1.0.3) (2015-09-20)
|
||||
|
||||
- 1.0.2 Issues with pid files [\#374](https://github.com/elastic/cookbook-elasticsearch/issues/374)
|
||||
|
||||
## [1.0.2](https://github.com/elastic/cookbook-elasticsearch/tree/v1.0.2) (2015-09-20)
|
||||
|
||||
- enhancement : attribut path\_xxx and path.xxx [\#352](https://github.com/elastic/cookbook-elasticsearch/issues/352)
|
||||
- It would be nice to be able to pass options to elasticsearch\_service [\#334](https://github.com/elastic/cookbook-elasticsearch/issues/334)
|
||||
- elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/elastic/cookbook-elasticsearch/issues/371)
|
||||
- Compile Error [\#370](https://github.com/elastic/cookbook-elasticsearch/issues/370)
|
||||
- wrong number of arguments \(1 for 0\) [\#369](https://github.com/elastic/cookbook-elasticsearch/issues/369)
|
||||
- missing chef resource expectations in specs in 1.0.1 [\#367](https://github.com/elastic/cookbook-elasticsearch/issues/367)
|
||||
- Rubocop & foodcritic cleanup [\#365](https://github.com/elastic/cookbook-elasticsearch/issues/365)
|
||||
- add missing matchers [\#368](https://github.com/elastic/cookbook-elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic))
|
||||
|
||||
## [1.0.1](https://github.com/elastic/cookbook-elasticsearch/tree/v1.0.1) (2015-09-15)
|
||||
|
||||
- Plugin resource's plugin\_dir should have a sensible default [\#345](https://github.com/elastic/cookbook-elasticsearch/issues/345)
|
||||
- Elasticsearch user homedir deleted [\#328](https://github.com/elastic/cookbook-elasticsearch/issues/328)
|
||||
- Use predictable attributes/values for version, download URL, and checksum [\#366](https://github.com/elastic/cookbook-elasticsearch/issues/366)
|
||||
- elasticsearch\_plugin installs plugins with the wrong permissions [\#363](https://github.com/elastic/cookbook-elasticsearch/issues/363)
|
||||
- Double-dependency on curl [\#360](https://github.com/elastic/cookbook-elasticsearch/issues/360)
|
||||
- poise dependency not found [\#356](https://github.com/elastic/cookbook-elasticsearch/issues/356)
|
||||
- Documentation for using JSON node configuration [\#355](https://github.com/elastic/cookbook-elasticsearch/issues/355)
|
||||
- Hardcoded checksums in library helpers [\#350](https://github.com/elastic/cookbook-elasticsearch/issues/350)
|
||||
- Document default values for all resources [\#348](https://github.com/elastic/cookbook-elasticsearch/issues/348)
|
||||
- 1.0 should have sensible documentation [\#344](https://github.com/elastic/cookbook-elasticsearch/issues/344)
|
||||
- Adds integration test for plugins in default environment [\#361](https://github.com/elastic/cookbook-elasticsearch/pull/361) ([bwvoss](https://github.com/bwvoss))
|
||||
- Clarify when overriding plugin\_dir is necessary [\#349](https://github.com/elastic/cookbook-elasticsearch/pull/349) ([michaelklishin](https://github.com/michaelklishin))
|
||||
- Remove duplicate node.max\_local\_storage\_nodes setting from the config template [\#346](https://github.com/elastic/cookbook-elasticsearch/pull/346) ([eheydrick](https://github.com/eheydrick))
|
||||
|
||||
## [v1.0.0](https://github.com/elastic/cookbook-elasticsearch/tree/v1.0.0) (2015-07-16)
|
||||
|
||||
- Rename source method of install [\#332](https://github.com/elastic/cookbook-elasticsearch/issues/332)
|
||||
- NEXT: Document the process for submitting PRs [\#270](https://github.com/elastic/cookbook-elasticsearch/issues/270)
|
||||
- Travis CI not running on PRs from local branches [\#337](https://github.com/elastic/cookbook-elasticsearch/issues/337)
|
||||
- Error executing action `install` on resource 'elasticsearch\_install' [\#335](https://github.com/elastic/cookbook-elasticsearch/issues/335)
|
||||
- Document requirement on Chef 12+ [\#338](https://github.com/elastic/cookbook-elasticsearch/issues/338)
|
||||
- Add lots of additional documentation [\#343](https://github.com/elastic/cookbook-elasticsearch/pull/343) ([martinb3](https://github.com/martinb3))
|
||||
- Add contribution guidelines [\#342](https://github.com/elastic/cookbook-elasticsearch/pull/342) ([martinb3](https://github.com/martinb3))
|
||||
- Run CI on master branch again, after rename [\#341](https://github.com/elastic/cookbook-elasticsearch/pull/341) ([martinb3](https://github.com/martinb3))
|
||||
- Rename provider source to tarball [\#340](https://github.com/elastic/cookbook-elasticsearch/pull/340) ([martinb3](https://github.com/martinb3))
|
||||
|
||||
## [v0.3.14](https://github.com/elastic/cookbook-elasticsearch/tree/v0.3.14) (2015-07-16)
|
||||
|
||||
- NEXT: Model YML config after 'trim' config [\#322](https://github.com/elastic/cookbook-elasticsearch/issues/322)
|
||||
- NEXT: Create a user resource and provider [\#269](https://github.com/elastic/cookbook-elasticsearch/issues/269)
|
||||
- If bootstrap.mlockall is true, MAX\_LOCKED\_MEMORY should be set to unlimited in elasticsearch-env.sh [\#266](https://github.com/elastic/cookbook-elasticsearch/issues/266)
|
||||
- Installation enhancement [\#222](https://github.com/elastic/cookbook-elasticsearch/issues/222)
|
||||
- Plugins defined in databag do not get installed [\#89](https://github.com/elastic/cookbook-elasticsearch/issues/89)
|
||||
- There is no customize recipe [\#326](https://github.com/elastic/cookbook-elasticsearch/issues/326)
|
||||
- ES not starting when setting version to 1.5.2 or 1.6.0 [\#325](https://github.com/elastic/cookbook-elasticsearch/issues/325)
|
||||
- Question - Does cookbook support rolling restarts? [\#315](https://github.com/elastic/cookbook-elasticsearch/issues/315)
|
||||
- Loading attributes from the data DBI [\#313](https://github.com/elastic/cookbook-elasticsearch/issues/313)
|
||||
- 0.3.13: service doesn't successfully start [\#312](https://github.com/elastic/cookbook-elasticsearch/issues/312)
|
||||
- Restart doesn't work the first time if a stale PID exists [\#310](https://github.com/elastic/cookbook-elasticsearch/issues/310)
|
||||
- Cannot install plugin 2.4.1 [\#308](https://github.com/elastic/cookbook-elasticsearch/issues/308)
|
||||
- Proxy recipe should include nginx only based on configurabe attribute [\#307](https://github.com/elastic/cookbook-elasticsearch/issues/307)
|
||||
- Queue capacity [\#301](https://github.com/elastic/cookbook-elasticsearch/issues/301)
|
||||
- strange behavior with docker :bug: [\#300](https://github.com/elastic/cookbook-elasticsearch/issues/300)
|
||||
- Vagrant: Undefined method 'provider' [\#298](https://github.com/elastic/cookbook-elasticsearch/issues/298)
|
||||
- Error after upgrading the cookbook [\#297](https://github.com/elastic/cookbook-elasticsearch/issues/297)
|
||||
- Setting version triggers java.lang.NoClassDefFoundError [\#296](https://github.com/elastic/cookbook-elasticsearch/issues/296)
|
||||
- Elasticsearch running but not from service [\#290](https://github.com/elastic/cookbook-elasticsearch/issues/290)
|
||||
- Elasticsearch throws ElasticsearchIllegalStateException on boot \(time based instance\) [\#288](https://github.com/elastic/cookbook-elasticsearch/issues/288)
|
||||
- Prefix Definitions [\#285](https://github.com/elastic/cookbook-elasticsearch/issues/285)
|
||||
- strange thinks happend if I override elasticsearch version [\#283](https://github.com/elastic/cookbook-elasticsearch/issues/283)
|
||||
- Chef::Mixin::Template::TemplateError on new ssl attributes [\#281](https://github.com/elastic/cookbook-elasticsearch/issues/281)
|
||||
- The 0.3.13 release is missing the metadata.rb file [\#279](https://github.com/elastic/cookbook-elasticsearch/issues/279)
|
||||
- berks upload fails due to .DS\_Store files found in 0.3.12 package on supermarket.chef.io [\#278](https://github.com/elastic/cookbook-elasticsearch/issues/278)
|
||||
- 0.3.11 release [\#277](https://github.com/elastic/cookbook-elasticsearch/issues/277)
|
||||
- Berkshelf treats 'recommends' as 'depends' [\#275](https://github.com/elastic/cookbook-elasticsearch/issues/275)
|
||||
- Init Script + Existing PID File [\#274](https://github.com/elastic/cookbook-elasticsearch/issues/274)
|
||||
- Version change doesn't work [\#273](https://github.com/elastic/cookbook-elasticsearch/issues/273)
|
||||
- Please add an option to specify the desired shell to pass to the su command [\#260](https://github.com/elastic/cookbook-elasticsearch/issues/260)
|
||||
- Attaching EBS takes a very long time and doesn't finish? [\#259](https://github.com/elastic/cookbook-elasticsearch/issues/259)
|
||||
- 1.3.4 startup hangs for 10min and fails [\#257](https://github.com/elastic/cookbook-elasticsearch/issues/257)
|
||||
- Plugin installation skipping [\#252](https://github.com/elastic/cookbook-elasticsearch/issues/252)
|
||||
- Can't get Rake task to work \(either dependencies or installing Berkshelf\) [\#244](https://github.com/elastic/cookbook-elasticsearch/issues/244)
|
||||
- Don't include build-essential just to be sure apt is up to date [\#241](https://github.com/elastic/cookbook-elasticsearch/issues/241)
|
||||
- how to specify max\_map\_count? [\#239](https://github.com/elastic/cookbook-elasticsearch/issues/239)
|
||||
- Nginx HTTP, Basic Auth and multiple nodes [\#238](https://github.com/elastic/cookbook-elasticsearch/issues/238)
|
||||
- Installing Marvel [\#237](https://github.com/elastic/cookbook-elasticsearch/issues/237)
|
||||
- Need help with creating EBS Volume [\#223](https://github.com/elastic/cookbook-elasticsearch/issues/223)
|
||||
- If elasticsearch fails to extract, it won't be installed later [\#221](https://github.com/elastic/cookbook-elasticsearch/issues/221)
|
||||
- uninitialized constant Extensions during Vagrant provisioning [\#212](https://github.com/elastic/cookbook-elasticsearch/issues/212)
|
||||
- config.vm.provider not recognised using Vagrant 1.5.4 [\#207](https://github.com/elastic/cookbook-elasticsearch/issues/207)
|
||||
- The Vagrant installation instructions are outdated [\#206](https://github.com/elastic/cookbook-elasticsearch/issues/206)
|
||||
- How to specify path.data and path.logs? [\#202](https://github.com/elastic/cookbook-elasticsearch/issues/202)
|
||||
- Cannot upgrade from 0.0.92 to 1.0.1 [\#197](https://github.com/elastic/cookbook-elasticsearch/issues/197)
|
||||
- install\_plugin fails to run on initial install [\#176](https://github.com/elastic/cookbook-elasticsearch/issues/176)
|
||||
- EBS volume clean up [\#172](https://github.com/elastic/cookbook-elasticsearch/issues/172)
|
||||
- Cookbook default attributes get lifted to normal priority [\#168](https://github.com/elastic/cookbook-elasticsearch/issues/168)
|
||||
- Fog doesn't respect "delete\_on\_termination" option in elasticsearch::ebs [\#146](https://github.com/elastic/cookbook-elasticsearch/issues/146)
|
||||
- Use package options on both providers [\#336](https://github.com/elastic/cookbook-elasticsearch/pull/336) ([martinb3](https://github.com/martinb3))
|
||||
- allow options passing to package provider [\#329](https://github.com/elastic/cookbook-elasticsearch/pull/329) ([scalp42](https://github.com/scalp42))
|
||||
- set default resource actions [\#327](https://github.com/elastic/cookbook-elasticsearch/pull/327) ([nathwill](https://github.com/nathwill))
|
||||
- Add a note about `next` branch [\#324](https://github.com/elastic/cookbook-elasticsearch/pull/324) ([martinb3](https://github.com/martinb3))
|
||||
- Introduce provider and resource for configure [\#316](https://github.com/elastic/cookbook-elasticsearch/pull/316) ([martinb3](https://github.com/martinb3))
|
||||
- First pass at install resource and two providers [\#309](https://github.com/elastic/cookbook-elasticsearch/pull/309) ([martinb3](https://github.com/martinb3))
|
||||
|
||||
## [v0.3.13](https://github.com/elastic/cookbook-elasticsearch/tree/v0.3.13) (2015-01-13)
|
||||
|
||||
## [0.3.12](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.12) (2015-01-13)
|
||||
|
||||
- Guidance On Upgrading A Running ES Installation [\#271](https://github.com/elastic/cookbook-elasticsearch/issues/271)
|
||||
- Supermarket release? [\#262](https://github.com/elastic/cookbook-elasticsearch/issues/262)
|
||||
- version check always adds '-d' flag incorrectly. [\#255](https://github.com/elastic/cookbook-elasticsearch/issues/255)
|
||||
- Version 0.3.11 not available on supermarket [\#250](https://github.com/elastic/cookbook-elasticsearch/issues/250)
|
||||
- Missed multicast settings in template [\#248](https://github.com/elastic/cookbook-elasticsearch/issues/248)
|
||||
- Data bags for test? [\#246](https://github.com/elastic/cookbook-elasticsearch/issues/246)
|
||||
- Introduce user provider and resource [\#268](https://github.com/elastic/cookbook-elasticsearch/pull/268) ([martinb3](https://github.com/martinb3))
|
||||
- First pass at framework with testing, rake, etc [\#249](https://github.com/elastic/cookbook-elasticsearch/pull/249) ([martinb3](https://github.com/martinb3))
|
||||
|
||||
## [0.3.11](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.11) (2014-10-13)
|
||||
|
||||
- The init script should use the Chef embedded Ruby? [\#215](https://github.com/elastic/cookbook-elasticsearch/issues/215)
|
||||
- Quick Fix for version update issues [\#178](https://github.com/elastic/cookbook-elasticsearch/issues/178)
|
||||
- Don't seem to be able to change the version [\#100](https://github.com/elastic/cookbook-elasticsearch/issues/100)
|
||||
- Multiple EBS mounting [\#232](https://github.com/elastic/cookbook-elasticsearch/issues/232)
|
||||
- Just changing elasticsearch version attribute doesn't install intended version [\#225](https://github.com/elastic/cookbook-elasticsearch/issues/225)
|
||||
- plugins not being loaded [\#171](https://github.com/elastic/cookbook-elasticsearch/issues/171)
|
||||
|
||||
## [0.3.10](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.10) (2014-06-19)
|
||||
|
||||
- Single node cofiguration [\#220](https://github.com/elastic/cookbook-elasticsearch/issues/220)
|
||||
- can we use apt\_repository resource to install a particular version [\#217](https://github.com/elastic/cookbook-elasticsearch/issues/217)
|
||||
- Version attribute effect on download\_url is misleading [\#214](https://github.com/elastic/cookbook-elasticsearch/issues/214)
|
||||
- Make config template configurable [\#153](https://github.com/elastic/cookbook-elasticsearch/issues/153)
|
||||
|
||||
## [0.3.9](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.9) (2014-05-22)
|
||||
|
||||
- 1.1.1 doesn't work [\#210](https://github.com/elastic/cookbook-elasticsearch/issues/210)
|
||||
- Why does this cookbook set the es max heap size to 60% of available memory? [\#209](https://github.com/elastic/cookbook-elasticsearch/issues/209)
|
||||
- Failure when adding elasticsearch service [\#204](https://github.com/elastic/cookbook-elasticsearch/issues/204)
|
||||
- New release? [\#203](https://github.com/elastic/cookbook-elasticsearch/issues/203)
|
||||
|
||||
## [0.3.8](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.8) (2014-03-27)
|
||||
|
||||
- Avoid using `recommends "monit"` in metadata.rb [\#162](https://github.com/elastic/cookbook-elasticsearch/issues/162)
|
||||
- Problem with ownership of pid in /var/run/ on restart of ubuntu [\#108](https://github.com/elastic/cookbook-elasticsearch/issues/108)
|
||||
- SSL support with Nginx proxy [\#226](https://github.com/elastic/cookbook-elasticsearch/issues/226)
|
||||
- Compatibility with 1.0.1 [\#195](https://github.com/elastic/cookbook-elasticsearch/issues/195)
|
||||
- pid\_path is owned by elasticsearch [\#193](https://github.com/elastic/cookbook-elasticsearch/issues/193)
|
||||
- \[Install plugin: merge!\] \(elasticsearch::plugins line 35\) [\#187](https://github.com/elastic/cookbook-elasticsearch/issues/187)
|
||||
- Cookbook doesn't work with 1.0.0RCx versions - Startup broken based on behavior change [\#185](https://github.com/elastic/cookbook-elasticsearch/issues/185)
|
||||
- Failure to locate 'elasticsearch.conf.erb' template [\#184](https://github.com/elastic/cookbook-elasticsearch/issues/184)
|
||||
- Question on attributes "methodology" [\#180](https://github.com/elastic/cookbook-elasticsearch/issues/180)
|
||||
- print\_value docs don't mention elasticsearch [\#169](https://github.com/elastic/cookbook-elasticsearch/issues/169)
|
||||
- update readme file with default attributes [\#166](https://github.com/elastic/cookbook-elasticsearch/issues/166)
|
||||
- Index template config files [\#164](https://github.com/elastic/cookbook-elasticsearch/issues/164)
|
||||
- Issues configuring unicast cluster [\#158](https://github.com/elastic/cookbook-elasticsearch/issues/158)
|
||||
- elasticsearch default /usr/local/elasticsearch is no good for elasticsearch-env.sh [\#157](https://github.com/elastic/cookbook-elasticsearch/issues/157)
|
||||
|
||||
## [0.3.7](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.7) (2013-10-28)
|
||||
|
||||
## [0.3.5](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.5) (2013-10-27)
|
||||
|
||||
- ES Logging Not Working [\#151](https://github.com/elastic/cookbook-elasticsearch/issues/151)
|
||||
- Adding Debian specific init script [\#98](https://github.com/elastic/cookbook-elasticsearch/pull/98) ([remkade](https://github.com/remkade))
|
||||
|
||||
## [0.3.4](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.4) (2013-10-01)
|
||||
|
||||
- first install with plugins fails [\#138](https://github.com/elastic/cookbook-elasticsearch/issues/138)
|
||||
- Custom Params for init.d start [\#134](https://github.com/elastic/cookbook-elasticsearch/issues/134)
|
||||
- elasticsearch-cloud-aws plugin - fails to install, restarts service anyway [\#131](https://github.com/elastic/cookbook-elasticsearch/issues/131)
|
||||
- init script - improvements needed [\#130](https://github.com/elastic/cookbook-elasticsearch/issues/130)
|
||||
- Configure HTTP port range [\#129](https://github.com/elastic/cookbook-elasticsearch/issues/129)
|
||||
- Elasticsearch fails to start with 0.90.3 and cloud-aws 1.12.0 [\#126](https://github.com/elastic/cookbook-elasticsearch/issues/126)
|
||||
- Install plugin failure does not stop script execution [\#124](https://github.com/elastic/cookbook-elasticsearch/issues/124)
|
||||
- search\_discovery causes unnecessary restarts [\#122](https://github.com/elastic/cookbook-elasticsearch/issues/122)
|
||||
- chef-solo needs the 'cookbook' folder to have the same name as the cookbook [\#121](https://github.com/elastic/cookbook-elasticsearch/issues/121)
|
||||
- Plugins not working if aws recipe is used [\#105](https://github.com/elastic/cookbook-elasticsearch/issues/105)
|
||||
|
||||
## [0.3.3](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.3) (2013-08-01)
|
||||
|
||||
- BREAKING: Fog version does not create EBS volumes properly [\#94](https://github.com/elastic/cookbook-elasticsearch/issues/94)
|
||||
- ulimit settings not used with start-stop-daemon [\#109](https://github.com/elastic/cookbook-elasticsearch/issues/109)
|
||||
- mismatch in aws endpoint attributes [\#106](https://github.com/elastic/cookbook-elasticsearch/issues/106)
|
||||
- Elasticsearch service restart at each chef run [\#104](https://github.com/elastic/cookbook-elasticsearch/issues/104)
|
||||
- Installation fails: Error executing action `start` on resource 'service\[elasticsearch\]' [\#96](https://github.com/elastic/cookbook-elasticsearch/issues/96)
|
||||
|
||||
## [0.3.2](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.2) (2013-08-01)
|
||||
|
||||
- role attributes ignored? [\#112](https://github.com/elastic/cookbook-elasticsearch/issues/112)
|
||||
- Mismatched Data Dir permissions [\#111](https://github.com/elastic/cookbook-elasticsearch/issues/111)
|
||||
- Changing nofile attribute is not idempotent [\#101](https://github.com/elastic/cookbook-elasticsearch/issues/101)
|
||||
- Configure unicast\_hosts dynamically on non-AWS clusters via `search` [\#40](https://github.com/elastic/cookbook-elasticsearch/issues/40)
|
||||
|
||||
## [0.3.1](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.1) (2013-06-18)
|
||||
|
||||
## [0.3.0](https://github.com/elastic/cookbook-elasticsearch/tree/0.3.0) (2013-06-10)
|
||||
|
||||
- Fog \>= 1.11.0 breaks run with elasticsearch::ebs [\#93](https://github.com/elastic/cookbook-elasticsearch/issues/93)
|
||||
- elasticsearch::ebs fails if apt package cache is out of date [\#88](https://github.com/elastic/cookbook-elasticsearch/issues/88)
|
||||
- Document bare minimum configuration for default recipe [\#87](https://github.com/elastic/cookbook-elasticsearch/issues/87)
|
||||
- Centos 5 / RHEL 5 Support [\#86](https://github.com/elastic/cookbook-elasticsearch/issues/86)
|
||||
- Proxy recipe has hardcoded localhost which fails if elasticsearch is not bound to that IP [\#85](https://github.com/elastic/cookbook-elasticsearch/issues/85)
|
||||
- AJAX requests and nginx proxy [\#84](https://github.com/elastic/cookbook-elasticsearch/issues/84)
|
||||
- Readme link to Chef-solo+elasticsearch tutorial doesn't work [\#83](https://github.com/elastic/cookbook-elasticsearch/issues/83)
|
||||
- You must set ES\_CLASSPATH var [\#82](https://github.com/elastic/cookbook-elasticsearch/issues/82)
|
||||
- Setting a custom installation directory doesn't work [\#79](https://github.com/elastic/cookbook-elasticsearch/issues/79)
|
||||
|
||||
## [0.2.7](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.7) (2013-03-18)
|
||||
|
||||
## [0.2.6](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.6) (2013-03-08)
|
||||
|
||||
- Broken attempted aws plugin installation by default [\#76](https://github.com/elastic/cookbook-elasticsearch/issues/76)
|
||||
- Using setup with ELB [\#70](https://github.com/elastic/cookbook-elasticsearch/issues/70)
|
||||
|
||||
## [0.2.5](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.5) (2013-03-01)
|
||||
|
||||
- Elasticsearch with node.client set to true [\#71](https://github.com/elastic/cookbook-elasticsearch/issues/71)
|
||||
|
||||
## [0.2.4](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.4) (2013-02-27)
|
||||
|
||||
## [0.2.3](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.3) (2013-02-27)
|
||||
|
||||
- When updating versions, the wrong version can be installed unless you manually clear node attributes \(chef server only\) [\#69](https://github.com/elastic/cookbook-elasticsearch/issues/69)
|
||||
- The version of elasticsearch can only be set via elasticsearch/settings databag [\#68](https://github.com/elastic/cookbook-elasticsearch/issues/68)
|
||||
|
||||
## [0.2.2](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.2) (2013-02-26)
|
||||
|
||||
## [0.2.1](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.1) (2013-02-26)
|
||||
|
||||
- Unable to change elasticsearch version via role and version tag [\#61](https://github.com/elastic/cookbook-elasticsearch/issues/61)
|
||||
- Creating new ebs volume is taking forever [\#60](https://github.com/elastic/cookbook-elasticsearch/issues/60)
|
||||
|
||||
## [0.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/0.2.0) (2013-02-01)
|
||||
|
||||
- Failing installation test on master [\#56](https://github.com/elastic/cookbook-elasticsearch/issues/56)
|
||||
- Error message when running start script [\#48](https://github.com/elastic/cookbook-elasticsearch/issues/48)
|
||||
|
||||
## [0.1.0](https://github.com/elastic/cookbook-elasticsearch/tree/0.1.0) (2013-01-28)
|
||||
|
||||
## [0.0.1](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.1) (2013-01-28)
|
||||
|
||||
- Update Gists for Ark change [\#28](https://github.com/elastic/cookbook-elasticsearch/issues/28)
|
||||
- Conflict with nginx cookbook [\#46](https://github.com/elastic/cookbook-elasticsearch/issues/46)
|
||||
- version bump the metadata [\#42](https://github.com/elastic/cookbook-elasticsearch/issues/42)
|
||||
- elasticsearch::test doesn't work in ec2 with chef server [\#41](https://github.com/elastic/cookbook-elasticsearch/issues/41)
|
||||
- Nginx rpm install doesn't support chunkin module [\#38](https://github.com/elastic/cookbook-elasticsearch/issues/38)
|
||||
|
||||
## [0.0.6](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.6) (2013-01-15)
|
||||
|
||||
- Cannot find a resource for create\_ebs on amazon version 2012.09 [\#44](https://github.com/elastic/cookbook-elasticsearch/issues/44)
|
||||
|
||||
## [0.0.5](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.5) (2012-12-20)
|
||||
|
||||
- Add `discovery.ec2.tag` and similar to elasticsearch.yml [\#36](https://github.com/elastic/cookbook-elasticsearch/issues/36)
|
||||
- Add support for setting cloud.aws.region using node.json [\#33](https://github.com/elastic/cookbook-elasticsearch/issues/33)
|
||||
- Elasticsearch doesn't start after run 'sudo chef-client' over knife ssh [\#32](https://github.com/elastic/cookbook-elasticsearch/issues/32)
|
||||
- Can't find Monit template? [\#29](https://github.com/elastic/cookbook-elasticsearch/issues/29)
|
||||
- Monit doesn't start after machine reboot [\#14](https://github.com/elastic/cookbook-elasticsearch/issues/14)
|
||||
- Probable bugs in install\_plugin.rb [\#12](https://github.com/elastic/cookbook-elasticsearch/issues/12)
|
||||
|
||||
## [0.0.4](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.4) (2012-10-15)
|
||||
|
||||
## [0.0.3](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.3) (2012-10-14)
|
||||
|
||||
- min\_mem should be the same as max\_mem [\#35](https://github.com/elastic/cookbook-elasticsearch/issues/35)
|
||||
- The `elasticsearch::proxy\_nginx` should declare dependency on `nginx` cookbook [\#24](https://github.com/elastic/cookbook-elasticsearch/issues/24)
|
||||
- Appears to install nginx even in cases when it's not requested \(no proxy\) [\#23](https://github.com/elastic/cookbook-elasticsearch/issues/23)
|
||||
|
||||
## [0.0.2](https://github.com/elastic/cookbook-elasticsearch/tree/0.0.2) (2012-08-18)
|
||||
|
||||
- -Xss128k is too low [\#25](https://github.com/elastic/cookbook-elasticsearch/issues/25)
|
||||
- Ubuntu Tests Failing [\#22](https://github.com/elastic/cookbook-elasticsearch/issues/22)
|
||||
- getting an error trying to install plugin [\#21](https://github.com/elastic/cookbook-elasticsearch/issues/21)
|
||||
- you must set ES\_CLASSPATH [\#20](https://github.com/elastic/cookbook-elasticsearch/issues/20)
|
||||
- Need a more comprehensive max\_mem calculation [\#15](https://github.com/elastic/cookbook-elasticsearch/issues/15)
|
||||
- Missing support for status command of the elasticsearch service [\#11](https://github.com/elastic/cookbook-elasticsearch/issues/11)
|
||||
- Discovery settings in elasticsearch.yml.erb [\#9](https://github.com/elastic/cookbook-elasticsearch/issues/9)
|
||||
- Monit issues \(template file name, internal issues\) [\#8](https://github.com/elastic/cookbook-elasticsearch/issues/8)
|
||||
- Align elasticsearch-env.sh.erb with elasticsearch.in.sh [\#3](https://github.com/elastic/cookbook-elasticsearch/issues/3)
|
||||
111
cookbooks/elasticsearch/CONTRIBUTING.md
Normal file
111
cookbooks/elasticsearch/CONTRIBUTING.md
Normal file
@@ -0,0 +1,111 @@
|
||||
Contributing to cookbook-elasticsearch
|
||||
======================================
|
||||
|
||||
### General philosophy
|
||||
|
||||
We try, as much as possible, to mirror the upstream experience of installing, configuring, and running Elasticsearch. Sometimes, the upstream project won't expose certain settings, or provide defaults that everyone agrees with. Wherever possible, we will:
|
||||
|
||||
- follow the upstream standards for specific config files
|
||||
- include any files shipped with packages upstream in this cookbook as-is
|
||||
- expose a template and cookbook setting for any file that you might want to modify
|
||||
- recommend major changes to standard files be sent upstream first
|
||||
- minimize the number of exceptions and maintained "workarounds" in this cookbook
|
||||
|
||||
### Workflow for contributing
|
||||
|
||||
1. Create a branch directly in this repo or a fork (if you don't have push access). Please name branches within this repository `<github username>/<description>`. For example, something like karmi/install_from_deb.
|
||||
|
||||
1. Create an issue or open a PR. If you aren't sure your PR will solve the issue, or may be controversial, we commend opening an issue separately and linking to it in your PR, so that if the PR is not accepted, the issue will remain and be tracked.
|
||||
|
||||
1. Close (and reference) issues by the `closes #XXX` or `fixes #XXX` notation in the commit message. Please use a descriptive, useful commit message that could be used to understand why a particular change was made.
|
||||
|
||||
1. Keep pushing commits to the initial branch, `--amend`-ing if necessary. Please don't mix fixing unrelated issues in a single branch.
|
||||
|
||||
1. When everything is ready for merge, clean up the branch (rebase with master to synchronize, squash, edit commits, etc) to prepare for it to be merged.
|
||||
|
||||
### Merging contributions
|
||||
|
||||
1. After reviewing commits for documentation, passing CI tests, and good descriptive commit messages, merge it with --no-ff switch, so it's indicated in the Git history
|
||||
|
||||
1. Do not use the Github "merge button", since it doesn't do a fast-forward merge (see previous item).
|
||||
|
||||
### Testing
|
||||
|
||||
This cookbook is equipped with both unit tests (chefspec) and integration tests
|
||||
(test-kitchen and serverspec). It also comes with rubocop and foodcritic tasks
|
||||
in the supplied Rakefile. Contributions to this cookbook should include tests
|
||||
for new features or bugfixes, with a preference for unit tests over integration
|
||||
tests to ensure speedy testing runs. ***All tests and most other commands here
|
||||
should be run using bundler*** and our standard Gemfile. This ensures that
|
||||
contributions and changes are made in a standardized way against the same
|
||||
versions of gems. We recommend installing rubygems-bundler so that bundler is
|
||||
automatically inserting `bundle exec` in front of commands run in a directory
|
||||
that contains a Gemfile.
|
||||
|
||||
A full test run of all tests and style checks would look like:
|
||||
```bash
|
||||
$ bundle exec rake style
|
||||
$ bundle exec rake spec
|
||||
$ bundle exec rake integration
|
||||
$ bundle exec rake destroy
|
||||
```
|
||||
The final destroy is intended to clean up any systems that failed a test, and is
|
||||
mostly useful when running with kitchen drivers for cloud providers, so that no
|
||||
machines are left orphaned and costing you money.
|
||||
|
||||
#### Fixtures
|
||||
|
||||
This cookbook supplies a few different test fixtures (under `test/fixtures/`)
|
||||
that can be shared amongst any number of unit or integration tests: cookbooks,
|
||||
environments, and nodes. Environments and nodes are automatically loaded into
|
||||
chef-zero for both chefspec tests that run locally and serverspec tests that run
|
||||
from test-kitchen.
|
||||
|
||||
It also contains 'platform data' that can be used to drive unit testing, for
|
||||
example, you might read `httpd` for some platforms and `apache2` for others,
|
||||
allowing you to write a single test for the Apache webserver. Unfortunately,
|
||||
without further modifications to `busser` and `busser-serverspec`, the platform
|
||||
data will not be available to serverspec tests.
|
||||
|
||||
#### Style and Best Practices
|
||||
|
||||
Rubocop and Foodcritic evaluations may be made by running `rake style`. There
|
||||
are no overrides for foodcritic rules, however the adjustments to
|
||||
rubocop are made using the supplied `.rubocop.yml` file and have been documented
|
||||
by comments within. Most notably, rubocop has been restricted to only apply to
|
||||
`.rb` files.
|
||||
|
||||
Rubocop and foodcritic tests can be executed using `rake style`.
|
||||
|
||||
#### Unit testing
|
||||
|
||||
Unit testing is done using the latest versions of Chefspec. The current default
|
||||
test layout includes running against all supported platforms, as well as
|
||||
stubbing data into chef-zero. This allows us to also test against chef search.
|
||||
As is currently a best practice in the community, we will avoid the use of
|
||||
chef-solo, but not create barriers to explicitly fail for chef-solo.
|
||||
|
||||
Unit tests can be executed using `rake spec`.
|
||||
|
||||
#### Integration testing
|
||||
|
||||
Integration testing is accomplished using the latest versions of test-kitchen
|
||||
and serverspec. Currently, this cookbook uses the busser-serverspec plugin for
|
||||
copying serverspec files to the system being tested. There is some debate in the
|
||||
community about whether this should be done using busser-rspec instead, and each
|
||||
busser plugin has a slightly different feature set.
|
||||
|
||||
While the default test-kitchen configuration uses the vagrant driver, you may
|
||||
override this using `~/.kitchen/config.yml` or by placing a `.kitchen.local.yml`
|
||||
in the current directory. This allows you to run these integration tests using
|
||||
any supported test-kitchen driver (ec2, rackspace, docker, etc).
|
||||
|
||||
Integration tests can be executed using `rake integration` or `kitchen test`.
|
||||
|
||||
### Releasing
|
||||
|
||||
1. Create/update the changelog. We are using the `github_changelog_generator`
|
||||
gem.
|
||||
|
||||
1. We highly recommend using the `stove` project, which pushes cookbooks to
|
||||
Supermarket and tags to Github.
|
||||
394
cookbooks/elasticsearch/README.md
Normal file
394
cookbooks/elasticsearch/README.md
Normal file
@@ -0,0 +1,394 @@
|
||||
# Elasticsearch Chef Cookbook
|
||||
|
||||
[](https://travis-ci.org/elastic/cookbook-elasticsearch) [](https://supermarket.chef.io/cookbooks/elasticsearch)[](https://jenkins-01.eastus.cloudapp.azure.com/job/elasticsearch-cookbook/)
|
||||
|
||||
**Please** review the [frequently asked questions](FAQ.md) and [contributing guidelines](CONTRIBUTING.md) before opening issues or submitting pull requests.
|
||||
|
||||
## Looking for Elasticsearch 5.x or 6.x?
|
||||
|
||||
Please [check out the previous 3.x.x releases](https://github.com/elastic/cookbook-elasticsearch/tree/3.x.x) of this cookbook. Please consider pinning your cookbook to '~> 3.0' for support for Elasticsearch 6 and earlier, or '~> 4.0' release for Elasticsearch 6 and beyond.
|
||||
|
||||
## Attributes
|
||||
|
||||
Please consult [attributes/default.rb](attributes/default.rb) for a large list
|
||||
of checksums for many different archives and package files of different
|
||||
elasticsearch versions. Both recipes and resources/providers here use those
|
||||
default values.
|
||||
|
||||
You may use `%s` in your URL and this cookbook will use sprintf/format to insert
|
||||
the version parameter as a string into your download_url.
|
||||
|
||||
|Name|Default|Other values|
|
||||
|----|-------|------------|
|
||||
| For Elasticsearch < 7: ||
|
||||
|`default['elasticsearch']['download_urls']['debian']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
|`default['elasticsearch']['download_urls']['rhel']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
|`default['elasticsearch']['download_urls']['tarball']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
| For Elasticsearch >= 7: ||
|
||||
|`default['elasticsearch']['download_urls_v7']['debian']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
|`default['elasticsearch']['download_urls_v7']['rhel']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
|`default['elasticsearch']['download_urls_v7']['tarball']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|
|
||||
|
||||
This cookbook's `elasticsearch::default` recipe also supports setting any `elasticsearch_` resource using attributes:
|
||||
|
||||
```
|
||||
default['elasticsearch']['user'] = {}
|
||||
default['elasticsearch']['install'] = {}
|
||||
default['elasticsearch']['configure'] = {}
|
||||
default['elasticsearch']['service'] = {}
|
||||
default['elasticsearch']['plugin'] = {}
|
||||
```
|
||||
|
||||
For example, this will pass a username 'foo' to `elasticsearch_user` and set a uid to `1234`:
|
||||
```
|
||||
default['elasticsearch']['user']['username'] = 'foo'
|
||||
default['elasticsearch']['user']['uid'] = '1234'
|
||||
```
|
||||
|
||||
## Recipes
|
||||
|
||||
Resources are the intended way to consume this cookbook, however we have
|
||||
provided a single recipe that configures Elasticsearch by downloading an archive
|
||||
containing a distribution of Elasticsearch, and extracting that into `/usr/share`.
|
||||
|
||||
See the attributes section above to for what defaults you can adjust.
|
||||
|
||||
### default
|
||||
|
||||
The default recipe creates an elasticsearch user, group, package installation,
|
||||
configuration files, and service with all of the default options.
|
||||
|
||||
Please note that there are [additional examples within the test fixtures](test/fixtures/cookbooks/elasticsearch_test),
|
||||
including a demonstration of how to configure two instances of Elasticsearch on a single server.
|
||||
|
||||
## Resources
|
||||
|
||||
## Notifications and Service Start/Restart
|
||||
|
||||
The resources provided in this cookbook **do not automatically restart** services when changes have occurred. They ***do start services by default when configuring a new service*** This has been done to protect you from accidental data loss and service outages, as nodes might restart simultaneously or may not restart at all when bad configuration values are supplied.
|
||||
|
||||
elasticsearch_service has a special `service_actions` parameter you can use to specify what state the underlying service should be in on each chef run (defaults to `:enabled` and `:started`). It will also pass through all of the standard `service` resource
|
||||
actions to the underlying service resource if you wish to notify it.
|
||||
|
||||
You **must** supply your desired notifications when using each resource if you want Chef to automatically restart services. Again, we don't recommend this unless you know what you're doing.
|
||||
|
||||
We are supporting whyrun mode in this cookbook, simply because we're using all builtin resources from core Chef, and these also already support whyrun. If you contribute to this cookbook, please be sure to maintain that or guard dangerous Ruby code with something like `if !whyrun_mode? || nested_resource.whyrun_supported?`.
|
||||
|
||||
### Resource names
|
||||
|
||||
Many of the resources provided in this cookbook need to share configuration
|
||||
values. For example, the `elasticsearch_service` resource needs to know the path
|
||||
to the configuration file(s) generated by `elasticsearch_configure` and the path
|
||||
to the actual ES binary installed by `elasticsearch_install`. And they both need
|
||||
to know the appropriate system user and group defined by `elasticsearch_user`.
|
||||
|
||||
Search order: In order to make this easy, all resources in this cookbook use the following
|
||||
search order to locate resources that apply to the same overall
|
||||
Elasticsearch setup:
|
||||
|
||||
1. Resources that share the same resource name
|
||||
1. Resources that share the same value for `instance_name`
|
||||
1. Resources named `default` or resources named `elasticsearch`
|
||||
- This fails if both `default` and `elasticsearch` resources exist
|
||||
|
||||
Examples of more complicated resource names are left to the reader, but here we
|
||||
present a typical example that should work in most cases:
|
||||
|
||||
```ruby
|
||||
elasticsearch_user 'elasticsearch'
|
||||
elasticsearch_install 'elasticsearch'
|
||||
elasticsearch_configure 'elasticsearch'
|
||||
elasticsearch_service 'elasticsearch'
|
||||
elasticsearch_plugin 'x-pack'
|
||||
```
|
||||
|
||||
### elasticsearch_user
|
||||
Actions: `:create`, `:remove`
|
||||
|
||||
Creates a user and group on the system for use by elasticsearch. Here is an
|
||||
example with many of the default options and default values (all options except
|
||||
a resource name may be omitted).
|
||||
|
||||
Examples:
|
||||
|
||||
```ruby
|
||||
elasticsearch_user 'elasticsearch'
|
||||
```
|
||||
|
||||
```ruby
|
||||
elasticsearch_user 'elasticsearch' do
|
||||
username 'elasticsearch'
|
||||
groupname 'elasticsearch'
|
||||
shell '/bin/bash'
|
||||
comment 'Elasticsearch User'
|
||||
|
||||
action :create
|
||||
end
|
||||
```
|
||||
|
||||
### elasticsearch_install
|
||||
Actions: `:install`, `:remove`
|
||||
|
||||
Downloads the elasticsearch software, and unpacks it on the system. There are
|
||||
currently three ways to install -- `'repository'` (the default), which creates an
|
||||
apt or yum repo and installs from there, `'package'`, which downloads the appropriate
|
||||
package from elasticsearch.org and uses the package manager to install it, and
|
||||
`'tarball'` which downloads a tarball from elasticsearch.org and unpacks it.
|
||||
This resource also comes with a `:remove` action which will remove the package
|
||||
or directory elasticsearch was unpacked into.
|
||||
|
||||
You may always specify a download_url and/or download_checksum, and you may
|
||||
include `%s` which will be replaced by the version parameter you supply.
|
||||
|
||||
Please be sure to consult the above attribute section as that controls how
|
||||
Elasticsearch version, download URL and checksum are determined if you omit
|
||||
them.
|
||||
|
||||
**NOTE**: The `:remove` action has not been implemented yet. Pull requests are
|
||||
very much welcome & encouraged, if you'd like to see this feature.
|
||||
|
||||
Examples:
|
||||
|
||||
```ruby
|
||||
elasticsearch_install 'elasticsearch'
|
||||
```
|
||||
|
||||
```ruby
|
||||
elasticsearch_install 'my_es_installation' do
|
||||
type 'package' # type of install
|
||||
version '7.3.0'
|
||||
action :install # could be :remove as well
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
elasticsearch_install 'my_es_installation' do
|
||||
type 'tarball' # type of install
|
||||
dir '/usr/local' # where to install
|
||||
|
||||
download_url "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz"
|
||||
# sha256
|
||||
download_checksum "6f81935e270c403681e120ec4395c28b2ddc87e659ff7784608b86beb5223dd2"
|
||||
|
||||
action :install # could be :remove as well
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
elasticsearch_install 'my_es_installation' do
|
||||
type 'tarball' # type of install
|
||||
version '7.3.0'
|
||||
action :install # could be :remove as well
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
elasticsearch_install 'my_es_installation' do
|
||||
type 'package' # type of install
|
||||
download_url "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb"
|
||||
# sha256
|
||||
download_checksum "791fb9f2131be2cf8c1f86ca35e0b912d7155a53f89c2df67467ca2105e77ec2"
|
||||
instance_name 'elasticsearch'
|
||||
action :install # could be :remove as well
|
||||
end
|
||||
```
|
||||
|
||||
### elasticsearch_configure
|
||||
Actions: `:manage`, `:remove`
|
||||
|
||||
Configures an elasticsearch instance; creates directories for configuration,
|
||||
logs, and data. Writes files `log4j2.properties`, `elasticsearch.in.sh` and
|
||||
`elasticsearch.yml`.
|
||||
|
||||
The main attribute for this resource is `configuration`,
|
||||
which is a hash of any elasticsearch configuration directives. The
|
||||
other important attribute is `default_configuration` -- this contains the
|
||||
minimal set of required defaults.
|
||||
|
||||
Note that these are both _not_ a Chef mash, everything must be in a single level
|
||||
of keys and values. Any settings you pass in configuration will be merged into
|
||||
(and potentially overwrite) any default settings.
|
||||
|
||||
See the examples, [as well as the attributes in the resource file](libraries/resource_configure.rb),
|
||||
for more.
|
||||
|
||||
Examples:
|
||||
|
||||
With all defaults -
|
||||
```ruby
|
||||
elasticsearch_configure 'elasticsearch'
|
||||
```
|
||||
|
||||
With mostly defaults -
|
||||
```ruby
|
||||
elasticsearch_configure 'elasticsearch' do
|
||||
allocated_memory '512m'
|
||||
configuration ({
|
||||
'cluster.name' => 'escluster',
|
||||
'node.name' => 'node01',
|
||||
'http.port' => 9201
|
||||
})
|
||||
end
|
||||
```
|
||||
|
||||
Very complicated -
|
||||
```ruby
|
||||
elasticsearch_configure 'my_elasticsearch' do
|
||||
# if you override one of these, you probably want to override all
|
||||
path_home "/opt/elasticsearch"
|
||||
path_conf "/etc/opt/elasticsearch"
|
||||
path_data "/var/opt/elasticsearch"
|
||||
path_logs "/var/log/elasticsearch"
|
||||
path_pid "/var/run/elasticsearch"
|
||||
path_plugins "/opt/elasticsearch/plugins"
|
||||
path_bin "/opt/elasticsearch/bin"
|
||||
|
||||
# override logging parameters
|
||||
cookbook_log4j2_properties "my_wrapper_cookbook"
|
||||
template_log4j2_properties "my_log4j2.properties.erb"
|
||||
|
||||
logging({:"action" => 'INFO'})
|
||||
|
||||
allocated_memory '123m'
|
||||
|
||||
jvm_options %w(
|
||||
-XX:+UseParNewGC
|
||||
-XX:+UseConcMarkSweepGC
|
||||
-XX:CMSInitiatingOccupancyFraction=75
|
||||
-XX:+UseCMSInitiatingOccupancyOnly
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-XX:+PrintGCDetails
|
||||
)
|
||||
|
||||
configuration ({
|
||||
'node.name' => 'crazy'
|
||||
})
|
||||
|
||||
action :manage
|
||||
end
|
||||
```
|
||||
|
||||
### elasticsearch_service
|
||||
Actions: `:configure`, `:remove`
|
||||
|
||||
Writes out a system service configuration of the appropriate type, and enables
|
||||
it to start on boot. You can override almost all of the relevant settings in
|
||||
such a way that you may run multiple instances. Most settings will be taken from
|
||||
a matching `elasticsearch_config` resource in the collection.
|
||||
|
||||
```ruby
|
||||
elasticsearch_service 'elasticsearch'
|
||||
```
|
||||
|
||||
If you'd like to skip init scripts and systemd scripts, simply pass `nil` for
|
||||
the template file (init_source or systemd_source) and this cookbook will
|
||||
entirely skip trying to setup those scripts. Combined with changing the default
|
||||
service actions, this will have the same effect as `action :nothing`.
|
||||
|
||||
### elasticsearch_plugin
|
||||
Actions: `:install`, `:remove`
|
||||
|
||||
Installs or removes a plugin to a given elasticsearch instance and plugin
|
||||
directory. Please note that there is currently no way to upgrade an existing
|
||||
plugin using commandline tools, so we haven't exposed that feature here either.
|
||||
Furthermore, there isn't a way to determine if a plugin is compatible with ES or
|
||||
even what version it is. So once we install a plugin to a directory, we
|
||||
generally assume that is the desired one and we don't touch it further.
|
||||
|
||||
See https://github.com/elastic/cookbook-elasticsearch/issues/264 for more info.
|
||||
NB: You [may encounter issues on certain distros](http://blog.backslasher.net/java-ssl-crash.html) with NSS 3.16.1 and OpenJDK 7.x.
|
||||
|
||||
Officially supported or commercial plugins require just the plugin name:
|
||||
|
||||
```ruby
|
||||
elasticsearch_plugin 'analysis-icu' do
|
||||
action :install
|
||||
end
|
||||
elasticsearch_plugin 'shield' do
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
Plugins from GitHub require a URL of 'username/repository' or 'username/repository/version':
|
||||
|
||||
```ruby
|
||||
elasticsearch_plugin 'kopf' do
|
||||
url 'lmenezes/elasticsearch-kopf'
|
||||
action :install
|
||||
end
|
||||
|
||||
elasticsearch_plugin 'kopf' do
|
||||
url 'lmenezes/elasticsearch-kopf/1.5.7'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
Plugins from Maven Central or Sonatype require 'groupId/artifactId/version':
|
||||
```ruby
|
||||
elasticsearch_plugin 'mapper-attachments' do
|
||||
url 'org.elasticsearch/elasticsearch-mapper-attachments/2.6.0'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
Plugins can be installed from a custom URL or file location as follows:
|
||||
```ruby
|
||||
elasticsearch_plugin 'mapper-attachments' do
|
||||
url 'http://some.domain.name//my-plugin-1.0.0.zip'
|
||||
action :install
|
||||
end
|
||||
|
||||
elasticsearch_plugin 'mapper-attachments' do
|
||||
url 'file:/path/to/my-plugin-1.0.0.zip'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
The plugin resource respects the `https_proxy` or `http_proxy` (non-SSL)
|
||||
[Chef settings](https://docs.chef.io/config_rb_client.html) unless explicitly
|
||||
disabled using `chef_proxy false`:
|
||||
```ruby
|
||||
elasticsearch_plugin 'kopf' do
|
||||
url 'lmenezes/elasticsearch-kopf'
|
||||
chef_proxy false
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
To run multiple instances per machine, an explicit `plugin_dir` location
|
||||
has to be provided:
|
||||
|
||||
```ruby
|
||||
elasticsearch_plugin 'x-pack' do
|
||||
plugin_dir '/usr/share/elasticsearch_foo/plugins'
|
||||
end
|
||||
```
|
||||
|
||||
If for some reason, you want to name the resource something else, you may
|
||||
provide the true plugin name using the `plugin_name` parameter:
|
||||
|
||||
```ruby
|
||||
elasticsearch_plugin 'xyzzy' do
|
||||
plugin_name 'kopf'
|
||||
url 'lmenezes/elasticsearch-kopf'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This software is licensed under the Apache 2 license, quoted below.
|
||||
|
||||
Copyright (c) 2015 Elasticsearch <https://www.elastic.co/>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
169
cookbooks/elasticsearch/attributes/default.rb
Normal file
169
cookbooks/elasticsearch/attributes/default.rb
Normal file
@@ -0,0 +1,169 @@
|
||||
# empty settings (populate these for the elasticsearch::default recipe)
|
||||
# see the resources or README.md to see what you can pass here.
|
||||
default['elasticsearch']['user'] = {}
|
||||
default['elasticsearch']['install'] = {}
|
||||
default['elasticsearch']['configure'] = {}
|
||||
default['elasticsearch']['service'] = {}
|
||||
default['elasticsearch']['plugin'] = {}
|
||||
|
||||
# platform_family keyed download URLs
|
||||
default['elasticsearch']['download_urls'] = {
|
||||
'debian' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s.deb',
|
||||
'rhel' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s.rpm',
|
||||
'tarball' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s.tar.gz',
|
||||
}
|
||||
|
||||
default['elasticsearch']['download_urls_v7'] = {
|
||||
'debian' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s-amd64.deb',
|
||||
'rhel' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s-x86_64.rpm',
|
||||
'tarball' => 'https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-%s-linux-x86_64.tar.gz',
|
||||
}
|
||||
|
||||
# platform_family keyed download sha256 checksums
|
||||
default['elasticsearch']['checksums']['6.0.0']['debian'] = '28f38779156387c1db274d8d733429e574b54b4f518da6f0741f6276f8229939'
|
||||
default['elasticsearch']['checksums']['6.0.0']['rhel'] = '823fa8aa24e9948dea30f0a468f0403b34a62180e02ed752443d5964334c29a1'
|
||||
default['elasticsearch']['checksums']['6.0.0']['tarball'] = '0420e877a8b986485244f603770737e9e4e47186fdfa1093768a11e391e3d9f4'
|
||||
|
||||
default['elasticsearch']['checksums']['6.0.1']['debian'] = 'ebe6c14638a4909155fe409fb46a7f52bcd3ad2151bfd2f400ab6f8f61c45b3e'
|
||||
default['elasticsearch']['checksums']['6.0.1']['rhel'] = '25e7a8b152ea85886688398f48bc995d47cd2a12a7d98487748c6166f0732b85'
|
||||
default['elasticsearch']['checksums']['6.0.1']['tarball'] = 'efaf32aba41e1b7fd086639c0f062c39e1f28b360a78d5c2b8deed797a4c5c57'
|
||||
|
||||
default['elasticsearch']['checksums']['6.1.0']['debian'] = '102be4439b1df7f7606003b3c839dbf69d3827c3e996563c98c0d54560b4fc16'
|
||||
default['elasticsearch']['checksums']['6.1.0']['rhel'] = 'ebac1b4e1fc8ae3f7266cba93ef113510cba13435ada2c92480506d16cf6b865'
|
||||
default['elasticsearch']['checksums']['6.1.0']['tarball'] = 'c879fe2698635a2f132db4a02d84f657bc0ccdb5c5f68dda5102f9b2afa508d7'
|
||||
|
||||
default['elasticsearch']['checksums']['6.1.1']['debian'] = '8b6e65dce742c733aa61da24f9c8c0d4d4b7f53ae11d7f4168e98b5a0ed58b45'
|
||||
default['elasticsearch']['checksums']['6.1.1']['rhel'] = '9820555c72b61b54686bcf0697cdabace28b02315bb5a156999495a16b103d5a'
|
||||
default['elasticsearch']['checksums']['6.1.1']['tarball'] = '0cadc90c2ab1bd941e3965eef96fbc2c08b12b832ae81f5882e81505333b74b6'
|
||||
|
||||
default['elasticsearch']['checksums']['6.1.2']['debian'] = '64d8bd2bd895904bb91daff656764b10da93531f2011c94d7c779124e53dd5f5'
|
||||
default['elasticsearch']['checksums']['6.1.2']['rhel'] = 'bfa6809ac94bda92a4ec1bf601c8266f82a4c7842a7702da4dede8f7d5c6a2ec'
|
||||
default['elasticsearch']['checksums']['6.1.2']['tarball'] = '9c0eae0bdab78c59dac0ba3a9c054e6785dc0f5ce4666e284f42010a326abc0f'
|
||||
|
||||
default['elasticsearch']['checksums']['6.2.0']['debian'] = 'eeb974247ea4360e37798888a5f49227d5ea33e11665a060c9b01b25140f9554'
|
||||
default['elasticsearch']['checksums']['6.2.0']['rhel'] = '869b6506a35aad6b6d82fe987130402cef9b40c33ff7d98eeaa186eb2a628964'
|
||||
default['elasticsearch']['checksums']['6.2.0']['tarball'] = '7be4a6580aca7d17b2fe1a1e589aa0a005b6240ef5dce6a5288a56f68021f8f6'
|
||||
|
||||
default['elasticsearch']['checksums']['6.2.1']['debian'] = '2b145aa11bccd2fe99256b9715ff665fe091b62fc699bc77cd07c528dcbf2391'
|
||||
default['elasticsearch']['checksums']['6.2.1']['rhel'] = '47b97342821cbd1805826a18a7559a59bd045b9aef66e45c3b293b02aeaaeba8'
|
||||
default['elasticsearch']['checksums']['6.2.1']['tarball'] = '0ccd13c53d23dcb2aea5c0f71dcbe81283e1e31d6ae5d40dec03656852cb468b'
|
||||
|
||||
default['elasticsearch']['checksums']['6.2.2']['debian'] = 'e0a694dcbbac993a4039978ca60e6c05b0bd78ec7eef20a1e95b98979579a47a'
|
||||
default['elasticsearch']['checksums']['6.2.2']['rhel'] = 'a31277bb89b93da510bf40261882f710a448178ec5430c7a78ac77e91f733cf9'
|
||||
default['elasticsearch']['checksums']['6.2.2']['tarball'] = 'b26e3546784b39ce3eacc10411e68ada427c5764bcda3064e9bb284eca907983'
|
||||
|
||||
default['elasticsearch']['checksums']['6.2.3']['debian'] = 'b54a1b685656a1424d4956e48daed923752fc268b79bb1b8616cc91f6a78e3bb'
|
||||
default['elasticsearch']['checksums']['6.2.3']['rhel'] = 'd513a6f82436914c35e774529686e5fdfed1af77264e39228e5d64eee22c78ce'
|
||||
default['elasticsearch']['checksums']['6.2.3']['tarball'] = '01dd8dec5f0acf04336721e404bf4d075675a3acae9f2a9fdcdbb5ca11baca76'
|
||||
|
||||
default['elasticsearch']['checksums']['6.2.4']['debian'] = 'f9c889bf1e2e897a881f624dab6a4aa3be5ec1f9d65b6d115021095496351969'
|
||||
default['elasticsearch']['checksums']['6.2.4']['rhel'] = '9c13e0fb8bc90b7bd6e09c8ba922c2d89c2183bb6161047ec6549c0cbcccee72'
|
||||
default['elasticsearch']['checksums']['6.2.4']['tarball'] = '91e6f1ea1e1dd39011e7a703d2751ca46ee374665b08b0bfe17e0c0c27000e8e'
|
||||
|
||||
default['elasticsearch']['checksums']['6.3.0']['debian'] = '659c3f9a90ae5fe4568d5103de3bbd37e8a03143447118ee61fe72d514b8f4d6'
|
||||
default['elasticsearch']['checksums']['6.3.0']['rhel'] = 'b6d7951b8ad72c06e7a23263227e1b90b8aa6e5d5ee798a6c849934516121109'
|
||||
default['elasticsearch']['checksums']['6.3.0']['tarball'] = '0464127140820d82b24bd2830232131ea85bcd49267a8bc7365e4fa391dee2a3'
|
||||
|
||||
default['elasticsearch']['checksums']['6.3.1']['debian'] = '350cc95201814ec39b1c80bbb8329faf1dae20a3386b28b626144c6f67ced333'
|
||||
default['elasticsearch']['checksums']['6.3.1']['rhel'] = '073e2bc52a82bc099cca1534391a057c6506dbcb06e849e24ff4d60187ade4b3'
|
||||
default['elasticsearch']['checksums']['6.3.1']['tarball'] = '0b4d1c3c66894c9bf54284b53c1448d0e6def89a09c9fe4446e7167e51b8040e'
|
||||
|
||||
default['elasticsearch']['checksums']['6.4.0']['debian'] = 'dc7b4b5583ad4689f57369fb8bf8c9b708cfc278701c895762378b010460f658'
|
||||
default['elasticsearch']['checksums']['6.4.0']['rhel'] = 'b7b8e6265ec4a3aec509fe1e3fb054e6c64256ce7f4ab64d1d5b1629b24883c2'
|
||||
default['elasticsearch']['checksums']['6.4.0']['tarball'] = 'e9786efb5cecd12adee2807c7640ba9a1ab3b484d2e87497bb8d0b6df0e24f01'
|
||||
|
||||
default['elasticsearch']['checksums']['6.4.1']['debian'] = 'ba71dbe16bfb6111dbe7d49ffd447ed1092a754636b30214067d31ff3059e100'
|
||||
default['elasticsearch']['checksums']['6.4.1']['rhel'] = '2d63f9814ff67edc5c8a8e247ed359a8ef7e23cfbe3a438041a72b44b0be09b2'
|
||||
default['elasticsearch']['checksums']['6.4.1']['tarball'] = '6fce529465975b2cd2f5aef09b459006636e4b903e623fd6361ae9feeebf1542'
|
||||
|
||||
default['elasticsearch']['checksums']['6.4.2']['debian'] = '4ca2cc982db8e46743a98e2c3d678e60c24331b28f79ea424bb8a323e611f678'
|
||||
default['elasticsearch']['checksums']['6.4.2']['rhel'] = '8987285d92d0d94f0e842e51ba8ed04fb9ad5e078cc68f63ef2ff8ca1986ad08'
|
||||
default['elasticsearch']['checksums']['6.4.2']['tarball'] = '32a9c0305faed1cbd4e22c85a8c333ca2b6704f1d0006e92709fada10cec3f45'
|
||||
|
||||
default['elasticsearch']['checksums']['6.4.3']['debian'] = 'cbf62cf228e556ca89d94562cb747127da69f5a4a04198d1a19230455671d0d4'
|
||||
default['elasticsearch']['checksums']['6.4.3']['rhel'] = 'd059c695eadefc26788106a7d3d4c6b300bc50ede36dfbcb04b1caa9211d5bff'
|
||||
default['elasticsearch']['checksums']['6.4.3']['tarball'] = '861bc4d4188ce65df34a8876f104bbb2cddff3586990e57233e0847eb961b15e'
|
||||
|
||||
default['elasticsearch']['checksums']['6.5.0']['debian'] = '5fddd2759f7a96f884b0bfb863e04624ba50db39fa6455a87bef2b7bc4bff16e'
|
||||
default['elasticsearch']['checksums']['6.5.0']['rhel'] = 'b78a6d3ddb59d086f0da28a2e25d9e5f0b5af61f0fd2898ce972f7ca9e84f961'
|
||||
default['elasticsearch']['checksums']['6.5.0']['tarball'] = 'b158c02dddccc265d25855282015a7b09207c216be99c08114514ed283969b81'
|
||||
|
||||
default['elasticsearch']['checksums']['6.5.1']['debian'] = '7de183122a9dbb7b07ee56e18edf0365dc27e413a5962363b944a9aa63ffbb4a'
|
||||
default['elasticsearch']['checksums']['6.5.1']['rhel'] = 'fc38dcce176a96665c0801054794f62d8a9a23c9f930919248cfbe2622c7255e'
|
||||
default['elasticsearch']['checksums']['6.5.1']['tarball'] = '17cf2f58c7cbb36c4419a8143321660defe2c492b3a6eaa9a6dcd5e36347d124'
|
||||
|
||||
default['elasticsearch']['checksums']['6.5.2']['debian'] = '9cb0997dc6d2be16c988c0ee43ccafd19a8b2e757326af84f4cead40f74c614f'
|
||||
default['elasticsearch']['checksums']['6.5.2']['rhel'] = 'ddab10c3be94fb89bc7057bdb20624b5e65e3ba8244d655e243119a5103e07c7'
|
||||
default['elasticsearch']['checksums']['6.5.2']['tarball'] = 'b7b73b871957bdcff75d333eba8c1c6adf3731470f943b159365bde413e45dfc'
|
||||
|
||||
default['elasticsearch']['checksums']['6.5.3']['debian'] = '38b30461201fe8d126d124f04d961e7c037bea7a6fb9ca485c08e681d8d30456'
|
||||
default['elasticsearch']['checksums']['6.5.3']['rhel'] = '2f3eb7682e06211061bea90a0314a515f0c4ef683f45c8e57bfb1dfb14679c3a'
|
||||
default['elasticsearch']['checksums']['6.5.3']['tarball'] = 'cee4340dfaadf27d73ccaef5a8019e177021e1ffea3b7e622ca5ab9267725cac'
|
||||
|
||||
default['elasticsearch']['checksums']['6.5.4']['debian'] = 'c0a062ffb45f989cd3091c66f62605178c41c3735991d95506a6986a90924833'
|
||||
default['elasticsearch']['checksums']['6.5.4']['rhel'] = 'aa4006f754bd1a0bfaa338ba40d93a1762917c1862951577c62b1f073026b5ba'
|
||||
default['elasticsearch']['checksums']['6.5.4']['tarball'] = '762e25c036fa2e882cb7e91d83868fa15a1cad8549d279a8c5826a005bb31877'
|
||||
|
||||
default['elasticsearch']['checksums']['6.6.0']['debian'] = '0f34cd050bc2a6b4f3a4a8ea71755a03c638e1d929141424a246792e067534a9'
|
||||
default['elasticsearch']['checksums']['6.6.0']['rhel'] = '8fdaaefa22cef3370bdf353df09bf07695d0e3764ac0c9b6ad8a1412076f9566'
|
||||
default['elasticsearch']['checksums']['6.6.0']['tarball'] = '4993a17b88268a053042510404bcb808f86d6438fec458be4e0ef1c412681655'
|
||||
|
||||
default['elasticsearch']['checksums']['6.6.1']['debian'] = '505d5aae1c2ba66e36be41fe94ec9e4c444cbdd7926aaaa9392356a2c40d2102'
|
||||
default['elasticsearch']['checksums']['6.6.1']['rhel'] = '3ba9ef562c951eccd070704db498dcf703f05b567d459f93f144e9189e1ee21a'
|
||||
default['elasticsearch']['checksums']['6.6.1']['tarball'] = 'a4fd359facf03272013e3f2bffc846c1e1f8c60b7fb0daf856831f14947ed297'
|
||||
|
||||
default['elasticsearch']['checksums']['6.6.2']['debian'] = 'e5aa8b1449fb08b56ec5d9a52324cadd7439c29533fa7662badede051a9a9778'
|
||||
default['elasticsearch']['checksums']['6.6.2']['rhel'] = '8a42533764f0332e09cb6d2ed2af02a641766d73a3669458b20fe37615047872'
|
||||
default['elasticsearch']['checksums']['6.6.2']['tarball'] = 'f32d6fa73b466e29f30a5b6e0bcc6352a5508329f765c948c80c242ddfb97770'
|
||||
|
||||
default['elasticsearch']['checksums']['6.7.0']['debian'] = 'fdf31c8774b779cf5bf3c3f6e01371d11b5a3889ca3d9c3dbd2dc6142d96a633'
|
||||
default['elasticsearch']['checksums']['6.7.0']['rhel'] = 'e09010ab7cbf5c81f8821e25a6617de29bcc658a3c79750e337471ef4711d8b4'
|
||||
default['elasticsearch']['checksums']['6.7.0']['tarball'] = 'bed3587b892319d2e6b25d68c03930c95cf6d74210e3b368a638ca9f837a2315'
|
||||
|
||||
default['elasticsearch']['checksums']['6.7.1']['debian'] = '807223a278ffd29630f01a1c21ff268aa5b51ff36c66a2c56a7a8e275d102831'
|
||||
default['elasticsearch']['checksums']['6.7.1']['rhel'] = '88b6f4de17ea943ac996648783cd07471ee37b894d17bf17939d9a0cedb30237'
|
||||
default['elasticsearch']['checksums']['6.7.1']['tarball'] = '7be3f94882130c769e5a6b95dbccdc3cab9f101cbc68edfa661f7188c78f06e2'
|
||||
|
||||
default['elasticsearch']['checksums']['6.7.2']['debian'] = '8ad69655c22eabe94295ffb23434ae26ef4d839555ee9cb65261a6fe48e0dc12'
|
||||
default['elasticsearch']['checksums']['6.7.2']['rhel'] = 'aabd389a4098fb99113907ae9665d454291dd32641cd33056f26ec713d017972'
|
||||
default['elasticsearch']['checksums']['6.7.2']['tarball'] = 'd0ed638c825914d3c5fd8b34f69b5bcf9cfa5cf85af25145ea7a910ea8f708a9'
|
||||
|
||||
default['elasticsearch']['checksums']['6.8.0']['debian'] = 'cb5556c6b75ef2e2d3b0399625aaabae0bbd84229ffc08e8475fdbec1e1b66c0'
|
||||
default['elasticsearch']['checksums']['6.8.0']['rhel'] = '702bde8def4d51788b49477225d345b693e34ede35c1fbf6fd1421860d3451f5'
|
||||
default['elasticsearch']['checksums']['6.8.0']['tarball'] = '92c67cf48a145a60579857f190ed03a56e3ae42e599d0c84fed0747af866fffd'
|
||||
|
||||
default['elasticsearch']['checksums']['6.8.1']['debian'] = 'e7711bfb68e82f4538067da03634ef1937d71a1ab448d7d4eb3f20bc1c4854d1'
|
||||
default['elasticsearch']['checksums']['6.8.1']['rhel'] = '4663f759cade5d1613842f86af3f78d064ce3c8e81de9615a353cc2eb413aed0'
|
||||
default['elasticsearch']['checksums']['6.8.1']['tarball'] = 'ad33d463884acde2d8682cb46927f03603ea66133b84c12f53dc9edbc02447e3'
|
||||
|
||||
default['elasticsearch']['checksums']['6.8.2']['debian'] = '9e6b591bef75d042abb4888d914e37aab19bf8afb6eda9efaa6b270ac7edd151'
|
||||
default['elasticsearch']['checksums']['6.8.2']['rhel'] = '3561e6c1bbac324448928e752b9d6c0d2a413c569993625f6dd255b343f61a6c'
|
||||
default['elasticsearch']['checksums']['6.8.2']['tarball'] = '2dc3107475659dfd21afa74612a43d5ccbcf4942ab679e8e4e77167cafe27c94'
|
||||
|
||||
default['elasticsearch']['checksums']['7.0.0']['debian'] = '491d36af33bc896f8c44c46e1ed550e304220c9eedee991091864f5f3434e2f4'
|
||||
default['elasticsearch']['checksums']['7.0.0']['rhel'] = '99ed1d22c128189ccb07c99babe7f437180e42c94af15782acf4b80d2520abc4'
|
||||
default['elasticsearch']['checksums']['7.0.0']['tarball'] = '68deee5e9c961ad48cc83859970ac7a79029fe5f5e6de7e58ea0f7c7713f25ba'
|
||||
|
||||
default['elasticsearch']['checksums']['7.0.1']['debian'] = 'b84419e213539f5af2a0b3d73ebc11cf2da7e7061e6308e83333a9282bf920e4'
|
||||
default['elasticsearch']['checksums']['7.0.1']['rhel'] = '52aba98ea0165492fa899ed8487af5cab10f5e452611995ebac31b5f44facd50'
|
||||
default['elasticsearch']['checksums']['7.0.1']['tarball'] = '33866cbc61383d1ead01622ff54cadacec0b9fe81224af9b77104be614a56eca'
|
||||
|
||||
default['elasticsearch']['checksums']['7.1.0']['debian'] = '9cdb867ebfda5550590e2dc98e37020d9aa6bfd508b1b8be9f11f5683c807349'
|
||||
default['elasticsearch']['checksums']['7.1.0']['rhel'] = '3facf261e9cbb88c8d792d2ff97e2aeb79c44d2df5fd83591ce4f2d5378eb7a4'
|
||||
default['elasticsearch']['checksums']['7.1.0']['tarball'] = '91b4bd3722086e83dbe5ee7abf179de19b0cf9dc8a639438bde2721f184cc42e'
|
||||
|
||||
default['elasticsearch']['checksums']['7.1.1']['debian'] = '2ef15cb7e37d32b93c51ad537959831bd72cac2627f255d22cc574cec5de6aef'
|
||||
default['elasticsearch']['checksums']['7.1.1']['rhel'] = '7950c7d97407d8948ca164d81866b389fe734e3ec775452a3e407e49cbd0d5ed'
|
||||
default['elasticsearch']['checksums']['7.1.1']['tarball'] = 'd8cd7df1232d931b9ff8fda1e960d94b03db21b7f33162d6865ebcbe69a45f95'
|
||||
|
||||
default['elasticsearch']['checksums']['7.2.0']['debian'] = '1ff7b88c4bc38438a67719df499b17d4f7082a77eda89f39016f83414554ea95'
|
||||
default['elasticsearch']['checksums']['7.2.0']['rhel'] = 'a854decb443631a0031a9492c1d5acbed00222381cb63cba68ae6d5deee3994c'
|
||||
default['elasticsearch']['checksums']['7.2.0']['tarball'] = '24a2c31ff3ef34624752f266c39e40e84b103ab529dae7e062f1cb4b614cd1c5'
|
||||
|
||||
default['elasticsearch']['checksums']['7.2.1']['debian'] = '41f507b83fc49a3da5109afd18cc626ec5458acf567f00a80ac3f1c34b6d4b7f'
|
||||
default['elasticsearch']['checksums']['7.2.1']['rhel'] = '96fdac0a8e6c74182d920b39e3f4830b722731a646126222c189e12a95302e6e'
|
||||
default['elasticsearch']['checksums']['7.2.1']['tarball'] = 'd5d660895a39755ad6af16ec32cff5e2b645d5faf7150c69acc0fe013c604ae7'
|
||||
|
||||
default['elasticsearch']['checksums']['7.3.0']['debian'] = '72ae24cf0f5d97a307f35d116a41e1165e80f58f08b0ca4e6de3ec5228f06f9c'
|
||||
default['elasticsearch']['checksums']['7.3.0']['rhel'] = 'f49dc809cf48369b70546f13dfb28b43e1a07387b681ca786c794762d52847ca'
|
||||
default['elasticsearch']['checksums']['7.3.0']['tarball'] = '6cddb4d9a3c5e730f8e35e2155937c069d057129808ea135d31f0ed5f7f2ea22'
|
||||
156
cookbooks/elasticsearch/libraries/helpers.rb
Normal file
156
cookbooks/elasticsearch/libraries/helpers.rb
Normal file
@@ -0,0 +1,156 @@
|
||||
module ElasticsearchCookbook
|
||||
# Helper methods included by various providers and passed to the template engine
|
||||
module Helpers
|
||||
def find_es_resource(run_context, resource_type, resource)
|
||||
resource_name = resource.name
|
||||
instance_name = resource.instance_name
|
||||
|
||||
# if we are truly given a specific name to find
|
||||
name_match = find_exact_resource(run_context, resource_type, resource_name) rescue nil
|
||||
return name_match if name_match
|
||||
|
||||
# first try by instance name attribute
|
||||
name_instance = find_instance_name_resource(run_context, resource_type, instance_name) rescue nil
|
||||
return name_instance if name_instance
|
||||
|
||||
# otherwise try the defaults
|
||||
name_default = find_exact_resource(run_context, resource_type, 'default') rescue nil
|
||||
name_elasticsearch = find_exact_resource(run_context, resource_type, 'elasticsearch') rescue nil
|
||||
|
||||
# if we found exactly one default name that matched
|
||||
return name_default if name_default && !name_elasticsearch
|
||||
return name_elasticsearch if name_elasticsearch && !name_default
|
||||
|
||||
raise "Could not find exactly one #{resource_type} resource, and no specific resource or instance name was given"
|
||||
end
|
||||
|
||||
# find exactly the resource name and type, but raise if there's multiple matches
|
||||
# see https://github.com/chef/chef/blob/master/lib/chef/resource_collection/resource_set.rb#L80
|
||||
def find_exact_resource(run_context, resource_type, resource_name)
|
||||
rc = run_context.resource_collection
|
||||
result = rc.find(resource_type => resource_name)
|
||||
|
||||
if result && result.is_a?(Array)
|
||||
str = ''
|
||||
str << "more than one #{resource_type} was found, "
|
||||
str << 'you must specify a precise resource name'
|
||||
raise str
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def find_instance_name_resource(run_context, resource_type, instance_name)
|
||||
results = []
|
||||
rc = run_context.resource_collection
|
||||
|
||||
rc.each do |r|
|
||||
next unless r.resource_name == resource_type && r.instance_name == instance_name
|
||||
results << r
|
||||
end
|
||||
|
||||
if !results.empty? && results.length > 1
|
||||
str = ''
|
||||
str << "more than one #{resource_type} was found, "
|
||||
str << 'you must specify a precise instance name'
|
||||
raise str
|
||||
elsif !results.empty?
|
||||
return results.first
|
||||
end
|
||||
|
||||
nil # falsey
|
||||
end
|
||||
|
||||
def determine_download_url(new_resource, node)
|
||||
platform_family = node['platform_family']
|
||||
|
||||
version_key = 'download_urls'
|
||||
if Gem::Version.new(new_resource.version) >= Gem::Version.new('7.0.0')
|
||||
version_key = 'download_urls_v7'
|
||||
end
|
||||
|
||||
url_string = nil
|
||||
if new_resource.download_url
|
||||
url_string = new_resource.download_url
|
||||
elsif new_resource.type == 'tarball'
|
||||
url_string = node['elasticsearch'][version_key]['tarball']
|
||||
elsif new_resource.type == 'package' && node['elasticsearch']['download_urls'][platform_family]
|
||||
url_string = node['elasticsearch'][version_key][platform_family]
|
||||
end
|
||||
|
||||
if url_string && new_resource.version
|
||||
return format(url_string, new_resource.version)
|
||||
elsif url_string
|
||||
return url_string
|
||||
end
|
||||
end
|
||||
|
||||
def determine_download_checksum(new_resource, node)
|
||||
platform_family = node['platform_family']
|
||||
|
||||
# for the sake of finding correct attribute data, use rhel for amazon too
|
||||
# See https://github.com/elastic/cookbook-elasticsearch/issues/609
|
||||
platform_family = 'rhel' if platform_family == 'amazon'
|
||||
|
||||
install_type = new_resource.type
|
||||
version = new_resource.version
|
||||
|
||||
if new_resource.download_checksum
|
||||
new_resource.download_checksum
|
||||
elsif install_type == 'tarball'
|
||||
node && version &&
|
||||
node['elasticsearch'] &&
|
||||
node['elasticsearch']['checksums'] &&
|
||||
node['elasticsearch']['checksums'][version] &&
|
||||
node['elasticsearch']['checksums'][version]['tarball']
|
||||
elsif install_type == 'package' && node['elasticsearch']['checksums'][version] && node['elasticsearch']['checksums'][version][platform_family]
|
||||
node && version && platform_family &&
|
||||
node['elasticsearch'] &&
|
||||
node['elasticsearch']['checksums'] &&
|
||||
node['elasticsearch']['checksums'][version] &&
|
||||
node['elasticsearch']['checksums'][version][platform_family]
|
||||
end
|
||||
end
|
||||
|
||||
# proxy helper for chef sets JVM 8 proxy options
|
||||
def get_java_proxy_arguments(enabled = true)
|
||||
return '' unless enabled
|
||||
require 'uri'
|
||||
output = ''
|
||||
|
||||
if Chef::Config[:http_proxy] && !Chef::Config[:http_proxy].empty?
|
||||
parsed_uri = URI(Chef::Config[:http_proxy])
|
||||
output += "-Dhttp.proxyHost=#{parsed_uri.host} -Dhttp.proxyPort=#{parsed_uri.port} "
|
||||
end
|
||||
|
||||
if Chef::Config[:https_proxy] && !Chef::Config[:https_proxy].empty?
|
||||
parsed_uri = URI(Chef::Config[:https_proxy])
|
||||
output += "-Dhttps.proxyHost=#{parsed_uri.host} -Dhttps.proxyPort=#{parsed_uri.port} "
|
||||
end
|
||||
|
||||
output
|
||||
rescue
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
class HashAndMashBlender
|
||||
attr_accessor :target
|
||||
def initialize(hash_or_mash_or_whatever)
|
||||
self.target = hash_or_mash_or_whatever
|
||||
end
|
||||
|
||||
def to_hash
|
||||
target.each_with_object({}) do |(k, v), hsh|
|
||||
hsh[k] =
|
||||
if v.respond_to?(:to_hash)
|
||||
self.class.new(v).to_hash
|
||||
elsif v.respond_to?(:to_a)
|
||||
v.to_a
|
||||
else
|
||||
v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
73
cookbooks/elasticsearch/libraries/matchers.rb
Normal file
73
cookbooks/elasticsearch/libraries/matchers.rb
Normal file
@@ -0,0 +1,73 @@
|
||||
# ChefSpec is a tool to unit test cookbooks in conjunction with rspec
|
||||
# Learn more on the README or at https://github.com/sethvargo/chefspec.
|
||||
if defined?(ChefSpec)
|
||||
ChefSpec.define_matcher(:elasticsearch_configure)
|
||||
ChefSpec.define_matcher(:elasticsearch_install)
|
||||
ChefSpec.define_matcher(:elasticsearch_plugin)
|
||||
ChefSpec.define_matcher(:elasticsearch_service)
|
||||
ChefSpec.define_matcher(:elasticsearch_user)
|
||||
|
||||
def create_elasticsearch_user(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_user, :create, resource_name)
|
||||
end
|
||||
|
||||
def remove_elasticsearch_user(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_user, :remove, resource_name)
|
||||
end
|
||||
|
||||
def install_elasticsearch(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_install, :install, resource_name)
|
||||
end
|
||||
|
||||
def remove_elasticsearch(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_install, :remove, resource_name)
|
||||
end
|
||||
|
||||
def manage_elasticsearch_configure(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_configure, :manage, resource_name)
|
||||
end
|
||||
|
||||
def remove_elasticsearch_configure(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_configure, :remove, resource_name)
|
||||
end
|
||||
|
||||
def configure_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :configure, resource_name)
|
||||
end
|
||||
|
||||
def remove_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :remove, resource_name)
|
||||
end
|
||||
|
||||
def enable_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :enable, resource_name)
|
||||
end
|
||||
|
||||
def disable_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :disable, resource_name)
|
||||
end
|
||||
|
||||
def start_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :start, resource_name)
|
||||
end
|
||||
|
||||
def stop_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :stop, resource_name)
|
||||
end
|
||||
|
||||
def restart_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :restart, resource_name)
|
||||
end
|
||||
|
||||
def status_elasticsearch_service(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_service, :status, resource_name)
|
||||
end
|
||||
|
||||
def install_elasticsearch_plugin(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_plugin, :install, resource_name)
|
||||
end
|
||||
|
||||
def remove_elasticsearch_plugin(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:elasticsearch_plugin, :remove, resource_name)
|
||||
end
|
||||
end
|
||||
164
cookbooks/elasticsearch/libraries/provider_configure.rb
Normal file
164
cookbooks/elasticsearch/libraries/provider_configure.rb
Normal file
@@ -0,0 +1,164 @@
|
||||
# Chef Provider for configuring an elasticsearch instance
|
||||
class ElasticsearchCookbook::ConfigureProvider < Chef::Provider::LWRPBase
|
||||
include ElasticsearchCookbook::Helpers
|
||||
|
||||
provides :elasticsearch_configure
|
||||
|
||||
def whyrun_supported?
|
||||
true # we only use core Chef resources that also support whyrun
|
||||
end
|
||||
|
||||
def action_manage
|
||||
# lookup existing ES resources
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
es_svc = find_es_resource(Chef.run_context, :elasticsearch_service, new_resource)
|
||||
es_install = find_es_resource(Chef.run_context, :elasticsearch_install, new_resource)
|
||||
|
||||
default_configuration = new_resource.default_configuration.dup
|
||||
# if a subdir parameter is missing but dir is set, infer the subdir name
|
||||
# then go and be sure it's also set in the YML hash if it wasn't given there
|
||||
if new_resource.path_data && default_configuration['path.data'].nil?
|
||||
default_configuration['path.data'] = new_resource.path_data
|
||||
end
|
||||
|
||||
if new_resource.path_logs && default_configuration['path.logs'].nil?
|
||||
default_configuration['path.logs'] = new_resource.path_logs
|
||||
end
|
||||
|
||||
# calculation for memory allocation; 50% or 31g, whatever is smaller
|
||||
unless new_resource.allocated_memory
|
||||
half = ((node['memory']['total'].to_i * 0.5).floor / 1024)
|
||||
malloc_str = (half > 30_500 ? '30500m' : "#{half}m")
|
||||
new_resource.allocated_memory malloc_str
|
||||
end
|
||||
|
||||
# Create ES directories
|
||||
#
|
||||
[new_resource.path_conf, "#{new_resource.path_conf}/scripts"].each do |path|
|
||||
d = directory path do
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0750'
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
d.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if d.updated_by_last_action?
|
||||
end
|
||||
|
||||
# Create data path directories
|
||||
#
|
||||
data_paths = new_resource.path_data.is_a?(Array) ? new_resource.path_data : new_resource.path_data.split(',')
|
||||
data_paths = data_paths << new_resource.path_logs
|
||||
|
||||
data_paths.each do |path|
|
||||
d = directory path.strip do
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0755'
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
d.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if d.updated_by_last_action?
|
||||
end
|
||||
|
||||
# Create elasticsearch shell variables file
|
||||
#
|
||||
# Valid values in /etc/sysconfig/elasticsearch or /etc/default/elasticsearch
|
||||
# ES_HOME JAVA_HOME ES_PATH_CONF DATA_DIR LOG_DIR PID_DIR ES_JAVA_OPTS
|
||||
# RESTART_ON_UPGRADE ES_USER ES_GROUP ES_STARTUP_SLEEP_TIME MAX_OPEN_FILES
|
||||
# MAX_LOCKED_MEMORY MAX_MAP_COUNT
|
||||
#
|
||||
# We provide these values as resource attributes/parameters directly
|
||||
|
||||
params = {}
|
||||
params[:ES_HOME] = new_resource.path_home
|
||||
params[:JAVA_HOME] = new_resource.java_home
|
||||
params[:ES_PATH_CONF] = new_resource.path_conf
|
||||
params[:DATA_DIR] = new_resource.path_data
|
||||
params[:LOG_DIR] = new_resource.path_logs
|
||||
params[:PID_DIR] = new_resource.path_pid
|
||||
params[:RESTART_ON_UPGRADE] = new_resource.restart_on_upgrade
|
||||
params[:ES_USER] = es_user.username if es_install.type == 'tarball'
|
||||
params[:ES_GROUP] = es_user.groupname if es_install.type == 'tarball'
|
||||
params[:ES_STARTUP_SLEEP_TIME] = new_resource.startup_sleep_seconds.to_s
|
||||
params[:MAX_OPEN_FILES] = new_resource.nofile_limit
|
||||
params[:MAX_LOCKED_MEMORY] = new_resource.memlock_limit
|
||||
params[:MAX_MAP_COUNT] = new_resource.max_map_count
|
||||
|
||||
default_config_name = es_svc.service_name || es_svc.instance_name || new_resource.instance_name || 'elasticsearch'
|
||||
|
||||
shell_template = template "elasticsearch.in.sh-#{default_config_name}" do
|
||||
path %w[rhel amazon].include?(node['platform_family']) ? "/etc/sysconfig/#{default_config_name}" : "/etc/default/#{default_config_name}"
|
||||
source new_resource.template_elasticsearch_env
|
||||
cookbook new_resource.cookbook_elasticsearch_env
|
||||
mode '0644'
|
||||
variables(params: params)
|
||||
action :nothing
|
||||
end
|
||||
shell_template.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if shell_template.updated_by_last_action?
|
||||
|
||||
# Create jvm.options file
|
||||
#
|
||||
jvm_options_template = template "jvm_options-#{default_config_name}" do
|
||||
path "#{new_resource.path_conf}/jvm.options"
|
||||
source new_resource.template_jvm_options
|
||||
cookbook new_resource.cookbook_jvm_options
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0644'
|
||||
variables(jvm_options: [
|
||||
"-Xms#{new_resource.allocated_memory}",
|
||||
"-Xmx#{new_resource.allocated_memory}",
|
||||
new_resource.jvm_options,
|
||||
].flatten.join("\n"))
|
||||
action :nothing
|
||||
end
|
||||
jvm_options_template.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if jvm_options_template.updated_by_last_action?
|
||||
|
||||
# Create ES logging file
|
||||
#
|
||||
logging_template = template "log4j2_properties-#{default_config_name}" do
|
||||
path "#{new_resource.path_conf}/log4j2.properties"
|
||||
source new_resource.template_log4j2_properties
|
||||
cookbook new_resource.cookbook_log4j2_properties
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0640'
|
||||
variables(logging: new_resource.logging)
|
||||
action :nothing
|
||||
end
|
||||
logging_template.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if logging_template.updated_by_last_action?
|
||||
|
||||
# Create ES elasticsearch.yml file
|
||||
#
|
||||
merged_configuration = default_configuration.merge(new_resource.configuration.dup)
|
||||
|
||||
# warn if someone is using symbols. we don't support.
|
||||
found_symbols = merged_configuration.keys.select { |s| s.is_a?(Symbol) }
|
||||
unless found_symbols.empty?
|
||||
Chef::Log.warn("Please change the following to strings in order to work with this Elasticsearch cookbook: #{found_symbols.join(',')}")
|
||||
end
|
||||
|
||||
# workaround for https://github.com/elastic/cookbook-elasticsearch/issues/590
|
||||
config_vars = ElasticsearchCookbook::HashAndMashBlender.new(merged_configuration).to_hash
|
||||
|
||||
yml_template = template "elasticsearch.yml-#{default_config_name}" do
|
||||
path "#{new_resource.path_conf}/elasticsearch.yml"
|
||||
source new_resource.template_elasticsearch_yml
|
||||
cookbook new_resource.cookbook_elasticsearch_yml
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0640'
|
||||
helpers(ElasticsearchCookbook::Helpers)
|
||||
variables(config: config_vars)
|
||||
action :nothing
|
||||
end
|
||||
yml_template.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if yml_template.updated_by_last_action?
|
||||
end
|
||||
end
|
||||
238
cookbooks/elasticsearch/libraries/provider_install.rb
Normal file
238
cookbooks/elasticsearch/libraries/provider_install.rb
Normal file
@@ -0,0 +1,238 @@
|
||||
# Chef Provider for installing or removing Elasticsearch from package or tarball
|
||||
# downloaded from elasticsearch.org and installed by package manager or ark resource
|
||||
class ElasticsearchCookbook::InstallProvider < Chef::Provider::LWRPBase
|
||||
include ElasticsearchCookbook::Helpers
|
||||
include Chef::DSL::IncludeRecipe
|
||||
provides :elasticsearch_install
|
||||
|
||||
def whyrun_supported?
|
||||
true # we only use core Chef resources that also support whyrun
|
||||
end
|
||||
|
||||
def action_install
|
||||
if new_resource.type == 'tarball'
|
||||
install_tarball_wrapper_action
|
||||
elsif new_resource.type == 'package'
|
||||
install_package_wrapper_action
|
||||
elsif new_resource.type == 'repository'
|
||||
install_repo_wrapper_action
|
||||
else
|
||||
raise "#{install_type} is not a valid install type"
|
||||
end
|
||||
end
|
||||
|
||||
def action_remove
|
||||
if new_resource.type == 'tarball'
|
||||
remove_tarball_wrapper_action
|
||||
elsif new_resource.type == 'package'
|
||||
remove_package_wrapper_action
|
||||
elsif new_resource.type == 'repository'
|
||||
remove_repo_wrapper_action
|
||||
else
|
||||
raise "#{install_type} is not a valid install type"
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def install_repo_wrapper_action
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
unless es_user && es_user.username == 'elasticsearch' && es_user.groupname == 'elasticsearch'
|
||||
raise 'Custom usernames/group names is not supported in Elasticsearch 6+ repository installation'
|
||||
end
|
||||
|
||||
if new_resource.enable_repository_actions
|
||||
if node['platform_family'] == 'debian'
|
||||
apt_r = apt_repo_resource
|
||||
apt_r.run_action(:add)
|
||||
new_resource.updated_by_last_action(true) if apt_r.updated_by_last_action?
|
||||
else
|
||||
yr_r = yum_repo_resource
|
||||
yr_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if yr_r.updated_by_last_action?
|
||||
end
|
||||
end
|
||||
|
||||
if !new_resource.version.nil? && %w[rhel amazon].include?(node['platform_family']) && !new_resource.version.include?('-')
|
||||
# NB: yum repo packages are broken in Chef if you don't specify a release
|
||||
# https://github.com/chef/chef/issues/4103
|
||||
new_resource.version = "#{new_resource.version}-1"
|
||||
end
|
||||
|
||||
pkg_r = package 'elasticsearch' do
|
||||
options new_resource.package_options
|
||||
version new_resource.version
|
||||
action :nothing
|
||||
end
|
||||
|
||||
pkg_r.run_action(:install)
|
||||
new_resource.updated_by_last_action(true) if pkg_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def remove_repo_wrapper_action
|
||||
if new_resource.enable_repository_actions
|
||||
if node['platform_family'] == 'debian'
|
||||
apt_r = apt_repo_resource
|
||||
apt_r.run_action(:remove)
|
||||
new_resource.updated_by_last_action(true) if apt_r.updated_by_last_action?
|
||||
else
|
||||
yr_r = yum_repo_resource
|
||||
yr_r.run_action(:delete)
|
||||
new_resource.updated_by_last_action(true) if yr_r.updated_by_last_action?
|
||||
end
|
||||
end
|
||||
|
||||
pkg_r = package 'elasticsearch' do
|
||||
options new_resource.package_options
|
||||
version new_resource.version
|
||||
action :nothing
|
||||
end
|
||||
pkg_r.run_action(:remove)
|
||||
new_resource.updated_by_last_action(true) if pkg_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def install_package_wrapper_action
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
unless es_user && es_user.username == 'elasticsearch' && es_user.groupname == 'elasticsearch'
|
||||
raise 'Custom usernames/group names is not supported in Elasticsearch 6+ package installation'
|
||||
end
|
||||
|
||||
found_download_url = determine_download_url(new_resource, node)
|
||||
unless found_download_url
|
||||
raise 'Could not determine download url for package on this platform'
|
||||
end
|
||||
|
||||
filename = found_download_url.split('/').last
|
||||
checksum = determine_download_checksum(new_resource, node)
|
||||
package_options = new_resource.package_options
|
||||
|
||||
unless checksum
|
||||
Chef::Log.warn("No checksum was provided for #{found_download_url}, this may download a new package on every chef run!")
|
||||
end
|
||||
|
||||
remote_file_r = remote_file "#{Chef::Config[:file_cache_path]}/#{filename}" do
|
||||
source found_download_url
|
||||
checksum checksum
|
||||
mode '0644'
|
||||
action :nothing
|
||||
end
|
||||
remote_file_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if remote_file_r.updated_by_last_action?
|
||||
|
||||
pkg_r = if node['platform_family'] == 'debian'
|
||||
dpkg_package "#{Chef::Config[:file_cache_path]}/#{filename}" do
|
||||
options package_options
|
||||
action :nothing
|
||||
end
|
||||
else
|
||||
package "#{Chef::Config[:file_cache_path]}/#{filename}" do
|
||||
options package_options
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
pkg_r.run_action(:install)
|
||||
new_resource.updated_by_last_action(true) if pkg_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def remove_package_wrapper_action
|
||||
package_url = determine_download_url(new_resource, node)
|
||||
filename = package_url.split('/').last
|
||||
|
||||
pkg_r = if node['platform_family'] == 'debian'
|
||||
dpkg_package "#{Chef::Config[:file_cache_path]}/#{filename}" do
|
||||
action :nothing
|
||||
end
|
||||
else
|
||||
package "#{Chef::Config[:file_cache_path]}/#{filename}" do
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
pkg_r.run_action(:remove)
|
||||
new_resource.updated_by_last_action(true) if pkg_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def install_tarball_wrapper_action
|
||||
include_recipe 'ark'
|
||||
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
found_download_url = determine_download_url(new_resource, node)
|
||||
unless found_download_url
|
||||
raise 'Could not determine download url for tarball on this platform'
|
||||
end
|
||||
|
||||
ark_r = ark 'elasticsearch' do
|
||||
url found_download_url
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
version new_resource.version
|
||||
has_binaries ['bin/elasticsearch', 'bin/elasticsearch-plugin']
|
||||
checksum determine_download_checksum(new_resource, node)
|
||||
prefix_root new_resource.dir
|
||||
prefix_home new_resource.dir
|
||||
|
||||
not_if do
|
||||
link = "#{new_resource.dir}/elasticsearch"
|
||||
target = "#{new_resource.dir}/elasticsearch-#{new_resource.version}"
|
||||
binary = "#{target}/bin/elasticsearch"
|
||||
|
||||
::File.directory?(link) && ::File.symlink?(link) && ::File.readlink(link) == target && ::File.exist?(binary)
|
||||
end
|
||||
action :nothing
|
||||
end
|
||||
ark_r.run_action(:install)
|
||||
new_resource.updated_by_last_action(true) if ark_r.updated_by_last_action?
|
||||
|
||||
# destroy the sample config directory for tarball installs, or it will
|
||||
# take precedence beyond the default stuff in /etc/elasticsearch and within
|
||||
# /etc/sysconfig or /etc/default
|
||||
sample_r = directory "#{new_resource.dir}/elasticsearch/config" do
|
||||
action :nothing
|
||||
recursive true
|
||||
end
|
||||
sample_r.run_action(:delete)
|
||||
new_resource.updated_by_last_action(true) if sample_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def remove_tarball_wrapper_action
|
||||
# remove the symlink to this version
|
||||
link_r = link "#{new_resource.dir}/elasticsearch" do
|
||||
only_if do
|
||||
link = "#{new_resource.dir}/elasticsearch"
|
||||
target = "#{new_resource.dir}/elasticsearch-#{new_resource.version}"
|
||||
|
||||
::File.directory?(link) && ::File.symlink?(link) && ::File.readlink(link) == target
|
||||
end
|
||||
action :nothing
|
||||
end
|
||||
link_r.run_action(:delete)
|
||||
new_resource.updated_by_last_action(true) if link_r.updated_by_last_action?
|
||||
|
||||
# remove the specific version
|
||||
d_r = directory "#{new_resource.dir}/elasticsearch-#{new_resource.version}" do
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
d_r.run_action(:delete)
|
||||
new_resource.updated_by_last_action(true) if d_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def yum_repo_resource
|
||||
yum_repository "elastic-#{new_resource.version.to_i}.x" do
|
||||
baseurl "https://artifacts.elastic.co/packages/#{new_resource.version.to_i}.x/yum"
|
||||
gpgkey 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
|
||||
action :nothing # :add, remove
|
||||
end
|
||||
end
|
||||
|
||||
def apt_repo_resource
|
||||
apt_repository "elastic-#{new_resource.version.to_i}.x" do
|
||||
uri "https://artifacts.elastic.co/packages/#{new_resource.version.to_i}.x/apt"
|
||||
key 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
|
||||
components ['main']
|
||||
distribution 'stable'
|
||||
action :nothing # :create, :delete
|
||||
end
|
||||
end
|
||||
end
|
||||
108
cookbooks/elasticsearch/libraries/provider_plugin.rb
Normal file
108
cookbooks/elasticsearch/libraries/provider_plugin.rb
Normal file
@@ -0,0 +1,108 @@
|
||||
# Chef Provider for installing an elasticsearch plugin
|
||||
class ElasticsearchCookbook::PluginProvider < Chef::Provider::LWRPBase
|
||||
include ElasticsearchCookbook::Helpers
|
||||
include Chef::Mixin::ShellOut
|
||||
|
||||
provides :elasticsearch_plugin
|
||||
|
||||
def whyrun_supported?
|
||||
true # we only use core Chef resources that also support whyrun, or guard
|
||||
end
|
||||
|
||||
def action_install
|
||||
return if plugin_exists(new_resource.plugin_name)
|
||||
|
||||
# since install can take a URL argument instead
|
||||
url_or_name = new_resource.url || new_resource.plugin_name
|
||||
manage_plugin("install #{url_or_name}")
|
||||
end # action
|
||||
|
||||
def action_remove
|
||||
return unless plugin_exists(new_resource.plugin_name)
|
||||
|
||||
manage_plugin("remove #{new_resource.plugin_name}")
|
||||
end # action
|
||||
|
||||
def manage_plugin(arguments)
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
es_install = find_es_resource(Chef.run_context, :elasticsearch_install, new_resource)
|
||||
es_conf = find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource)
|
||||
|
||||
assert_state_is_valid(es_user, es_install, es_conf) unless whyrun_mode?
|
||||
|
||||
# shell_out! automatically raises on error, logs command output
|
||||
# required for package installs that show up with parent dir owned by root
|
||||
plugin_dir_exists = ::File.exist?(es_conf.path_plugins)
|
||||
unless plugin_dir_exists
|
||||
cmd_str = "mkdir -p #{es_conf.path_plugins}"
|
||||
if whyrun_mode?
|
||||
Chef::Log.info("Would run command: #{cmd_str}")
|
||||
else
|
||||
shell_out_as_user!(cmd_str, Chef.run_context)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
|
||||
unless plugin_exists(new_resource.plugin_name)
|
||||
cmd_str = "#{es_conf.path_bin}/elasticsearch-plugin #{arguments.chomp(' ')} #{new_resource.options}".chomp(' ')
|
||||
if whyrun_mode?
|
||||
Chef::Log.info("Would run command: #{cmd_str}")
|
||||
else
|
||||
command_array = cmd_str.split(' ')
|
||||
shell_out_as_user!(command_array, Chef.run_context)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def plugin_exists(name)
|
||||
es_conf = find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource)
|
||||
path = es_conf.path_plugins
|
||||
|
||||
Dir.entries(path).any? do |plugin|
|
||||
next if plugin =~ /^\./
|
||||
name == plugin
|
||||
end
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
def assert_state_is_valid(_es_user, _es_install, es_conf)
|
||||
unless es_conf.path_plugins # we do not check existence (may not exist if no plugins installed)
|
||||
raise "Could not determine the plugin directory (#{es_conf.path_plugins}). Please check elasticsearch_configure[#{es_conf.name}]."
|
||||
end
|
||||
|
||||
unless es_conf.path_bin && ::File.exist?(es_conf.path_bin)
|
||||
raise "Could not determine the binary directory (#{es_conf.path_bin}). Please check elasticsearch_configure[#{es_conf.name}]."
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def shell_out_as_user!(command, run_ctx)
|
||||
es_install = find_es_resource(run_ctx, :elasticsearch_install, new_resource)
|
||||
es_conf = find_es_resource(run_ctx, :elasticsearch_configure, new_resource)
|
||||
es_svc = find_es_resource(run_ctx, :elasticsearch_service, new_resource)
|
||||
|
||||
# we need to figure out the env file path to set environment for plugins
|
||||
default_config_name = es_svc.service_name || es_svc.instance_name || es_conf.instance_name || 'elasticsearch'
|
||||
include_file_resource = find_exact_resource(run_ctx, :template, "elasticsearch.in.sh-#{default_config_name}")
|
||||
env = { 'ES_INCLUDE' => include_file_resource.path }
|
||||
|
||||
# Add HTTP Proxy vars unless explicitly told not to
|
||||
if new_resource.chef_proxy
|
||||
env['ES_JAVA_OPTS'] = "#{ENV['ES_JAVA_OPTS']} #{get_java_proxy_arguments}"
|
||||
end
|
||||
|
||||
# See this link for an explanation:
|
||||
# https://www.elastic.co/guide/en/elasticsearch/plugins/2.1/plugin-management.html
|
||||
if es_install.type == 'package' || es_install.type == 'repository'
|
||||
# package installations should install plugins as root
|
||||
shell_out!(command, :env => env, :timeout => 1200)
|
||||
else
|
||||
# non-package installations should install plugins as the ES user
|
||||
es_user = find_es_resource(run_ctx, :elasticsearch_user, new_resource)
|
||||
shell_out!(command, user: es_user.username, group: es_user.groupname, :env => env, :timeout => 1200)
|
||||
end
|
||||
end
|
||||
end # provider
|
||||
140
cookbooks/elasticsearch/libraries/provider_service.rb
Normal file
140
cookbooks/elasticsearch/libraries/provider_service.rb
Normal file
@@ -0,0 +1,140 @@
|
||||
# Chef Provider for configuring an elasticsearch service in the init system
|
||||
class ElasticsearchCookbook::ServiceProvider < Chef::Provider::LWRPBase
|
||||
provides :elasticsearch_service
|
||||
include ElasticsearchCookbook::Helpers
|
||||
|
||||
def whyrun_supported?
|
||||
true # we only use core Chef resources that also support whyrun
|
||||
end
|
||||
|
||||
def action_remove
|
||||
raise "#{new_resource} remove not currently implemented"
|
||||
end
|
||||
|
||||
def action_configure
|
||||
es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource)
|
||||
es_install = find_es_resource(Chef.run_context, :elasticsearch_install, new_resource)
|
||||
es_conf = find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource)
|
||||
default_config_name = new_resource.service_name || new_resource.instance_name || es_conf.instance_name || 'elasticsearch'
|
||||
|
||||
d_r = directory "#{es_conf.path_pid}-#{default_config_name}" do
|
||||
path es_conf.path_pid
|
||||
owner es_user.username
|
||||
group es_user.groupname
|
||||
mode '0755'
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
d_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if d_r.updated_by_last_action?
|
||||
|
||||
# Create service for init and systemd
|
||||
#
|
||||
if new_resource.init_source
|
||||
init_r = template "/etc/init.d/#{new_resource.service_name}" do
|
||||
source new_resource.init_source
|
||||
cookbook new_resource.init_cookbook
|
||||
owner 'root'
|
||||
mode '0755'
|
||||
variables(
|
||||
# we need to include something about #{progname} fixed in here.
|
||||
program_name: new_resource.service_name,
|
||||
install_type: es_install.type
|
||||
)
|
||||
only_if { ::File.exist?('/etc/init.d') }
|
||||
action :nothing
|
||||
end
|
||||
init_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if init_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
if new_resource.systemd_source
|
||||
systemd_parent_r = directory "/usr/lib/systemd/system-#{default_config_name}" do
|
||||
path '/usr/lib/systemd/system'
|
||||
action :nothing
|
||||
only_if { ::File.exist?('/usr/lib/systemd') }
|
||||
end
|
||||
systemd_parent_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if systemd_parent_r.updated_by_last_action?
|
||||
|
||||
default_conf_dir = %w[rhel amazon].include?(node['platform_family']) ? '/etc/sysconfig' : '/etc/default'
|
||||
systemd_r = template "/usr/lib/systemd/system/#{new_resource.service_name}.service" do
|
||||
source new_resource.systemd_source
|
||||
cookbook new_resource.systemd_cookbook
|
||||
owner 'root'
|
||||
mode '0644'
|
||||
variables(
|
||||
# we need to include something about #{progname} fixed in here.
|
||||
program_name: new_resource.service_name,
|
||||
default_dir: default_conf_dir,
|
||||
path_home: es_conf.path_home,
|
||||
es_user: es_user.username,
|
||||
es_group: es_user.groupname,
|
||||
nofile_limit: es_conf.nofile_limit,
|
||||
install_type: es_install.type
|
||||
)
|
||||
only_if 'which systemctl'
|
||||
action :nothing
|
||||
end
|
||||
systemd_r.run_action(:create)
|
||||
# special case here -- must reload unit files if we modified one
|
||||
if systemd_r.updated_by_last_action?
|
||||
new_resource.updated_by_last_action(systemd_r.updated_by_last_action?)
|
||||
|
||||
reload_r = execute "reload-systemd-#{new_resource.service_name}" do
|
||||
command 'systemctl daemon-reload'
|
||||
action :nothing
|
||||
only_if 'which systemctl'
|
||||
end
|
||||
reload_r.run_action(:run)
|
||||
end
|
||||
end
|
||||
|
||||
# flatten in an array here, in case the service_actions are a symbol vs. array
|
||||
[new_resource.service_actions].flatten.each do |act|
|
||||
passthrough_action(act)
|
||||
end
|
||||
end
|
||||
|
||||
# Passthrough actions to service[service_name]
|
||||
#
|
||||
def action_enable
|
||||
passthrough_action(:enable)
|
||||
end
|
||||
|
||||
def action_disable
|
||||
passthrough_action(:disable)
|
||||
end
|
||||
|
||||
def action_start
|
||||
passthrough_action(:start)
|
||||
end
|
||||
|
||||
def action_stop
|
||||
passthrough_action(:stop)
|
||||
end
|
||||
|
||||
def action_restart
|
||||
passthrough_action(:restart)
|
||||
end
|
||||
|
||||
def action_status
|
||||
passthrough_action(:status)
|
||||
end
|
||||
|
||||
def passthrough_action(action)
|
||||
svc_r = lookup_service_resource
|
||||
svc_r.run_action(action)
|
||||
new_resource.updated_by_last_action(true) if svc_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def lookup_service_resource
|
||||
rc = Chef.run_context.resource_collection
|
||||
rc.find("service[#{new_resource.service_name}]")
|
||||
rescue
|
||||
service new_resource.service_name do
|
||||
supports status: true, restart: true
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
end
|
||||
48
cookbooks/elasticsearch/libraries/provider_user.rb
Normal file
48
cookbooks/elasticsearch/libraries/provider_user.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
# Chef Provider for creating a user and group for Elasticsearch
|
||||
class ElasticsearchCookbook::UserProvider < Chef::Provider::LWRPBase
|
||||
include ElasticsearchCookbook::Helpers
|
||||
|
||||
provides :elasticsearch_user
|
||||
|
||||
def whyrun_supported?
|
||||
true # we only use core Chef resources that also support whyrun
|
||||
end
|
||||
|
||||
def action_create
|
||||
group_r = group new_resource.groupname do
|
||||
gid new_resource.gid
|
||||
action :nothing
|
||||
system true
|
||||
end
|
||||
group_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if group_r.updated_by_last_action?
|
||||
|
||||
user_r = user new_resource.username do
|
||||
comment new_resource.comment
|
||||
shell new_resource.shell
|
||||
uid new_resource.uid
|
||||
gid new_resource.groupname
|
||||
|
||||
manage_home false
|
||||
action :nothing
|
||||
system true
|
||||
end
|
||||
user_r.run_action(:create)
|
||||
new_resource.updated_by_last_action(true) if user_r.updated_by_last_action?
|
||||
end
|
||||
|
||||
def action_remove
|
||||
# delete user before deleting the group
|
||||
user_r = user new_resource.username do
|
||||
action :nothing
|
||||
end
|
||||
user_r.run_action(:remove)
|
||||
new_resource.updated_by_last_action(true) if user_r.updated_by_last_action?
|
||||
|
||||
group_r = group new_resource.groupname do
|
||||
action :nothing
|
||||
end
|
||||
group_r.run_action(:remove)
|
||||
new_resource.updated_by_last_action(true) if group_r.updated_by_last_action?
|
||||
end
|
||||
end
|
||||
92
cookbooks/elasticsearch/libraries/resource_configure.rb
Normal file
92
cookbooks/elasticsearch/libraries/resource_configure.rb
Normal file
@@ -0,0 +1,92 @@
|
||||
# Chef Resource for configuring an Elasticsearch node
|
||||
class ElasticsearchCookbook::ConfigureResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_configure
|
||||
provides :elasticsearch_configure
|
||||
|
||||
actions(:manage, :remove)
|
||||
default_action :manage
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String, default: nil)
|
||||
|
||||
# if you override one of these, you should probably override them all
|
||||
attribute(:path_home, kind_of: String, default: '/usr/share/elasticsearch')
|
||||
attribute(:path_conf, kind_of: String, default: '/etc/elasticsearch')
|
||||
attribute(:path_data, kind_of: String, default: '/var/lib/elasticsearch')
|
||||
attribute(:path_logs, kind_of: String, default: '/var/log/elasticsearch')
|
||||
attribute(:path_pid, kind_of: String, default: '/var/run/elasticsearch')
|
||||
attribute(:path_plugins, kind_of: String, default: '/usr/share/elasticsearch/plugins')
|
||||
attribute(:path_bin, kind_of: String, default: '/usr/share/elasticsearch/bin')
|
||||
|
||||
attribute(:template_elasticsearch_env, kind_of: String, default: 'elasticsearch.in.sh.erb')
|
||||
attribute(:cookbook_elasticsearch_env, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
attribute(:template_jvm_options, kind_of: String, default: 'jvm_options.erb')
|
||||
attribute(:cookbook_jvm_options, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
attribute(:template_elasticsearch_yml, kind_of: String, default: 'elasticsearch.yml.erb')
|
||||
attribute(:cookbook_elasticsearch_yml, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
attribute(:template_log4j2_properties, kind_of: String, default: 'log4j2.properties.erb')
|
||||
attribute(:cookbook_log4j2_properties, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
attribute(:logging, kind_of: Hash, default: {}.freeze)
|
||||
attribute(:java_home, kind_of: String, default: nil)
|
||||
|
||||
# other settings in /etc/default or /etc/sysconfig
|
||||
attribute(:memlock_limit, kind_of: String, default: 'unlimited')
|
||||
attribute(:max_map_count, kind_of: String, default: '262144')
|
||||
attribute(:nofile_limit, kind_of: String, default: '65536')
|
||||
attribute(:startup_sleep_seconds, kind_of: [String, Integer], default: 5)
|
||||
attribute(:restart_on_upgrade, kind_of: [TrueClass, FalseClass], default: false)
|
||||
|
||||
# Calculations for this are done in the provider, as we can't do them in the
|
||||
# resource definition. default is 50% of RAM or 31GB, which ever is smaller.
|
||||
attribute(:allocated_memory, kind_of: String)
|
||||
|
||||
attribute(:jvm_options, kind_of: Array, default:
|
||||
%w(
|
||||
-XX:+UseConcMarkSweepGC
|
||||
-XX:CMSInitiatingOccupancyFraction=75
|
||||
-XX:+UseCMSInitiatingOccupancyOnly
|
||||
-XX:+AlwaysPreTouch
|
||||
-server
|
||||
-Xss1m
|
||||
-Djava.awt.headless=true
|
||||
-Dfile.encoding=UTF-8
|
||||
-Djna.nosys=true
|
||||
-XX:-OmitStackTraceInFastThrow
|
||||
-Dio.netty.noUnsafe=true
|
||||
-Dio.netty.noKeySetOptimization=true
|
||||
-Dio.netty.recycler.maxCapacityPerThread=0
|
||||
-Dlog4j.shutdownHookEnabled=false
|
||||
-Dlog4j2.disable.jmx=true
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
).freeze)
|
||||
|
||||
# These are the default settings. Most of the time, you want to override
|
||||
# the `configuration` attribute below. If you do override the defaults, you
|
||||
# must supply ALL needed defaults, and don't use nil as a value in the hash.
|
||||
attribute(:default_configuration, kind_of: Hash, default: {
|
||||
# === NAMING
|
||||
'cluster.name' => 'elasticsearch',
|
||||
# can't access node.name, so expect to have to set set this
|
||||
'node.name' => Chef::Config[:node_name],
|
||||
|
||||
# if omitted or nil, these will be populated from attributes above
|
||||
'path.data' => nil, # see path_data above
|
||||
'path.logs' => nil, # see path_logs above
|
||||
|
||||
# Refer to ES documentation on how to configure these to a
|
||||
# specific node role/type instead of using the defaults
|
||||
#
|
||||
# 'node.data' => ?,
|
||||
# 'node.master' => ?,
|
||||
}.freeze)
|
||||
|
||||
# These settings are merged with the `default_configuration` attribute,
|
||||
# allowing you to override and set specific settings. Unless you intend to
|
||||
# wipe out all default settings, your configuration items should go here.
|
||||
#
|
||||
attribute(:configuration, kind_of: Hash, default: {}.freeze)
|
||||
end
|
||||
31
cookbooks/elasticsearch/libraries/resource_install.rb
Normal file
31
cookbooks/elasticsearch/libraries/resource_install.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# Chef Resource for installing or removing Elasticsearch from package or source
|
||||
class ElasticsearchCookbook::InstallResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_install
|
||||
provides :elasticsearch_install
|
||||
|
||||
actions(:install, :remove)
|
||||
default_action :install
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String)
|
||||
|
||||
# if this version parameter is not set by the caller, we look at
|
||||
# `attributes/default.rb` for a default value to use, or we raise
|
||||
attribute(:version, kind_of: String, default: '7.3.0')
|
||||
|
||||
# we allow a string or symbol for this value
|
||||
attribute(:type, kind_of: String, equal_to: %w(package tarball repository), default: 'repository')
|
||||
|
||||
# these use `attributes/default.rb` for default values per platform and install type
|
||||
attribute(:download_url, kind_of: String)
|
||||
attribute(:download_checksum, kind_of: String) # sha256
|
||||
|
||||
# where to install?
|
||||
attribute(:dir, kind_of: String, default: '/usr/share')
|
||||
|
||||
# attributes used by the package-flavor provider
|
||||
attribute(:package_options, kind_of: String)
|
||||
|
||||
# attributes for the repository-option install
|
||||
attribute(:enable_repository_actions, kind_of: [TrueClass, FalseClass], default: true)
|
||||
end
|
||||
19
cookbooks/elasticsearch/libraries/resource_plugin.rb
Normal file
19
cookbooks/elasticsearch/libraries/resource_plugin.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# Chef Resource for installing an elasticsearch plugin
|
||||
class ElasticsearchCookbook::PluginResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_plugin
|
||||
provides :elasticsearch_plugin
|
||||
|
||||
include ElasticsearchCookbook::Helpers
|
||||
|
||||
actions(:install, :remove)
|
||||
default_action :install
|
||||
|
||||
# if the name or url are different from the resource name
|
||||
attribute(:plugin_name, kind_of: String, name_attribute: true)
|
||||
attribute(:url, kind_of: String, default: nil)
|
||||
attribute(:chef_proxy, kind_of: [TrueClass, FalseClass], default: false)
|
||||
attribute(:options, kind_of: String, default: '')
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String, default: nil)
|
||||
end
|
||||
28
cookbooks/elasticsearch/libraries/resource_service.rb
Normal file
28
cookbooks/elasticsearch/libraries/resource_service.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# Chef Resource for declaring a service for Elasticsearch
|
||||
class ElasticsearchCookbook::ServiceResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_service
|
||||
provides :elasticsearch_service
|
||||
|
||||
actions(
|
||||
:configure, :remove, # our custom actions
|
||||
:enable, :disable, :start, :stop, :restart, :status # passthrough to service resource
|
||||
)
|
||||
default_action :configure
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String, default: nil)
|
||||
|
||||
attribute(:service_name, kind_of: String, name_attribute: true)
|
||||
attribute(:args, kind_of: String, default: '-d')
|
||||
|
||||
# service actions
|
||||
attribute(:service_actions, kind_of: [Symbol, String, Array], default: [:enable, :start].freeze)
|
||||
|
||||
# allow overridable init script
|
||||
attribute(:init_source, kind_of: String, default: 'initscript.erb')
|
||||
attribute(:init_cookbook, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
# allow overridable systemd unit
|
||||
attribute(:systemd_source, kind_of: String, default: 'systemd_unit.erb')
|
||||
attribute(:systemd_cookbook, kind_of: String, default: 'elasticsearch')
|
||||
end
|
||||
19
cookbooks/elasticsearch/libraries/resource_user.rb
Normal file
19
cookbooks/elasticsearch/libraries/resource_user.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# Chef Resource for declaring a user and group for Elasticsearch
|
||||
class ElasticsearchCookbook::UserResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_user
|
||||
provides :elasticsearch_user
|
||||
|
||||
actions(:create, :remove)
|
||||
default_action :create
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String, default: nil)
|
||||
|
||||
attribute(:username, kind_of: String, name_attribute: true) # default to resource name
|
||||
attribute(:uid, kind_of: Integer)
|
||||
attribute(:shell, kind_of: String, default: '/bin/bash')
|
||||
attribute(:comment, kind_of: String, default: 'Elasticsearch User')
|
||||
|
||||
attribute(:groupname, kind_of: String, name_attribute: true) # default to resource name
|
||||
attribute(:gid, kind_of: Integer)
|
||||
end
|
||||
1
cookbooks/elasticsearch/metadata.json
Normal file
1
cookbooks/elasticsearch/metadata.json
Normal file
File diff suppressed because one or more lines are too long
25
cookbooks/elasticsearch/metadata.rb
Normal file
25
cookbooks/elasticsearch/metadata.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# Encoding: utf-8
|
||||
name 'elasticsearch'
|
||||
maintainer 'Karel Minarik'
|
||||
maintainer_email 'karel.minarik@elasticsearch.org'
|
||||
license 'Apache-2.0'
|
||||
description 'Installs and configures Elasticsearch'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '4.2.0'
|
||||
|
||||
supports 'amazon'
|
||||
supports 'centos'
|
||||
supports 'debian'
|
||||
supports 'fedora'
|
||||
supports 'redhat'
|
||||
supports 'ubuntu'
|
||||
|
||||
depends 'apt'
|
||||
depends 'yum'
|
||||
depends 'chef-sugar'
|
||||
depends 'ark'
|
||||
|
||||
issues_url 'https://github.com/elastic/cookbook-elasticsearch/issues'
|
||||
source_url 'https://github.com/elastic/cookbook-elasticsearch'
|
||||
|
||||
chef_version '>= 12.5' if respond_to?(:chef_version)
|
||||
46
cookbooks/elasticsearch/recipes/default.rb
Normal file
46
cookbooks/elasticsearch/recipes/default.rb
Normal file
@@ -0,0 +1,46 @@
|
||||
# Encoding: utf-8
|
||||
#
|
||||
# Cookbook Name:: elasticsearch
|
||||
# Recipe:: default
|
||||
#
|
||||
|
||||
include_recipe 'chef-sugar'
|
||||
|
||||
# see README.md and test/fixtures/cookbooks for more examples!
|
||||
elasticsearch_user 'elasticsearch' do
|
||||
node['elasticsearch']['user'].each do |key, value|
|
||||
# Skip nils, use false if you want to disable something.
|
||||
send(key, value) unless value.nil?
|
||||
end
|
||||
end
|
||||
|
||||
elasticsearch_install 'elasticsearch' do
|
||||
node['elasticsearch']['install'].each do |key, value|
|
||||
# Skip nils, use false if you want to disable something.
|
||||
send(key, value) unless value.nil?
|
||||
end
|
||||
end
|
||||
|
||||
elasticsearch_configure 'elasticsearch' do
|
||||
node['elasticsearch']['configure'].each do |key, value|
|
||||
# Skip nils, use false if you want to disable something.
|
||||
send(key, value) unless value.nil?
|
||||
end
|
||||
end
|
||||
|
||||
elasticsearch_service 'elasticsearch' do
|
||||
node['elasticsearch']['service'].each do |key, value|
|
||||
# Skip nils, use false if you want to disable something.
|
||||
send(key, value) unless value.nil?
|
||||
end
|
||||
end
|
||||
|
||||
# by default, no plugins
|
||||
node['elasticsearch']['plugin'].each do |plugin_name, plugin_value|
|
||||
elasticsearch_plugin plugin_name do
|
||||
plugin_value.each do |key, value|
|
||||
# Skip nils, use false if you want to disable something.
|
||||
send(key, value) unless value.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
180
cookbooks/elasticsearch/templates/amazon/initscript.erb
Normal file
180
cookbooks/elasticsearch/templates/amazon/initscript.erb
Normal file
@@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# <%= @program_name %> <summary>
|
||||
#
|
||||
# chkconfig: 2345 80 20
|
||||
# description: Starts and stops a single elasticsearch instance on this system
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Elasticsearch
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: This service manages the elasticsearch daemon
|
||||
# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# init.d / servicectl compatibility (openSUSE)
|
||||
#
|
||||
if [ -f /etc/rc.status ]; then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
fi
|
||||
|
||||
#
|
||||
# Source function library.
|
||||
#
|
||||
if [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_HOME="/usr/share/elasticsearch"
|
||||
MAX_OPEN_FILES=65536
|
||||
MAX_MAP_COUNT=262144
|
||||
ES_PATH_CONF="/etc/elasticsearch"
|
||||
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
exec="$ES_HOME/bin/elasticsearch"
|
||||
prog="elasticsearch"
|
||||
pidfile="$PID_DIR/${prog}.pid"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
export ES_STARTUP_SLEEP_TIME
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
if [ ! -x "$exec" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
checkJava
|
||||
[ -x $exec ] || exit 5
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
|
||||
touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
|
||||
fi
|
||||
|
||||
cd $ES_HOME
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
# stop it here, often "killproc $prog"
|
||||
killproc -p $pidfile -d 86400 $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status -p $pidfile $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
180
cookbooks/elasticsearch/templates/centos/initscript.erb
Executable file
180
cookbooks/elasticsearch/templates/centos/initscript.erb
Executable file
@@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# <%= @program_name %> <summary>
|
||||
#
|
||||
# chkconfig: 2345 80 20
|
||||
# description: Starts and stops a single elasticsearch instance on this system
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Elasticsearch
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: This service manages the elasticsearch daemon
|
||||
# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# init.d / servicectl compatibility (openSUSE)
|
||||
#
|
||||
if [ -f /etc/rc.status ]; then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
fi
|
||||
|
||||
#
|
||||
# Source function library.
|
||||
#
|
||||
if [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_HOME="/usr/share/elasticsearch"
|
||||
MAX_OPEN_FILES=65536
|
||||
MAX_MAP_COUNT=262144
|
||||
ES_PATH_CONF="/etc/elasticsearch"
|
||||
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
exec="$ES_HOME/bin/elasticsearch"
|
||||
prog="elasticsearch"
|
||||
pidfile="$PID_DIR/${prog}.pid"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
export ES_STARTUP_SLEEP_TIME
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
if [ ! -x "$exec" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
checkJava
|
||||
[ -x $exec ] || exit 5
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
|
||||
touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
|
||||
fi
|
||||
|
||||
cd $ES_HOME
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
# stop it here, often "killproc $prog"
|
||||
killproc -p $pidfile -d 86400 $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status -p $pidfile $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
187
cookbooks/elasticsearch/templates/debian/initscript.erb
Normal file
187
cookbooks/elasticsearch/templates/debian/initscript.erb
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/init.d/<%= @program_name %> -- startup script for Elasticsearch
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: <%= @program_name %>
|
||||
# Required-Start: $network $remote_fs $named
|
||||
# Required-Stop: $network $remote_fs $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Starts elasticsearch
|
||||
# Description: Starts elasticsearch using start-stop-daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
NAME=<%= @program_name %>
|
||||
DESC="Elasticsearch Server"
|
||||
DEFAULT=/etc/default/$NAME
|
||||
|
||||
if [ `id -u` -ne 0 ]; then
|
||||
echo "You need root privileges to run this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -r /etc/default/rcS ]; then
|
||||
. /etc/default/rcS
|
||||
fi
|
||||
|
||||
|
||||
# The following variables can be overwritten in $DEFAULT
|
||||
|
||||
# Directory where the Elasticsearch binary distribution resides
|
||||
ES_HOME=/usr/share/$NAME
|
||||
|
||||
# Additional Java OPTS
|
||||
#ES_JAVA_OPTS=
|
||||
|
||||
# Maximum number of open files
|
||||
MAX_OPEN_FILES=65536
|
||||
|
||||
# Maximum amount of locked memory
|
||||
#MAX_LOCKED_MEMORY=
|
||||
|
||||
# Elasticsearch configuration directory
|
||||
ES_PATH_CONF=/etc/$NAME
|
||||
|
||||
# Maximum number of VMA (Virtual Memory Areas) a process can own
|
||||
MAX_MAP_COUNT=262144
|
||||
|
||||
# Elasticsearch PID file directory
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# End of variables that can be overwritten in $DEFAULT
|
||||
|
||||
# overwrite settings from default file
|
||||
if [ -f "$DEFAULT" ]; then
|
||||
. "$DEFAULT"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
# Define other required variables
|
||||
PID_FILE="$PID_DIR/$NAME.pid"
|
||||
DAEMON=$ES_HOME/bin/elasticsearch
|
||||
DAEMON_OPTS="-d -p $PID_FILE"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
|
||||
if [ ! -x "$DAEMON" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
checkJava
|
||||
|
||||
log_daemon_msg "Starting $DESC"
|
||||
|
||||
pid=`pidofproc -p $PID_FILE elasticsearch`
|
||||
if [ -n "$pid" ] ; then
|
||||
log_begin_msg "Already running."
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then
|
||||
touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE"
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Start Daemon
|
||||
start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
|
||||
return=$?
|
||||
if [ $return -eq 0 ]; then
|
||||
i=0
|
||||
timeout=10
|
||||
# Wait for the process to be properly started before exiting
|
||||
until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1
|
||||
do
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
if [ $i -gt $timeout ]; then
|
||||
log_end_msg 1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
log_end_msg $return
|
||||
exit $return
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC"
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
start-stop-daemon --stop --pidfile "$PID_FILE" \
|
||||
--user elasticsearch \
|
||||
--quiet \
|
||||
--retry forever/TERM/20 > /dev/null
|
||||
if [ $? -eq 1 ]; then
|
||||
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
|
||||
elif [ $? -eq 3 ]; then
|
||||
PID="`cat $PID_FILE`"
|
||||
log_failure_msg "Failed to stop $DESC (pid $PID)"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$PID_FILE"
|
||||
else
|
||||
log_progress_msg "(not running)"
|
||||
fi
|
||||
log_end_msg 0
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
$0 stop
|
||||
fi
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
################################
|
||||
# THIS FILE IS MANAGED BY CHEF
|
||||
################################
|
||||
# Elasticsearch
|
||||
################################
|
||||
# CHANGES MAY BE OVERWRITTEN
|
||||
################################
|
||||
|
||||
<%
|
||||
@params.sort.each do |key, value|
|
||||
next if key.nil? || value.nil?
|
||||
%><%= key.to_s %>=<%= value.to_s %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,8 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# THIS FILE IS MANAGED BY CHEF, DO NOT EDIT MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN!
|
||||
#
|
||||
# Please see the documentation for further information on configuration options:
|
||||
# <https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html>
|
||||
#
|
||||
<% require 'yaml' %>
|
||||
<%= @config.to_yaml.to_s %>
|
||||
@@ -0,0 +1,3 @@
|
||||
## JVM configuration
|
||||
|
||||
<%= @jvm_options %>
|
||||
@@ -0,0 +1,88 @@
|
||||
status = error
|
||||
|
||||
# log action execution errors for easier debugging
|
||||
logger.action.name = org.elasticsearch.action
|
||||
logger.action.level = debug
|
||||
|
||||
appender.console.type = Console
|
||||
appender.console.name = console
|
||||
appender.console.layout.type = PatternLayout
|
||||
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
|
||||
|
||||
appender.rolling.type = RollingFile
|
||||
appender.rolling.name = rolling
|
||||
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
|
||||
appender.rolling.layout.type = PatternLayout
|
||||
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
|
||||
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
|
||||
appender.rolling.policies.type = Policies
|
||||
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
|
||||
appender.rolling.policies.time.interval = 1
|
||||
appender.rolling.policies.time.modulate = true
|
||||
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
|
||||
appender.rolling.policies.size.size = 128MB
|
||||
appender.rolling.strategy.type = DefaultRolloverStrategy
|
||||
appender.rolling.strategy.fileIndex = nomax
|
||||
appender.rolling.strategy.action.type = Delete
|
||||
appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path}
|
||||
appender.rolling.strategy.action.condition.type = IfFileName
|
||||
appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
|
||||
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
|
||||
appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
|
||||
|
||||
rootLogger.level = info
|
||||
rootLogger.appenderRef.console.ref = console
|
||||
rootLogger.appenderRef.rolling.ref = rolling
|
||||
|
||||
appender.deprecation_rolling.type = RollingFile
|
||||
appender.deprecation_rolling.name = deprecation_rolling
|
||||
appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log
|
||||
appender.deprecation_rolling.layout.type = PatternLayout
|
||||
appender.deprecation_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
|
||||
appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.log.gz
|
||||
appender.deprecation_rolling.policies.type = Policies
|
||||
appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
|
||||
appender.deprecation_rolling.policies.size.size = 1GB
|
||||
appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
|
||||
appender.deprecation_rolling.strategy.max = 4
|
||||
|
||||
logger.deprecation.name = org.elasticsearch.deprecation
|
||||
logger.deprecation.level = warn
|
||||
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
|
||||
logger.deprecation.additivity = false
|
||||
|
||||
appender.index_search_slowlog_rolling.type = RollingFile
|
||||
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
|
||||
appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog.log
|
||||
appender.index_search_slowlog_rolling.layout.type = PatternLayout
|
||||
appender.index_search_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
|
||||
appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog-%d{yyyy-MM-dd}.log
|
||||
appender.index_search_slowlog_rolling.policies.type = Policies
|
||||
appender.index_search_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
|
||||
appender.index_search_slowlog_rolling.policies.time.interval = 1
|
||||
appender.index_search_slowlog_rolling.policies.time.modulate = true
|
||||
|
||||
logger.index_search_slowlog_rolling.name = index.search.slowlog
|
||||
logger.index_search_slowlog_rolling.level = trace
|
||||
logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling
|
||||
logger.index_search_slowlog_rolling.additivity = false
|
||||
|
||||
appender.index_indexing_slowlog_rolling.type = RollingFile
|
||||
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
|
||||
appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog.log
|
||||
appender.index_indexing_slowlog_rolling.layout.type = PatternLayout
|
||||
appender.index_indexing_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
|
||||
appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog-%d{yyyy-MM-dd}.log
|
||||
appender.index_indexing_slowlog_rolling.policies.type = Policies
|
||||
appender.index_indexing_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
|
||||
appender.index_indexing_slowlog_rolling.policies.time.interval = 1
|
||||
appender.index_indexing_slowlog_rolling.policies.time.modulate = true
|
||||
|
||||
logger.index_indexing_slowlog.name = index.indexing.slowlog.index
|
||||
logger.index_indexing_slowlog.level = trace
|
||||
logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling
|
||||
logger.index_indexing_slowlog.additivity = false
|
||||
|
||||
<% @logging.each do |k,v| %>
|
||||
<%= k %>=<%= v %>
|
||||
<% end %>
|
||||
@@ -0,0 +1 @@
|
||||
vm.max_map_count=262144
|
||||
60
cookbooks/elasticsearch/templates/default/systemd_unit.erb
Normal file
60
cookbooks/elasticsearch/templates/default/systemd_unit.erb
Normal file
@@ -0,0 +1,60 @@
|
||||
[Unit]
|
||||
Description=Elasticsearch
|
||||
Documentation=http://www.elastic.co
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
RuntimeDirectory=elasticsearch
|
||||
Environment=ES_HOME=/usr/share/elasticsearch
|
||||
Environment=ES_PATH_CONF=/etc/elasticsearch
|
||||
Environment=PID_DIR=/var/run/elasticsearch
|
||||
EnvironmentFile=-<%= @default_dir %>/<%= @program_name %>
|
||||
|
||||
WorkingDirectory=<%= @path_home %>
|
||||
|
||||
User=elasticsearch
|
||||
Group=elasticsearch
|
||||
|
||||
ExecStart=<%= @path_home %>/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet
|
||||
|
||||
# StandardOutput is configured to redirect to journalctl since
|
||||
# some error messages may be logged in standard output before
|
||||
# elasticsearch logging system is initialized. Elasticsearch
|
||||
# stores its logs in /var/log/elasticsearch and does not use
|
||||
# journalctl by default. If you also want to enable journalctl
|
||||
# logging, you can simply remove the "quiet" option from ExecStart.
|
||||
StandardOutput=journal
|
||||
StandardError=inherit
|
||||
|
||||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
LimitNOFILE=65536
|
||||
|
||||
# Specifies the maximum number of processes
|
||||
LimitNPROC=4096
|
||||
|
||||
# Specifies the maximum size of virtual memory
|
||||
LimitAS=infinity
|
||||
|
||||
# Specifies the maximum file size
|
||||
LimitFSIZE=infinity
|
||||
|
||||
# Disable timeout logic and wait until process is stopped
|
||||
TimeoutStopSec=0
|
||||
|
||||
# SIGTERM signal is used to stop the Java process
|
||||
KillSignal=SIGTERM
|
||||
|
||||
# Send the signal only to the JVM rather than its control group
|
||||
KillMode=process
|
||||
|
||||
# Java process is never killed
|
||||
SendSIGKILL=no
|
||||
|
||||
# When a JVM receives a SIGTERM signal it exits with code 143
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
# Built for distribution-6.0.0 (distribution)
|
||||
@@ -0,0 +1 @@
|
||||
d /var/run/elasticsearch 0755 elasticsearch elasticsearch - -
|
||||
180
cookbooks/elasticsearch/templates/oracle/initscript.erb
Executable file
180
cookbooks/elasticsearch/templates/oracle/initscript.erb
Executable file
@@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# <%= @program_name %> <summary>
|
||||
#
|
||||
# chkconfig: 2345 80 20
|
||||
# description: Starts and stops a single elasticsearch instance on this system
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Elasticsearch
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: This service manages the elasticsearch daemon
|
||||
# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# init.d / servicectl compatibility (openSUSE)
|
||||
#
|
||||
if [ -f /etc/rc.status ]; then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
fi
|
||||
|
||||
#
|
||||
# Source function library.
|
||||
#
|
||||
if [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_HOME="/usr/share/elasticsearch"
|
||||
MAX_OPEN_FILES=65536
|
||||
MAX_MAP_COUNT=262144
|
||||
ES_PATH_CONF="/etc/elasticsearch"
|
||||
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
exec="$ES_HOME/bin/elasticsearch"
|
||||
prog="elasticsearch"
|
||||
pidfile="$PID_DIR/${prog}.pid"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
export ES_STARTUP_SLEEP_TIME
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
if [ ! -x "$exec" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
checkJava
|
||||
[ -x $exec ] || exit 5
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
|
||||
touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
|
||||
fi
|
||||
|
||||
cd $ES_HOME
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
# stop it here, often "killproc $prog"
|
||||
killproc -p $pidfile -d 86400 $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status -p $pidfile $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
180
cookbooks/elasticsearch/templates/redhat/initscript.erb
Normal file
180
cookbooks/elasticsearch/templates/redhat/initscript.erb
Normal file
@@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# <%= @program_name %> <summary>
|
||||
#
|
||||
# chkconfig: 2345 80 20
|
||||
# description: Starts and stops a single elasticsearch instance on this system
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Elasticsearch
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: This service manages the elasticsearch daemon
|
||||
# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# init.d / servicectl compatibility (openSUSE)
|
||||
#
|
||||
if [ -f /etc/rc.status ]; then
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
fi
|
||||
|
||||
#
|
||||
# Source function library.
|
||||
#
|
||||
if [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_HOME="/usr/share/elasticsearch"
|
||||
MAX_OPEN_FILES=65536
|
||||
MAX_MAP_COUNT=262144
|
||||
ES_PATH_CONF="/etc/elasticsearch"
|
||||
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
exec="$ES_HOME/bin/elasticsearch"
|
||||
prog="elasticsearch"
|
||||
pidfile="$PID_DIR/${prog}.pid"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
export ES_STARTUP_SLEEP_TIME
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
if [ ! -x "$exec" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
checkJava
|
||||
[ -x $exec ] || exit 5
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
|
||||
touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
|
||||
fi
|
||||
|
||||
cd $ES_HOME
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
# stop it here, often "killproc $prog"
|
||||
killproc -p $pidfile -d 86400 $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status -p $pidfile $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
187
cookbooks/elasticsearch/templates/ubuntu/initscript.erb
Executable file
187
cookbooks/elasticsearch/templates/ubuntu/initscript.erb
Executable file
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# /etc/init.d/<%= @program_name %> -- startup script for Elasticsearch
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: <%= @program_name %>
|
||||
# Required-Start: $network $remote_fs $named
|
||||
# Required-Stop: $network $remote_fs $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Starts elasticsearch
|
||||
# Description: Starts elasticsearch using start-stop-daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
NAME=<%= @program_name %>
|
||||
DESC="Elasticsearch Server"
|
||||
DEFAULT=/etc/default/$NAME
|
||||
|
||||
if [ `id -u` -ne 0 ]; then
|
||||
echo "You need root privileges to run this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -r /etc/default/rcS ]; then
|
||||
. /etc/default/rcS
|
||||
fi
|
||||
|
||||
|
||||
# The following variables can be overwritten in $DEFAULT
|
||||
|
||||
# Directory where the Elasticsearch binary distribution resides
|
||||
ES_HOME=/usr/share/$NAME
|
||||
|
||||
# Additional Java OPTS
|
||||
#ES_JAVA_OPTS=
|
||||
|
||||
# Maximum number of open files
|
||||
MAX_OPEN_FILES=65536
|
||||
|
||||
# Maximum amount of locked memory
|
||||
#MAX_LOCKED_MEMORY=
|
||||
|
||||
# Elasticsearch configuration directory
|
||||
ES_PATH_CONF=/etc/$NAME
|
||||
|
||||
# Maximum number of VMA (Virtual Memory Areas) a process can own
|
||||
MAX_MAP_COUNT=262144
|
||||
|
||||
# Elasticsearch PID file directory
|
||||
PID_DIR="/var/run/elasticsearch"
|
||||
|
||||
# End of variables that can be overwritten in $DEFAULT
|
||||
|
||||
# overwrite settings from default file
|
||||
if [ -f "$DEFAULT" ]; then
|
||||
. "$DEFAULT"
|
||||
fi
|
||||
|
||||
<% if @install_type != 'tarball' %>
|
||||
# ES_USER and ES_GROUP settings were removed
|
||||
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
|
||||
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
|
||||
exit 1
|
||||
fi
|
||||
<% end %>
|
||||
|
||||
# Define other required variables
|
||||
PID_FILE="$PID_DIR/$NAME.pid"
|
||||
DAEMON=$ES_HOME/bin/elasticsearch
|
||||
DAEMON_OPTS="-d -p $PID_FILE"
|
||||
|
||||
export ES_JAVA_OPTS
|
||||
export JAVA_HOME
|
||||
export ES_PATH_CONF
|
||||
|
||||
if [ ! -x "$DAEMON" ]; then
|
||||
echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkJava() {
|
||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA=`which java`
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVA" ]; then
|
||||
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
checkJava
|
||||
|
||||
log_daemon_msg "Starting $DESC"
|
||||
|
||||
pid=`pidofproc -p $PID_FILE elasticsearch`
|
||||
if [ -n "$pid" ] ; then
|
||||
log_begin_msg "Already running."
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
|
||||
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
|
||||
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
|
||||
fi
|
||||
if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then
|
||||
touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE"
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
# Start Daemon
|
||||
start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
|
||||
return=$?
|
||||
if [ $return -eq 0 ]; then
|
||||
i=0
|
||||
timeout=10
|
||||
# Wait for the process to be properly started before exiting
|
||||
until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1
|
||||
do
|
||||
sleep 1
|
||||
i=$(($i + 1))
|
||||
if [ $i -gt $timeout ]; then
|
||||
log_end_msg 1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
log_end_msg $return
|
||||
exit $return
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC"
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
start-stop-daemon --stop --pidfile "$PID_FILE" \
|
||||
--user elasticsearch \
|
||||
--quiet \
|
||||
--retry forever/TERM/20 > /dev/null
|
||||
if [ $? -eq 1 ]; then
|
||||
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
|
||||
elif [ $? -eq 3 ]; then
|
||||
PID="`cat $PID_FILE`"
|
||||
log_failure_msg "Failed to stop $DESC (pid $PID)"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$PID_FILE"
|
||||
else
|
||||
log_progress_msg "(not running)"
|
||||
fi
|
||||
log_end_msg 0
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
$0 stop
|
||||
fi
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user