├── .editorconfig ├── .envrc ├── .gitattributes ├── .github ├── CODEOWNERS ├── lock.yml └── workflows │ ├── ci.yml │ └── stale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .overcommit.yml ├── .vscode └── extensions.json ├── .yamllint ├── Berksfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile ├── FAQ.md ├── LICENSE ├── README.md ├── TESTING.md ├── chefignore ├── documentation ├── .gitkeep ├── configure.md ├── install.md ├── install_package.md ├── install_repository.md ├── plugin.md ├── service.md └── user.md ├── files └── elasticsearch.asc ├── kitchen.dokken.yml ├── kitchen.exec.yml ├── kitchen.global.yml ├── kitchen.yml ├── libraries ├── helpers.rb └── versions.rb ├── metadata.rb ├── renovate.json ├── resources ├── configure.rb ├── install.rb ├── install_package.rb ├── install_repository.rb ├── partial │ ├── _common.rb │ ├── _package.rb │ └── _repository.rb ├── plugin.rb ├── service.rb └── user.rb ├── spec ├── install_spec.rb ├── plugin_proxy_spec.rb ├── spec_helper.rb └── user_spec.rb ├── templates ├── amazon │ └── initscript.erb ├── centos │ └── initscript.erb ├── debian │ └── initscript.erb ├── default │ ├── elasticsearch.in.sh.erb │ ├── elasticsearch.yml.erb │ ├── jvm_options.erb │ ├── log4j2.properties.erb │ ├── sysctl.d-elasticsearch.conf.erb │ ├── systemd_unit.erb │ └── tmpfiles.d-elasticsearch.conf.erb ├── oracle │ └── initscript.erb ├── redhat │ └── initscript.erb └── ubuntu │ └── initscript.erb └── test ├── fixtures ├── cookbooks │ └── test │ │ ├── metadata.rb │ │ └── recipes │ │ ├── default_with_plugins.rb │ │ ├── doubleinstances.rb │ │ ├── fix_cacerts.rb │ │ ├── package.rb │ │ ├── tarball.rb │ │ └── user.rb └── environments │ └── chefspec.json └── integration ├── default ├── controls │ ├── extension_spec.rb │ ├── service_spec.rb │ └── user_spec.rb └── inspec.yml ├── package ├── controls │ └── package_test.rb └── inspec.yml └── repository ├── controls └── default_spec.rb └── inspec.yml /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root=true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | indent_style = space 13 | indent_size = 2 14 | 15 | # Avoid issues parsing cookbook files later 16 | charset = utf-8 17 | 18 | # Avoid cookstyle warnings 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | daysUntilLock: 365 3 | exemptLabels: [] 4 | lockLabel: false 5 | lockComment: > 6 | This thread has been automatically locked since there has not been 7 | any recent activity after it was closed. Please open a new issue for 8 | related bugs. 9 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: [main] 8 | 9 | jobs: 10 | lint-unit: 11 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 12 | permissions: 13 | actions: write 14 | checks: write 15 | pull-requests: write 16 | statuses: write 17 | issues: write 18 | 19 | integration: 20 | needs: lint-unit 21 | runs-on: ubuntu-latest 22 | strategy: 23 | matrix: 24 | os: 25 | - almalinux-8 26 | - almalinux-9 27 | # - amazonlinux-2023 28 | - centos-stream-9 29 | - debian-11 30 | - debian-12 31 | - fedora-latest 32 | # - opensuse-leap-15 33 | - rockylinux-8 34 | - rockylinux-9 35 | - ubuntu-2004 36 | - ubuntu-2204 37 | - ubuntu-2404 38 | suite: 39 | - repository 40 | - package 41 | fail-fast: false 42 | 43 | steps: 44 | - name: Check out code 45 | uses: actions/checkout@v4 46 | - name: Install Chef 47 | uses: actionshub/chef-install@main 48 | - name: Dokken 49 | uses: actionshub/test-kitchen@main 50 | env: 51 | CHEF_LICENSE: accept-no-persist 52 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 53 | with: 54 | suite: ${{ matrix.suite }} 55 | os: ${{ matrix.os }} 56 | - name: Print debug output on failure 57 | if: failure() 58 | run: | 59 | set -x 60 | sudo journalctl -l --since today 61 | KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l" 62 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mark stale issues and pull requests 3 | 4 | "on": 5 | schedule: [cron: "0 0 * * *"] 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v9 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | close-issue-message: > 15 | Closing due to inactivity. 16 | If this is still an issue please reopen or open another issue. 17 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 18 | Thanks, Sous-Chefs. 19 | days-before-close: 7 20 | days-before-stale: 365 21 | stale-issue-message: > 22 | Marking stale due to inactivity. 23 | Remove stale label or comment or this will be closed in 7 days. 24 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 25 | Thanks, Sous-Chefs. 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .config 3 | InstalledFiles 4 | pkg 5 | test/tmp 6 | test/version_tmp 7 | tmp 8 | _Store 9 | *~ 10 | *# 11 | .#* 12 | \#*# 13 | *.un~ 14 | *.tmp 15 | *.bk 16 | *.bkup 17 | 18 | # editor files 19 | .idea 20 | .*.sw[a-z] 21 | 22 | # ruby/bundler/rspec files 23 | .ruby-version 24 | .ruby-gemset 25 | .rvmrc 26 | Gemfile.lock 27 | .bundle 28 | *.gem 29 | coverage 30 | spec/reports 31 | 32 | # YARD / rdoc artifacts 33 | .yardoc 34 | _yardoc 35 | doc/ 36 | rdoc 37 | 38 | # chef infra stuff 39 | Berksfile.lock 40 | .kitchen 41 | kitchen.local.yml 42 | vendor/ 43 | .coverage/ 44 | .zero-knife.rb 45 | Policyfile.lock.json 46 | 47 | # vagrant stuff 48 | .vagrant/ 49 | .vagrant.d/ 50 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | ul-indent: false # MD007 3 | line-length: false # MD013 4 | no-duplicate-heading: false # MD024 5 | reference-links-images: false # MD052 6 | ignores: 7 | - .github/copilot-instructions.md 8 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreCommit: 3 | TrailingWhitespace: 4 | enabled: true 5 | YamlLint: 6 | enabled: true 7 | required_executable: "yamllint" 8 | ChefSpec: 9 | enabled: true 10 | required_executable: "chef" 11 | command: ["chef", "exec", "rspec"] 12 | Cookstyle: 13 | enabled: true 14 | required_executable: "cookstyle" 15 | command: ["cookstyle"] 16 | MarkdownLint: 17 | enabled: false 18 | required_executable: "npx" 19 | command: ["npx", "markdownlint-cli2", "'**/*.md'"] 20 | include: ["**/*.md"] 21 | 22 | CommitMsg: 23 | HardTabs: 24 | enabled: true 25 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "rebornix.ruby", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | rules: 4 | line-length: 5 | max: 256 6 | level: warning 7 | document-start: disable 8 | braces: 9 | forbid: false 10 | min-spaces-inside: 0 11 | max-spaces-inside: 1 12 | min-spaces-inside-empty: -1 13 | max-spaces-inside-empty: -1 14 | comments: 15 | min-spaces-from-content: 1 16 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'test', path: './test/fixtures/cookbooks/test' 7 | end 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # elasticsearch Cookbook Changelog 2 | 3 | ## Unreleased 4 | 5 | ## 5.1.17 - *2024-11-18* 6 | 7 | Standardise files with files in sous-chefs/repo-management 8 | 9 | Standardise files with files in sous-chefs/repo-management 10 | 11 | ## 5.1.16 - *2024-10-24* 12 | 13 | Updated metadata.rb to reflect the need for chef-client version 16.0+ for use of resouce partials 14 | 15 | ## 5.1.15 - *2024-07-15* 16 | 17 | Standardise files with files in sous-chefs/repo-management 18 | 19 | Standardise files with files in sous-chefs/repo-management 20 | 21 | ## 5.1.14 - *2024-05-22* 22 | 23 | ## 5.1.13 - *2024-05-03* 24 | 25 | ## 5.1.12 - *2024-05-03* 26 | 27 | ## 5.1.11 - *2024-05-03* 28 | 29 | ## 5.1.10 - *2023-12-27* 30 | 31 | - Fix property references in install resource 32 | 33 | ## 5.1.9 - *2023-10-31* 34 | 35 | ## 5.1.8 - *2023-10-31* 36 | 37 | ## 5.1.7 - *2023-10-31* 38 | 39 | - Fix markdown errors 40 | 41 | ## 5.1.6 - *2023-09-28* 42 | 43 | ## 5.1.5 - *2023-09-04* 44 | 45 | ## 5.1.4 - *2023-07-10* 46 | 47 | ## 5.1.3 - *2023-05-17* 48 | 49 | ## 5.1.2 - *2023-05-03* 50 | 51 | ## 5.1.1 - *2023-04-07* 52 | 53 | Standardise files with files in sous-chefs/repo-management 54 | 55 | ## 5.1.0 - *2023-04-04* 56 | 57 | ## 5.0.0 - *2023-03-25* 58 | 59 | See below for possible breaking changes. 60 | 61 | - Sous-Chefs Adoption 62 | - Default download to 7.17.9 which is supported until v9 is released 63 | - Remove load_platform_properties and suport test files that were no longer up to date or used 64 | - Remove rubocop ignore files 65 | - Remove the test that checked if a recipe was run 66 | - Update Chef spec tested platforms to: 67 | - Ubuntu: 18.04, 20.04 68 | - CentOS: 7.8.2003, 8 69 | - Sous-Chefs standardization 70 | - Change test cookbook name to test 71 | - Add GitHub Actions pipelines 72 | - Add Dokken configuration 73 | - Add support for testing on non-EOL Operating systems 74 | - Update Chef ignore 75 | - Update .gitignore 76 | - Update CHANGELOG format 77 | - Update CONTRIBUTING format 78 | - Add renovate configuration 79 | - **[BREAKING] Support Chef 15.3+** 80 | - Remove Rakefile 81 | - Remove Gemfile (replaced by Chef Workstation) 82 | - Move rspec files from test/unit/spec to spec 83 | - Remove: .rubocop.yml exceptions 84 | - Remove Rakefile, Gemfile, and Gemfile.lock 85 | - Move .kitchen.yml to kitchen.yml 86 | - Change test cookbook name to test 87 | - Add Dangerfile 88 | - Migrate library files to custom resources 89 | - **[BREAKING] Remove default recipe** 90 | - **[BREAKING] Remove default attributes** 91 | - For usage please see testing cookbook 92 | - **[BREAKING] Remove support for tarball installation** 93 | - Tarball installation does not support running in systemd 94 | - Use the Elasticsearch public key to verify the package rather than downloading the key from the internet on every run 95 | - Use the execute resource over shellout where possible. As this correctly triggers notifications 96 | - Stop depending on yum and apt cookbooks as they are not required 97 | - Remove dertime_download_url helper method and replace with default_downoad_url from Elasticsearch::VersionHelpers 98 | - Remove determine_download_checksum and replace with default_download_checksum from Elasticsearch::VersionHelpers 99 | - Move documentation for resources to the documentation folder 100 | - Split the install resources into multiple resources for clarity 101 | - Move common properties into `partials` 102 | 103 | ## 4.3.1 - *2023-03-23* 104 | 105 | - Standardise files with files in sous-chefs/repo-management 106 | 107 | ## [v4.3.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.3.0) (2019-12-30) 108 | 109 | - Default to Elasticsearch 7.4.2 110 | 111 | ## [v4.2.0](https://github.com/sous-chefs/elasticsearch/tree/v4.2.0) (2019-08-02) 112 | 113 | - Default to Elasticsearch 7.3.0 114 | - Some fixes for the version logic when selecting v7 or higher ES 115 | 116 | ## [v4.1.0](https://github.com/sous-chefs/elasticsearch/tree/v4.1.0) (2019-08-02) 117 | 118 | - Added support for ES 6.8.1, 6.8.2 and new default of 6.8.2 119 | - Added support for ES v7, with 7.0.0, 7.0.1, 7.1.0, 7.2.0, 7.2.1, 7.3.0 120 | - New URL format for ES v7 introduced, taught lib/helpers how to use it 121 | - Bumped testing to use Chef v14 122 | - Modified testing with test-kitchen to stop using x-pack as a test plugin, now using analysis-icu 123 | - Some minor tweaks to get chefspec tests working again 124 | 125 | ## [v4.0.6](https://github.com/sous-chefs/elasticsearch/tree/v4.0.6) (2019-05-22) 126 | 127 | - Lots of new hashes of more recent releases of ES, see PRs for full list (#715, #713, #710, #709, #705, #704, #701). 128 | - Get Travis building again (#714). 129 | 130 | ## [v4.0.5](https://github.com/sous-chefs/elasticsearch/tree/v4.0.5) (2019-01-02) 131 | 132 | - Add hashes for 6.5.4 (#699), 6.5.3 (#697) 133 | 134 | ## [v4.0.4](https://github.com/sous-chefs/elasticsearch/tree/v4.0.4) (2018-11-06) 135 | 136 | - Add hashes for 6.4.2 (#687) 137 | 138 | ## [v4.0.3](https://github.com/sous-chefs/elasticsearch/tree/v4.0.3) (2018-09-24) 139 | 140 | - Add hashes for 6.4.1 (#682) 141 | 142 | ## [v4.0.2](https://github.com/sous-chefs/elasticsearch/tree/v4.0.2) (2018-09-17) 143 | 144 | - Add hashes for 6.3.0 (#669), 6.3.1 (#673), 6.4.0 (#677) 145 | 146 | ## [v4.0.1](https://github.com/sous-chefs/elasticsearch/tree/v4.0.1) (2018-06-01) 147 | 148 | - Add hashes for 6.2.4 (#665) 149 | - Improve ES_USER / ES_GROUP logic for init script and package installs (#647) 150 | 151 | ## [v4.0.0](https://github.com/sous-chefs/elasticsearch/tree/v4.0.0) (2018-03-25) 152 | 153 | - Default to 6.0.0 and add sha256 checksums, drop old 5.x hashes 154 | - Point to 6.x yum repo 155 | - Introduce 6.0.0's JVM options for ES 6 156 | - ES_JVM_OPTIONS is no longer supported in v6.0.0 157 | - Correct tests with x-pack installation 158 | - Remove test for config entry that is no longer valid 159 | - Remove path.conf reference after testing 160 | - Stop testing on Ubuntu 12.04 and earlier 161 | 162 | ## [v3.4.5](https://github.com/sous-chefs/elasticsearch/tree/v3.4.5) (2018-03-25) 163 | 164 | - Add documentation for Java "trust anchors" problem (#646) 165 | - Add hashes for 5.6.8 (#649) 166 | 167 | ## [v3.4.4](https://github.com/sous-chefs/elasticsearch/tree/v3.4.4) (2018-02-01) 168 | 169 | - Add hashes for ES 5.6.6 (#638) and ES 5.6.7 (#640) 170 | 171 | ## [v3.4.3](https://github.com/sous-chefs/elasticsearch/tree/v3.4.3) (2018-01-03) 172 | 173 | - Add hashes for ES 5.6.5 (#632) 174 | 175 | ## [v3.4.2](https://github.com/sous-chefs/elasticsearch/tree/v3.4.2) (2017-12-03) 176 | 177 | - Add hashes for ES 5.6.4 (#622) 178 | 179 | ## [v3.4.1](https://github.com/sous-chefs/elasticsearch/tree/v3.4.1) (2017-10-18) 180 | 181 | - Add hashes for ES 5.6.3 (#616) 182 | 183 | ## [v3.4.0](https://github.com/sous-chefs/elasticsearch/tree/v3.4.0) (2017-09-28) 184 | 185 | - Add hashes for ES 5.6.1 and 5.6.2 (#613) 186 | - Add the latest init scripts from .deb, .rpm, and systemd 187 | 188 | ## [v3.3.1](https://github.com/sous-chefs/elasticsearch/tree/v3.3.1) (2017-09-15) 189 | 190 | - Add hashes for ES 5.6.0 and 5.5.3 (#610) 191 | - Workaround for support 'amazon' platform_family (#609) 192 | 193 | ## [v3.3.0](https://github.com/sous-chefs/elasticsearch/tree/v3.3.0) (2017-08-30) 194 | 195 | - nil templates skip startup scripts (#585) 196 | 197 | ## [v3.2.2](https://github.com/sous-chefs/elasticsearch/tree/v3.2.2) (2017-08-29) 198 | 199 | - Bump ES version to 5.5.2 (#606) 200 | 201 | ## [v3.2.1](https://github.com/sous-chefs/elasticsearch/tree/v3.2.1) (2017-07-17) 202 | 203 | - Bump ES version to 5.5.0, add 5.4.2 and 5.4.3 as well (#594) 204 | 205 | ## [v3.2.0](https://github.com/sous-chefs/elasticsearch/tree/v3.2.0) (2017-05-21) 206 | 207 | - Provide additional documentation about logging options, update template (#577) 208 | - Allow others to read elasticsearch log dir (#570) 209 | - Bump ES version to 5.4.0 (#569) 210 | 211 | ## [v3.1.1](https://github.com/sous-chefs/elasticsearch/tree/v3.1.1) (2017-05-01) 212 | 213 | - Add hashes for ES 5.3.1 (#562) 214 | - Add hashes for ES 5.3.2 (#567) 215 | 216 | ## [v3.1.0](https://github.com/sous-chefs/elasticsearch/tree/v3.1.0) (2017-04-18) 217 | 218 | - Add Chef 13.x support for this cookbook (#561) 219 | - Reintroduce chef_proxy settings (#557) 220 | 221 | ## [v3.0.5](https://github.com/sous-chefs/elasticsearch/tree/v3.0.5) (2017-04-06) 222 | 223 | - Bump ES version to 5.3.0 (#550) 224 | - Fix permissions for elasticsearch.yml and log4j2.properties (#555) 225 | 226 | ## [v3.0.4](https://github.com/sous-chefs/elasticsearch/tree/v3.0.4) (2017-03-02) 227 | 228 | - Bump ES version to 5.2.2 (#550) 229 | 230 | ## [v3.0.3](https://github.com/sous-chefs/elasticsearch/tree/v3.0.3) (2017-02-09) 231 | 232 | - Fix URL support for plugins (#525) 233 | - Add support for versions 5.0.2, 5.1.1, 5.1.2, 5.2.0 234 | - Make 5.2.0 the default version 235 | - Add a note about upgrading to new versions (#527) 236 | - Foodcritic/Rubocop style cleanup 237 | - Fix ruby version build on travis 238 | - remove tarball directory recursively 239 | 240 | ## [v3.0.2](https://github.com/sous-chefs/elasticsearch/tree/v3.0.2) (2016-11-29) 241 | 242 | - Ensure bin/elasticsearch-plugin uses the proper environment (#523) 243 | - Bump default Elasticsearch version from v5.0.0 to v5.0.1 244 | 245 | ## [v3.0.1](https://github.com/sous-chefs/elasticsearch/tree/v3.0.1) (2016-11-09) 246 | 247 | - Fix incorrect MAX_MAP_COUNT default to be '262144' to match init scripts (#516) 248 | 249 | ## [v3.0.0](https://github.com/sous-chefs/elasticsearch/tree/v3.0.0) (2016-11-07) 250 | 251 | Breaking changes that were needed for v5.0.0 support (#497, #512, #424, #478, #503): 252 | 253 | - 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. 254 | - We now start the service by default, instead of only `:enable` but not `:start`. 255 | - 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. 256 | - Install the tarball and package files into the same locations. There's no more `/usr/local`. 257 | - Install types are now 'strings', not :symbols. `node['elasticsearch'][][]` sets any `elasticsearch::default` recipe. 258 | 259 | For more on breaking changes, read [3aa8740](https://github.com/sous-chefs/elasticsearch/commit/3aa8740da5182f4a29761e0ea350048764bc0752) and [1ccd013](https://github.com/sous-chefs/elasticsearch/commit/1ccd013821cbfe83197c1ebba7fdb3acadc3d88f). 260 | 261 | - Switch to the `manage_home false` property of newer Chef versions (#406) 262 | - Use YAML library directly from now on for elasticsearch.yml (#470) 263 | - Add support for Ubuntu 16.04 / CentOS 7.2, both using systemd (#501, #502) 264 | - Support and use 'repository' type on `elasticsearch_install` by default (#476) 265 | - Based on the latest v5.0.0 packages, tweak the permissions for some directories slightly (#513) 266 | - Drop preferIPv4 test (#475), discovery.zen.ping settings (#437), and others. 267 | - Add Java 8 testing by default (#510), bump newer Chef versions (#503, #505) 268 | - Start using exact plugin names, case sensitive (#485) 269 | 270 | ## [v2.4.0](https://github.com/sous-chefs/elasticsearch/tree/v2.4.0) (2016-09-15) 271 | 272 | - 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/sous-chefs/elasticsearch/issues/496) and [\#490](https://github.com/sous-chefs/elasticsearch/issues/490) 273 | - Added a LICENSE file (Apache 2), metadata, and linting 274 | - Remove chef 11 compatibility from metadata, update cookstyle and Berkshelf, various Chef standards [\#481](https://github.com/sous-chefs/elasticsearch/issues/481) 275 | - Improve environment file formatting: Remove quotes from vars that don't need it, strip superfluous spaces from ES_JAVA_OPTS [\#477](https://github.com/sous-chefs/elasticsearch/issues/477) 276 | 277 | ## [v2.3.2](https://github.com/sous-chefs/elasticsearch/tree/v2.3.2) (2016-06-17) 278 | 279 | - Update init scripts and configs to latest [\#461](https://github.com/sous-chefs/elasticsearch/issues/461) 280 | - Don't make environment file executable [\#474](https://github.com/sous-chefs/elasticsearch/issues/474) 281 | - Don't make config YAML file executable [\#465](https://github.com/sous-chefs/elasticsearch/issues/465) 282 | - Make latest Foodcritic rules pass [\#466](https://github.com/sous-chefs/elasticsearch/issues/466) 283 | - ES 2.3.3 SHA256 sums and default version [\#464](https://github.com/sous-chefs/elasticsearch/issues/464) 284 | - Point to determine_download_url instead of non-existent get_package_url [\#463](https://github.com/sous-chefs/elasticsearch/issues/463) 285 | 286 | ## [v2.3.1](https://github.com/sous-chefs/elasticsearch/tree/v2.3.1) (2016-05-06) 287 | 288 | - Update documentation for dir in elasticsearch_install [\#453](https://github.com/sous-chefs/elasticsearch/issues/453) 289 | - Define custom matchers helpers for notification testing [\#458](https://github.com/sous-chefs/elasticsearch/issues/458) 290 | - Add checksums for version 2.3.2 [\#457](https://github.com/sous-chefs/elasticsearch/issues/457) 291 | - Default ES version bump to 2.3.2 [\#459](https://github.com/sous-chefs/elasticsearch/issues/459) 292 | - Fix quoting bug in plugin remove action [\#455](https://github.com/sous-chefs/elasticsearch/issues/455) 293 | - Fix typo in README [\#456](https://github.com/sous-chefs/elasticsearch/issues/456) 294 | 295 | ## [v2.3.0](https://github.com/sous-chefs/elasticsearch/tree/v2.3.0) (2016-04-07) 296 | 297 | - Add checksums for 2.3.1 [\#451](https://github.com/sous-chefs/elasticsearch/issues/451) 298 | 299 | ## [v2.2.2](https://github.com/sous-chefs/elasticsearch/tree/v2.2.2) (2016-03-22) 300 | 301 | - elasticsearch_configure provider should not modify default resource parameters [\#445](https://github.com/sous-chefs/elasticsearch/issues/445) 302 | 303 | ## [v2.2.1](https://github.com/sous-chefs/elasticsearch/tree/v2.2.1) (2016-03-04) 304 | 305 | - Incorrectly setting allocated memory in the `ES\_JAVA\_OPTS` variable [\#434](https://github.com/sous-chefs/elasticsearch/issues/434) 306 | - elasticsearch_service/service_actions accepts (but does not support) Symbols [\#438](https://github.com/sous-chefs/elasticsearch/issues/438) 307 | 308 | ## [v2.2.0](https://github.com/sous-chefs/elasticsearch/tree/v2.2.0) (2016-02-08) 309 | 310 | - Max heap size is too large [\#427](https://github.com/sous-chefs/elasticsearch/issues/427) 311 | - How to define discovery.zen.ping.unicast.hosts [\#426](https://github.com/sous-chefs/elasticsearch/issues/426) 312 | - elasticsearch\_plugin install lacks proxy support [\#415](https://github.com/sous-chefs/elasticsearch/issues/415) 313 | - Default ES version needs upgrading \(2.1.0 \> 2.1.1\) [\#411](https://github.com/sous-chefs/elasticsearch/issues/411) 314 | - config dirs/files and install dirs/files should be owned by root, not es\_user [\#405](https://github.com/sous-chefs/elasticsearch/issues/405) 315 | - Reinstalls elasticserach every chef run [\#404](https://github.com/sous-chefs/elasticsearch/issues/404) 316 | - Permission problem when installing Watcher or Shield [\#423](https://github.com/sous-chefs/elasticsearch/issues/423) 317 | - Installing shield and watcher plugins fail with AccessDeniedException [\#421](https://github.com/sous-chefs/elasticsearch/issues/421) 318 | - Plugin removal is broken [\#418](https://github.com/sous-chefs/elasticsearch/issues/418) 319 | - elasticsearch\_configure documentation example missing path\_home [\#413](https://github.com/sous-chefs/elasticsearch/issues/413) 320 | - Init script can't start [\#390](https://github.com/sous-chefs/elasticsearch/issues/390) 321 | - ruby command not found [\#378](https://github.com/sous-chefs/elasticsearch/issues/378) 322 | - ES 2.2.0 installation fails [\#429](https://github.com/sous-chefs/elasticsearch/issues/429) 323 | - Can't install plugin twice [\#408](https://github.com/sous-chefs/elasticsearch/issues/408) 324 | - Error running recipe on AWS Opsworks [\#403](https://github.com/sous-chefs/elasticsearch/issues/403) 325 | - ES 2.1.0 support [\#402](https://github.com/sous-chefs/elasticsearch/issues/402) 326 | - Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/sous-chefs/elasticsearch/issues/401) 327 | - gateway.expected\_nodes default should be 0 [\#399](https://github.com/sous-chefs/elasticsearch/issues/399) 328 | - Add the defaults for slowlogs in logging.yml [\#398](https://github.com/sous-chefs/elasticsearch/issues/398) 329 | - elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/sous-chefs/elasticsearch/issues/397) 330 | - What is supposed to happen when a config file is changed? [\#394](https://github.com/sous-chefs/elasticsearch/issues/394) 331 | - Doc request - how to create data nodes vs master nodes [\#393](https://github.com/sous-chefs/elasticsearch/issues/393) 332 | - Plugin install isn't idempotent [\#392](https://github.com/sous-chefs/elasticsearch/issues/392) 333 | - Question - Are custom configs required everywhere? [\#391](https://github.com/sous-chefs/elasticsearch/issues/391) 334 | - Is :tarball or :package the preferred installation type? [\#389](https://github.com/sous-chefs/elasticsearch/issues/389) 335 | - Support Amazon platform for init scripts [\#387](https://github.com/sous-chefs/elasticsearch/issues/387) 336 | - "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/sous-chefs/elasticsearch/issues/386) 337 | - Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/sous-chefs/elasticsearch/issues/385) 338 | - Support ES 2.0 [\#384](https://github.com/sous-chefs/elasticsearch/issues/384) 339 | - plugin install does not work [\#382](https://github.com/sous-chefs/elasticsearch/issues/382) 340 | - Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/sous-chefs/elasticsearch/issues/379) 341 | - Allow template cookbook override in \_configure [\#376](https://github.com/sous-chefs/elasticsearch/issues/376) 342 | - 1.0.2 Issues with pid files [\#374](https://github.com/sous-chefs/elasticsearch/issues/374) 343 | - Consider using the resource name as a common shared set of resources [\#373](https://github.com/sous-chefs/elasticsearch/issues/373) 344 | - elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/sous-chefs/elasticsearch/issues/371) 345 | - Compile Error [\#370](https://github.com/sous-chefs/elasticsearch/issues/370) 346 | - wrong number of arguments \(1 for 0\) [\#369](https://github.com/sous-chefs/elasticsearch/issues/369) 347 | - fixes typo in readme [\#428](https://github.com/sous-chefs/elasticsearch/pull/428) ([spuder](https://github.com/spuder)) 348 | - Plugin removal functionality restored [\#420](https://github.com/sous-chefs/elasticsearch/pull/420) ([dbaggott](https://github.com/dbaggott)) 349 | - Update to ES 2.1.1 [\#412](https://github.com/sous-chefs/elasticsearch/pull/412) ([dbaggott](https://github.com/dbaggott)) 350 | - Makes code examples have color [\#396](https://github.com/sous-chefs/elasticsearch/pull/396) ([spuder](https://github.com/spuder)) 351 | - Updates docs to show package are now default install [\#395](https://github.com/sous-chefs/elasticsearch/pull/395) ([spuder](https://github.com/spuder)) 352 | - Update the README to remove a typo [\#381](https://github.com/sous-chefs/elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren)) 353 | - Correct the full changelog links [\#375](https://github.com/sous-chefs/elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick)) 354 | - add missing matchers [\#368](https://github.com/sous-chefs/elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic)) 355 | 356 | ## [v2.1.1](https://github.com/sous-chefs/elasticsearch/tree/v2.1.1) (2016-01-08) 357 | 358 | - elasticsearch\_plugin install lacks proxy support [\#415](https://github.com/sous-chefs/elasticsearch/issues/415) 359 | - Default ES version needs upgrading \(2.1.0 \> 2.1.1\) [\#411](https://github.com/sous-chefs/elasticsearch/issues/411) 360 | - Reinstalls elasticserach every chef run [\#404](https://github.com/sous-chefs/elasticsearch/issues/404) 361 | - Installing shield and watcher plugins fail with AccessDeniedException [\#421](https://github.com/sous-chefs/elasticsearch/issues/421) 362 | - Plugin removal is broken [\#418](https://github.com/sous-chefs/elasticsearch/issues/418) 363 | - elasticsearch\_configure documentation example missing path\_home [\#413](https://github.com/sous-chefs/elasticsearch/issues/413) 364 | - Init script can't start [\#390](https://github.com/sous-chefs/elasticsearch/issues/390) 365 | - ruby command not found [\#378](https://github.com/sous-chefs/elasticsearch/issues/378) 366 | - Can't install plugin twice [\#408](https://github.com/sous-chefs/elasticsearch/issues/408) 367 | - Error running recipe on AWS Opsworks [\#403](https://github.com/sous-chefs/elasticsearch/issues/403) 368 | - ES 2.1.0 support [\#402](https://github.com/sous-chefs/elasticsearch/issues/402) 369 | - Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/sous-chefs/elasticsearch/issues/401) 370 | - gateway.expected\_nodes default should be 0 [\#399](https://github.com/sous-chefs/elasticsearch/issues/399) 371 | - Add the defaults for slowlogs in logging.yml [\#398](https://github.com/sous-chefs/elasticsearch/issues/398) 372 | - elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/sous-chefs/elasticsearch/issues/397) 373 | - What is supposed to happen when a config file is changed? [\#394](https://github.com/sous-chefs/elasticsearch/issues/394) 374 | - Doc request - how to create data nodes vs master nodes [\#393](https://github.com/sous-chefs/elasticsearch/issues/393) 375 | - Plugin install isn't idempotent [\#392](https://github.com/sous-chefs/elasticsearch/issues/392) 376 | - Question - Are custom configs required everywhere? [\#391](https://github.com/sous-chefs/elasticsearch/issues/391) 377 | - Is :tarball or :package the preferred installation type? [\#389](https://github.com/sous-chefs/elasticsearch/issues/389) 378 | - Support Amazon platform for init scripts [\#387](https://github.com/sous-chefs/elasticsearch/issues/387) 379 | - "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/sous-chefs/elasticsearch/issues/386) 380 | - Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/sous-chefs/elasticsearch/issues/385) 381 | - Support ES 2.0 [\#384](https://github.com/sous-chefs/elasticsearch/issues/384) 382 | - plugin install does not work [\#382](https://github.com/sous-chefs/elasticsearch/issues/382) 383 | - Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/sous-chefs/elasticsearch/issues/379) 384 | - Allow template cookbook override in \_configure [\#376](https://github.com/sous-chefs/elasticsearch/issues/376) 385 | - 1.0.2 Issues with pid files [\#374](https://github.com/sous-chefs/elasticsearch/issues/374) 386 | - Consider using the resource name as a common shared set of resources [\#373](https://github.com/sous-chefs/elasticsearch/issues/373) 387 | - elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/sous-chefs/elasticsearch/issues/371) 388 | - Compile Error [\#370](https://github.com/sous-chefs/elasticsearch/issues/370) 389 | - wrong number of arguments \(1 for 0\) [\#369](https://github.com/sous-chefs/elasticsearch/issues/369) 390 | - missing chef resource expectations in specs in 1.0.1 [\#367](https://github.com/sous-chefs/elasticsearch/issues/367) 391 | - Use predictable attributes/values for version, download URL, and checksum [\#366](https://github.com/sous-chefs/elasticsearch/issues/366) 392 | - Rubocop & foodcritic cleanup [\#365](https://github.com/sous-chefs/elasticsearch/issues/365) 393 | - elasticsearch\_plugin installs plugins with the wrong permissions [\#363](https://github.com/sous-chefs/elasticsearch/issues/363) 394 | - Double-dependency on curl [\#360](https://github.com/sous-chefs/elasticsearch/issues/360) 395 | - OS X Support [\#358](https://github.com/sous-chefs/elasticsearch/issues/358) 396 | - Plugin removal functionality restored [\#420](https://github.com/sous-chefs/elasticsearch/pull/420) ([dbaggott](https://github.com/dbaggott)) 397 | - Update to ES 2.1.1 [\#412](https://github.com/sous-chefs/elasticsearch/pull/412) ([dbaggott](https://github.com/dbaggott)) 398 | - Makes code examples have color [\#396](https://github.com/sous-chefs/elasticsearch/pull/396) ([spuder](https://github.com/spuder)) 399 | - Updates docs to show package are now default install [\#395](https://github.com/sous-chefs/elasticsearch/pull/395) ([spuder](https://github.com/spuder)) 400 | - Update the README to remove a typo [\#381](https://github.com/sous-chefs/elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren)) 401 | - Correct the full changelog links [\#375](https://github.com/sous-chefs/elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick)) 402 | - add missing matchers [\#368](https://github.com/sous-chefs/elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic)) 403 | - Adds integration test for plugins in default environment [\#361](https://github.com/sous-chefs/elasticsearch/pull/361) ([bwvoss](https://github.com/bwvoss)) 404 | 405 | ## [2.1.0](https://github.com/sous-chefs/elasticsearch/tree/v2.1.0) (2015-12-01) 406 | 407 | - ES 2.1.0 support [\#402](https://github.com/sous-chefs/elasticsearch/issues/402) 408 | 409 | ## [2.0.1](https://github.com/sous-chefs/elasticsearch/tree/v2.0.1) (2015-12-01) 410 | 411 | - Any provision to make it Chef 11.10 compatible? [\#401](https://github.com/sous-chefs/elasticsearch/issues/401) 412 | - gateway.expected\_nodes default should be 0 [\#399](https://github.com/sous-chefs/elasticsearch/issues/399) 413 | - Add the defaults for slowlogs in logging.yml [\#398](https://github.com/sous-chefs/elasticsearch/issues/398) 414 | 415 | ## [2.0.0](https://github.com/sous-chefs/elasticsearch/tree/v2.0.0) (2015-11-23) 416 | 417 | - Upgrading by package needs cleanup [\#331](https://github.com/sous-chefs/elasticsearch/issues/331) 418 | - Minimal init scripts, preferrably from the packaged versions of ES [\#321](https://github.com/sous-chefs/elasticsearch/issues/321) 419 | - Remove extra env file, or follow packaged conventions [\#320](https://github.com/sous-chefs/elasticsearch/issues/320) 420 | - Remove system limit adjustments [\#319](https://github.com/sous-chefs/elasticsearch/issues/319) 421 | - Init script can't start [\#390](https://github.com/sous-chefs/elasticsearch/issues/390) 422 | - elasticsearch\_service resource doesn't work with short syntax [\#397](https://github.com/sous-chefs/elasticsearch/issues/397) 423 | - What is supposed to happen when a config file is changed? [\#394](https://github.com/sous-chefs/elasticsearch/issues/394) 424 | - Doc request - how to create data nodes vs master nodes [\#393](https://github.com/sous-chefs/elasticsearch/issues/393) 425 | - Plugin install isn't idempotent [\#392](https://github.com/sous-chefs/elasticsearch/issues/392) 426 | - Question - Are custom configs required everywhere? [\#391](https://github.com/sous-chefs/elasticsearch/issues/391) 427 | - Is :tarball or :package the preferred installation type? [\#389](https://github.com/sous-chefs/elasticsearch/issues/389) 428 | - Support Amazon platform for init scripts [\#387](https://github.com/sous-chefs/elasticsearch/issues/387) 429 | - "ArgumentError: wrong number of arguments \(1 for 0\)" at resource\_configure.rb [\#386](https://github.com/sous-chefs/elasticsearch/issues/386) 430 | - Do I need to do a Java Installation myself for this to work? [\#385](https://github.com/sous-chefs/elasticsearch/issues/385) 431 | - plugin install does not work [\#382](https://github.com/sous-chefs/elasticsearch/issues/382) 432 | - Allow template cookbook override in \_configure [\#376](https://github.com/sous-chefs/elasticsearch/issues/376) 433 | - Consider using the resource name as a common shared set of resources [\#373](https://github.com/sous-chefs/elasticsearch/issues/373) 434 | - Recreate deploying-elasticsearch-with-chef tutorial [\#293](https://github.com/sous-chefs/elasticsearch/issues/293) 435 | - Makes code examples have color [\#396](https://github.com/sous-chefs/elasticsearch/pull/396) ([spuder](https://github.com/spuder)) 436 | - Updates docs to show package are now default install [\#395](https://github.com/sous-chefs/elasticsearch/pull/395) ([spuder](https://github.com/spuder)) 437 | 438 | ## [1.2.0](https://github.com/sous-chefs/elasticsearch/tree/v1.2.0) (2015-10-16) 439 | 440 | - Compile error w/ 1.0.3 and Chef Server 12 [\#379](https://github.com/sous-chefs/elasticsearch/issues/379) 441 | - OS X Support [\#358](https://github.com/sous-chefs/elasticsearch/issues/358) 442 | - Dealing with plugin versions that don't match, Elasticsearch failing to start [\#330](https://github.com/sous-chefs/elasticsearch/issues/330) 443 | - ruby command not found [\#378](https://github.com/sous-chefs/elasticsearch/issues/378) 444 | - Update the README to remove a typo [\#381](https://github.com/sous-chefs/elasticsearch/pull/381) ([jtwarren](https://github.com/jtwarren)) 445 | - Correct the full changelog links [\#375](https://github.com/sous-chefs/elasticsearch/pull/375) ([eheydrick](https://github.com/eheydrick)) 446 | 447 | ## [1.0.3](https://github.com/sous-chefs/elasticsearch/tree/v1.0.3) (2015-09-20) 448 | 449 | - 1.0.2 Issues with pid files [\#374](https://github.com/sous-chefs/elasticsearch/issues/374) 450 | 451 | ## [1.0.2](https://github.com/sous-chefs/elasticsearch/tree/v1.0.2) (2015-09-20) 452 | 453 | - enhancement : attribut path\_xxx and path.xxx [\#352](https://github.com/sous-chefs/elasticsearch/issues/352) 454 | - It would be nice to be able to pass options to elasticsearch\_service [\#334](https://github.com/sous-chefs/elasticsearch/issues/334) 455 | - elasticsearch\_install broken with v1.0.1 [\#371](https://github.com/sous-chefs/elasticsearch/issues/371) 456 | - Compile Error [\#370](https://github.com/sous-chefs/elasticsearch/issues/370) 457 | - wrong number of arguments \(1 for 0\) [\#369](https://github.com/sous-chefs/elasticsearch/issues/369) 458 | - missing chef resource expectations in specs in 1.0.1 [\#367](https://github.com/sous-chefs/elasticsearch/issues/367) 459 | - Rubocop & foodcritic cleanup [\#365](https://github.com/sous-chefs/elasticsearch/issues/365) 460 | - add missing matchers [\#368](https://github.com/sous-chefs/elasticsearch/pull/368) ([thomasdziedzic](https://github.com/thomasdziedzic)) 461 | 462 | ## [1.0.1](https://github.com/sous-chefs/elasticsearch/tree/v1.0.1) (2015-09-15) 463 | 464 | - Plugin resource's plugin\_dir should have a sensible default [\#345](https://github.com/sous-chefs/elasticsearch/issues/345) 465 | - Elasticsearch user homedir deleted [\#328](https://github.com/sous-chefs/elasticsearch/issues/328) 466 | - Use predictable attributes/values for version, download URL, and checksum [\#366](https://github.com/sous-chefs/elasticsearch/issues/366) 467 | - elasticsearch\_plugin installs plugins with the wrong permissions [\#363](https://github.com/sous-chefs/elasticsearch/issues/363) 468 | - Double-dependency on curl [\#360](https://github.com/sous-chefs/elasticsearch/issues/360) 469 | - poise dependency not found [\#356](https://github.com/sous-chefs/elasticsearch/issues/356) 470 | - Documentation for using JSON node configuration [\#355](https://github.com/sous-chefs/elasticsearch/issues/355) 471 | - Hardcoded checksums in library helpers [\#350](https://github.com/sous-chefs/elasticsearch/issues/350) 472 | - Document default values for all resources [\#348](https://github.com/sous-chefs/elasticsearch/issues/348) 473 | - 1.0 should have sensible documentation [\#344](https://github.com/sous-chefs/elasticsearch/issues/344) 474 | - Adds integration test for plugins in default environment [\#361](https://github.com/sous-chefs/elasticsearch/pull/361) ([bwvoss](https://github.com/bwvoss)) 475 | - Clarify when overriding plugin\_dir is necessary [\#349](https://github.com/sous-chefs/elasticsearch/pull/349) ([michaelklishin](https://github.com/michaelklishin)) 476 | - Remove duplicate node.max\_local\_storage\_nodes setting from the config template [\#346](https://github.com/sous-chefs/elasticsearch/pull/346) ([eheydrick](https://github.com/eheydrick)) 477 | 478 | ## [v1.0.0](https://github.com/sous-chefs/elasticsearch/tree/v1.0.0) (2015-07-16) 479 | 480 | - Rename source method of install [\#332](https://github.com/sous-chefs/elasticsearch/issues/332) 481 | - NEXT: Document the process for submitting PRs [\#270](https://github.com/sous-chefs/elasticsearch/issues/270) 482 | - Travis CI not running on PRs from local branches [\#337](https://github.com/sous-chefs/elasticsearch/issues/337) 483 | - Error executing action `install` on resource 'elasticsearch\_install' [\#335](https://github.com/sous-chefs/elasticsearch/issues/335) 484 | - Document requirement on Chef 12+ [\#338](https://github.com/sous-chefs/elasticsearch/issues/338) 485 | - Add lots of additional documentation [\#343](https://github.com/sous-chefs/elasticsearch/pull/343) ([martinb3](https://github.com/martinb3)) 486 | - Add contribution guidelines [\#342](https://github.com/sous-chefs/elasticsearch/pull/342) ([martinb3](https://github.com/martinb3)) 487 | - Run CI on master branch again, after rename [\#341](https://github.com/sous-chefs/elasticsearch/pull/341) ([martinb3](https://github.com/martinb3)) 488 | - Rename provider source to tarball [\#340](https://github.com/sous-chefs/elasticsearch/pull/340) ([martinb3](https://github.com/martinb3)) 489 | 490 | ## [v0.3.14](https://github.com/sous-chefs/elasticsearch/tree/v0.3.14) (2015-07-16) 491 | 492 | - NEXT: Model YML config after 'trim' config [\#322](https://github.com/sous-chefs/elasticsearch/issues/322) 493 | - NEXT: Create a user resource and provider [\#269](https://github.com/sous-chefs/elasticsearch/issues/269) 494 | - If bootstrap.mlockall is true, MAX\_LOCKED\_MEMORY should be set to unlimited in elasticsearch-env.sh [\#266](https://github.com/sous-chefs/elasticsearch/issues/266) 495 | - Installation enhancement [\#222](https://github.com/sous-chefs/elasticsearch/issues/222) 496 | - Plugins defined in databag do not get installed [\#89](https://github.com/sous-chefs/elasticsearch/issues/89) 497 | - There is no customize recipe [\#326](https://github.com/sous-chefs/elasticsearch/issues/326) 498 | - ES not starting when setting version to 1.5.2 or 1.6.0 [\#325](https://github.com/sous-chefs/elasticsearch/issues/325) 499 | - Question - Does cookbook support rolling restarts? [\#315](https://github.com/sous-chefs/elasticsearch/issues/315) 500 | - Loading attributes from the data DBI [\#313](https://github.com/sous-chefs/elasticsearch/issues/313) 501 | - 0.3.13: service doesn't successfully start [\#312](https://github.com/sous-chefs/elasticsearch/issues/312) 502 | - Restart doesn't work the first time if a stale PID exists [\#310](https://github.com/sous-chefs/elasticsearch/issues/310) 503 | - Cannot install plugin 2.4.1 [\#308](https://github.com/sous-chefs/elasticsearch/issues/308) 504 | - Proxy recipe should include nginx only based on configurabe attribute [\#307](https://github.com/sous-chefs/elasticsearch/issues/307) 505 | - Queue capacity [\#301](https://github.com/sous-chefs/elasticsearch/issues/301) 506 | - strange behavior with docker :bug: [\#300](https://github.com/sous-chefs/elasticsearch/issues/300) 507 | - Vagrant: Undefined method 'provider' [\#298](https://github.com/sous-chefs/elasticsearch/issues/298) 508 | - Error after upgrading the cookbook [\#297](https://github.com/sous-chefs/elasticsearch/issues/297) 509 | - Setting version triggers java.lang.NoClassDefFoundError [\#296](https://github.com/sous-chefs/elasticsearch/issues/296) 510 | - Elasticsearch running but not from service [\#290](https://github.com/sous-chefs/elasticsearch/issues/290) 511 | - Elasticsearch throws ElasticsearchIllegalStateException on boot \(time based instance\) [\#288](https://github.com/sous-chefs/elasticsearch/issues/288) 512 | - Prefix Definitions [\#285](https://github.com/sous-chefs/elasticsearch/issues/285) 513 | - strange thinks happend if I override elasticsearch version [\#283](https://github.com/sous-chefs/elasticsearch/issues/283) 514 | - Chef::Mixin::Template::TemplateError on new ssl attributes [\#281](https://github.com/sous-chefs/elasticsearch/issues/281) 515 | - The 0.3.13 release is missing the metadata.rb file [\#279](https://github.com/sous-chefs/elasticsearch/issues/279) 516 | - berks upload fails due to .DS\_Store files found in 0.3.12 package on supermarket.chef.io [\#278](https://github.com/sous-chefs/elasticsearch/issues/278) 517 | - 0.3.11 release [\#277](https://github.com/sous-chefs/elasticsearch/issues/277) 518 | - Berkshelf treats 'recommends' as 'depends' [\#275](https://github.com/sous-chefs/elasticsearch/issues/275) 519 | - Init Script + Existing PID File [\#274](https://github.com/sous-chefs/elasticsearch/issues/274) 520 | - Version change doesn't work [\#273](https://github.com/sous-chefs/elasticsearch/issues/273) 521 | - Please add an option to specify the desired shell to pass to the su command [\#260](https://github.com/sous-chefs/elasticsearch/issues/260) 522 | - Attaching EBS takes a very long time and doesn't finish? [\#259](https://github.com/sous-chefs/elasticsearch/issues/259) 523 | - 1.3.4 startup hangs for 10min and fails [\#257](https://github.com/sous-chefs/elasticsearch/issues/257) 524 | - Plugin installation skipping [\#252](https://github.com/sous-chefs/elasticsearch/issues/252) 525 | - Can't get Rake task to work \(either dependencies or installing Berkshelf\) [\#244](https://github.com/sous-chefs/elasticsearch/issues/244) 526 | - Don't include build-essential just to be sure apt is up to date [\#241](https://github.com/sous-chefs/elasticsearch/issues/241) 527 | - how to specify max\_map\_count? [\#239](https://github.com/sous-chefs/elasticsearch/issues/239) 528 | - Nginx HTTP, Basic Auth and multiple nodes [\#238](https://github.com/sous-chefs/elasticsearch/issues/238) 529 | - Installing Marvel [\#237](https://github.com/sous-chefs/elasticsearch/issues/237) 530 | - Need help with creating EBS Volume [\#223](https://github.com/sous-chefs/elasticsearch/issues/223) 531 | - If elasticsearch fails to extract, it won't be installed later [\#221](https://github.com/sous-chefs/elasticsearch/issues/221) 532 | - uninitialized constant Extensions during Vagrant provisioning [\#212](https://github.com/sous-chefs/elasticsearch/issues/212) 533 | - config.vm.provider not recognised using Vagrant 1.5.4 [\#207](https://github.com/sous-chefs/elasticsearch/issues/207) 534 | - The Vagrant installation instructions are outdated [\#206](https://github.com/sous-chefs/elasticsearch/issues/206) 535 | - How to specify path.data and path.logs? [\#202](https://github.com/sous-chefs/elasticsearch/issues/202) 536 | - Cannot upgrade from 0.0.92 to 1.0.1 [\#197](https://github.com/sous-chefs/elasticsearch/issues/197) 537 | - install\_plugin fails to run on initial install [\#176](https://github.com/sous-chefs/elasticsearch/issues/176) 538 | - EBS volume clean up [\#172](https://github.com/sous-chefs/elasticsearch/issues/172) 539 | - Cookbook default attributes get lifted to normal priority [\#168](https://github.com/sous-chefs/elasticsearch/issues/168) 540 | - Fog doesn't respect "delete\_on\_termination" option in elasticsearch::ebs [\#146](https://github.com/sous-chefs/elasticsearch/issues/146) 541 | - Use package options on both providers [\#336](https://github.com/sous-chefs/elasticsearch/pull/336) ([martinb3](https://github.com/martinb3)) 542 | - allow options passing to package provider [\#329](https://github.com/sous-chefs/elasticsearch/pull/329) ([scalp42](https://github.com/scalp42)) 543 | - set default resource actions [\#327](https://github.com/sous-chefs/elasticsearch/pull/327) ([nathwill](https://github.com/nathwill)) 544 | - Add a note about `next` branch [\#324](https://github.com/sous-chefs/elasticsearch/pull/324) ([martinb3](https://github.com/martinb3)) 545 | - Introduce provider and resource for configure [\#316](https://github.com/sous-chefs/elasticsearch/pull/316) ([martinb3](https://github.com/martinb3)) 546 | - First pass at install resource and two providers [\#309](https://github.com/sous-chefs/elasticsearch/pull/309) ([martinb3](https://github.com/martinb3)) 547 | 548 | ## [v0.3.13](https://github.com/sous-chefs/elasticsearch/tree/v0.3.13) (2015-01-13) 549 | 550 | ## [0.3.12](https://github.com/sous-chefs/elasticsearch/tree/0.3.12) (2015-01-13) 551 | 552 | - Guidance On Upgrading A Running ES Installation [\#271](https://github.com/sous-chefs/elasticsearch/issues/271) 553 | - Supermarket release? [\#262](https://github.com/sous-chefs/elasticsearch/issues/262) 554 | - version check always adds '-d' flag incorrectly. [\#255](https://github.com/sous-chefs/elasticsearch/issues/255) 555 | - Version 0.3.11 not available on supermarket [\#250](https://github.com/sous-chefs/elasticsearch/issues/250) 556 | - Missed multicast settings in template [\#248](https://github.com/sous-chefs/elasticsearch/issues/248) 557 | - Data bags for test? [\#246](https://github.com/sous-chefs/elasticsearch/issues/246) 558 | - Introduce user provider and resource [\#268](https://github.com/sous-chefs/elasticsearch/pull/268) ([martinb3](https://github.com/martinb3)) 559 | - First pass at framework with testing, rake, etc [\#249](https://github.com/sous-chefs/elasticsearch/pull/249) ([martinb3](https://github.com/martinb3)) 560 | 561 | ## [0.3.11](https://github.com/sous-chefs/elasticsearch/tree/0.3.11) (2014-10-13) 562 | 563 | - The init script should use the Chef embedded Ruby? [\#215](https://github.com/sous-chefs/elasticsearch/issues/215) 564 | - Quick Fix for version update issues [\#178](https://github.com/sous-chefs/elasticsearch/issues/178) 565 | - Don't seem to be able to change the version [\#100](https://github.com/sous-chefs/elasticsearch/issues/100) 566 | - Multiple EBS mounting [\#232](https://github.com/sous-chefs/elasticsearch/issues/232) 567 | - Just changing elasticsearch version attribute doesn't install intended version [\#225](https://github.com/sous-chefs/elasticsearch/issues/225) 568 | - plugins not being loaded [\#171](https://github.com/sous-chefs/elasticsearch/issues/171) 569 | 570 | ## [0.3.10](https://github.com/sous-chefs/elasticsearch/tree/0.3.10) (2014-06-19) 571 | 572 | - Single node cofiguration [\#220](https://github.com/sous-chefs/elasticsearch/issues/220) 573 | - can we use apt\_repository resource to install a particular version [\#217](https://github.com/sous-chefs/elasticsearch/issues/217) 574 | - Version attribute effect on download\_url is misleading [\#214](https://github.com/sous-chefs/elasticsearch/issues/214) 575 | - Make config template configurable [\#153](https://github.com/sous-chefs/elasticsearch/issues/153) 576 | 577 | ## [0.3.9](https://github.com/sous-chefs/elasticsearch/tree/0.3.9) (2014-05-22) 578 | 579 | - 1.1.1 doesn't work [\#210](https://github.com/sous-chefs/elasticsearch/issues/210) 580 | - Why does this cookbook set the es max heap size to 60% of available memory? [\#209](https://github.com/sous-chefs/elasticsearch/issues/209) 581 | - Failure when adding elasticsearch service [\#204](https://github.com/sous-chefs/elasticsearch/issues/204) 582 | - New release? [\#203](https://github.com/sous-chefs/elasticsearch/issues/203) 583 | 584 | ## [0.3.8](https://github.com/sous-chefs/elasticsearch/tree/0.3.8) (2014-03-27) 585 | 586 | - Avoid using `recommends "monit"` in metadata.rb [\#162](https://github.com/sous-chefs/elasticsearch/issues/162) 587 | - Problem with ownership of pid in /var/run/ on restart of ubuntu [\#108](https://github.com/sous-chefs/elasticsearch/issues/108) 588 | - SSL support with Nginx proxy [\#226](https://github.com/sous-chefs/elasticsearch/issues/226) 589 | - Compatibility with 1.0.1 [\#195](https://github.com/sous-chefs/elasticsearch/issues/195) 590 | - pid\_path is owned by elasticsearch [\#193](https://github.com/sous-chefs/elasticsearch/issues/193) 591 | - \[Install plugin: merge!\] \(elasticsearch::plugins line 35\) [\#187](https://github.com/sous-chefs/elasticsearch/issues/187) 592 | - Cookbook doesn't work with 1.0.0RCx versions - Startup broken based on behavior change [\#185](https://github.com/sous-chefs/elasticsearch/issues/185) 593 | - Failure to locate 'elasticsearch.conf.erb' template [\#184](https://github.com/sous-chefs/elasticsearch/issues/184) 594 | - Question on attributes "methodology" [\#180](https://github.com/sous-chefs/elasticsearch/issues/180) 595 | - print\_value docs don't mention elasticsearch [\#169](https://github.com/sous-chefs/elasticsearch/issues/169) 596 | - update readme file with default attributes [\#166](https://github.com/sous-chefs/elasticsearch/issues/166) 597 | - Index template config files [\#164](https://github.com/sous-chefs/elasticsearch/issues/164) 598 | - Issues configuring unicast cluster [\#158](https://github.com/sous-chefs/elasticsearch/issues/158) 599 | - elasticsearch default /usr/local/elasticsearch is no good for elasticsearch-env.sh [\#157](https://github.com/sous-chefs/elasticsearch/issues/157) 600 | 601 | ## [0.3.7](https://github.com/sous-chefs/elasticsearch/tree/0.3.7) (2013-10-28) 602 | 603 | ## [0.3.5](https://github.com/sous-chefs/elasticsearch/tree/0.3.5) (2013-10-27) 604 | 605 | - ES Logging Not Working [\#151](https://github.com/sous-chefs/elasticsearch/issues/151) 606 | - Adding Debian specific init script [\#98](https://github.com/sous-chefs/elasticsearch/pull/98) ([remkade](https://github.com/remkade)) 607 | 608 | ## [0.3.4](https://github.com/sous-chefs/elasticsearch/tree/0.3.4) (2013-10-01) 609 | 610 | - first install with plugins fails [\#138](https://github.com/sous-chefs/elasticsearch/issues/138) 611 | - Custom Params for init.d start [\#134](https://github.com/sous-chefs/elasticsearch/issues/134) 612 | - elasticsearch-cloud-aws plugin - fails to install, restarts service anyway [\#131](https://github.com/sous-chefs/elasticsearch/issues/131) 613 | - init script - improvements needed [\#130](https://github.com/sous-chefs/elasticsearch/issues/130) 614 | - Configure HTTP port range [\#129](https://github.com/sous-chefs/elasticsearch/issues/129) 615 | - Elasticsearch fails to start with 0.90.3 and cloud-aws 1.12.0 [\#126](https://github.com/sous-chefs/elasticsearch/issues/126) 616 | - Install plugin failure does not stop script execution [\#124](https://github.com/sous-chefs/elasticsearch/issues/124) 617 | - search\_discovery causes unnecessary restarts [\#122](https://github.com/sous-chefs/elasticsearch/issues/122) 618 | - chef-solo needs the 'cookbook' folder to have the same name as the cookbook [\#121](https://github.com/sous-chefs/elasticsearch/issues/121) 619 | - Plugins not working if aws recipe is used [\#105](https://github.com/sous-chefs/elasticsearch/issues/105) 620 | 621 | ## [0.3.3](https://github.com/sous-chefs/elasticsearch/tree/0.3.3) (2013-08-01) 622 | 623 | - BREAKING: Fog version does not create EBS volumes properly [\#94](https://github.com/sous-chefs/elasticsearch/issues/94) 624 | - ulimit settings not used with start-stop-daemon [\#109](https://github.com/sous-chefs/elasticsearch/issues/109) 625 | - mismatch in aws endpoint attributes [\#106](https://github.com/sous-chefs/elasticsearch/issues/106) 626 | - Elasticsearch service restart at each chef run [\#104](https://github.com/sous-chefs/elasticsearch/issues/104) 627 | - Installation fails: Error executing action `start` on resource 'service\[elasticsearch\]' [\#96](https://github.com/sous-chefs/elasticsearch/issues/96) 628 | 629 | ## [0.3.2](https://github.com/sous-chefs/elasticsearch/tree/0.3.2) (2013-08-01) 630 | 631 | - role attributes ignored? [\#112](https://github.com/sous-chefs/elasticsearch/issues/112) 632 | - Mismatched Data Dir permissions [\#111](https://github.com/sous-chefs/elasticsearch/issues/111) 633 | - Changing nofile attribute is not idempotent [\#101](https://github.com/sous-chefs/elasticsearch/issues/101) 634 | - Configure unicast\_hosts dynamically on non-AWS clusters via `search` [\#40](https://github.com/sous-chefs/elasticsearch/issues/40) 635 | 636 | ## [0.3.1](https://github.com/sous-chefs/elasticsearch/tree/0.3.1) (2013-06-18) 637 | 638 | ## [0.3.0](https://github.com/sous-chefs/elasticsearch/tree/0.3.0) (2013-06-10) 639 | 640 | - Fog \>= 1.11.0 breaks run with elasticsearch::ebs [\#93](https://github.com/sous-chefs/elasticsearch/issues/93) 641 | - elasticsearch::ebs fails if apt package cache is out of date [\#88](https://github.com/sous-chefs/elasticsearch/issues/88) 642 | - Document bare minimum configuration for default recipe [\#87](https://github.com/sous-chefs/elasticsearch/issues/87) 643 | - Centos 5 / RHEL 5 Support [\#86](https://github.com/sous-chefs/elasticsearch/issues/86) 644 | - Proxy recipe has hardcoded localhost which fails if elasticsearch is not bound to that IP [\#85](https://github.com/sous-chefs/elasticsearch/issues/85) 645 | - AJAX requests and nginx proxy [\#84](https://github.com/sous-chefs/elasticsearch/issues/84) 646 | - Readme link to Chef-solo+elasticsearch tutorial doesn't work [\#83](https://github.com/sous-chefs/elasticsearch/issues/83) 647 | - You must set ES\_CLASSPATH var [\#82](https://github.com/sous-chefs/elasticsearch/issues/82) 648 | - Setting a custom installation directory doesn't work [\#79](https://github.com/sous-chefs/elasticsearch/issues/79) 649 | 650 | ## [0.2.7](https://github.com/sous-chefs/elasticsearch/tree/0.2.7) (2013-03-18) 651 | 652 | ## [0.2.6](https://github.com/sous-chefs/elasticsearch/tree/0.2.6) (2013-03-08) 653 | 654 | - Broken attempted aws plugin installation by default [\#76](https://github.com/sous-chefs/elasticsearch/issues/76) 655 | - Using setup with ELB [\#70](https://github.com/sous-chefs/elasticsearch/issues/70) 656 | 657 | ## [0.2.5](https://github.com/sous-chefs/elasticsearch/tree/0.2.5) (2013-03-01) 658 | 659 | - Elasticsearch with node.client set to true [\#71](https://github.com/sous-chefs/elasticsearch/issues/71) 660 | 661 | ## [0.2.4](https://github.com/sous-chefs/elasticsearch/tree/0.2.4) (2013-02-27) 662 | 663 | ## [0.2.3](https://github.com/sous-chefs/elasticsearch/tree/0.2.3) (2013-02-27) 664 | 665 | - When updating versions, the wrong version can be installed unless you manually clear node attributes \(chef server only\) [\#69](https://github.com/sous-chefs/elasticsearch/issues/69) 666 | - The version of elasticsearch can only be set via elasticsearch/settings databag [\#68](https://github.com/sous-chefs/elasticsearch/issues/68) 667 | 668 | ## [0.2.2](https://github.com/sous-chefs/elasticsearch/tree/0.2.2) (2013-02-26) 669 | 670 | ## [0.2.1](https://github.com/sous-chefs/elasticsearch/tree/0.2.1) (2013-02-26) 671 | 672 | - Unable to change elasticsearch version via role and version tag [\#61](https://github.com/sous-chefs/elasticsearch/issues/61) 673 | - Creating new ebs volume is taking forever [\#60](https://github.com/sous-chefs/elasticsearch/issues/60) 674 | 675 | ## [0.2.0](https://github.com/sous-chefs/elasticsearch/tree/0.2.0) (2013-02-01) 676 | 677 | - Failing installation test on master [\#56](https://github.com/sous-chefs/elasticsearch/issues/56) 678 | - Error message when running start script [\#48](https://github.com/sous-chefs/elasticsearch/issues/48) 679 | 680 | ## [0.1.0](https://github.com/sous-chefs/elasticsearch/tree/0.1.0) (2013-01-28) 681 | 682 | ## [0.0.1](https://github.com/sous-chefs/elasticsearch/tree/0.0.1) (2013-01-28) 683 | 684 | - Update Gists for Ark change [\#28](https://github.com/sous-chefs/elasticsearch/issues/28) 685 | - Conflict with nginx cookbook [\#46](https://github.com/sous-chefs/elasticsearch/issues/46) 686 | - version bump the metadata [\#42](https://github.com/sous-chefs/elasticsearch/issues/42) 687 | - elasticsearch::test doesn't work in ec2 with chef server [\#41](https://github.com/sous-chefs/elasticsearch/issues/41) 688 | - Nginx rpm install doesn't support chunkin module [\#38](https://github.com/sous-chefs/elasticsearch/issues/38) 689 | 690 | ## [0.0.6](https://github.com/sous-chefs/elasticsearch/tree/0.0.6) (2013-01-15) 691 | 692 | - Cannot find a resource for create\_ebs on amazon version 2012.09 [\#44](https://github.com/sous-chefs/elasticsearch/issues/44) 693 | 694 | ## [0.0.5](https://github.com/sous-chefs/elasticsearch/tree/0.0.5) (2012-12-20) 695 | 696 | - Add `discovery.ec2.tag` and similar to elasticsearch.yml [\#36](https://github.com/sous-chefs/elasticsearch/issues/36) 697 | - Add support for setting cloud.aws.region using node.json [\#33](https://github.com/sous-chefs/elasticsearch/issues/33) 698 | - Elasticsearch doesn't start after run 'sudo chef-client' over knife ssh [\#32](https://github.com/sous-chefs/elasticsearch/issues/32) 699 | - Can't find Monit template? [\#29](https://github.com/sous-chefs/elasticsearch/issues/29) 700 | - Monit doesn't start after machine reboot [\#14](https://github.com/sous-chefs/elasticsearch/issues/14) 701 | - Probable bugs in install\_plugin.rb [\#12](https://github.com/sous-chefs/elasticsearch/issues/12) 702 | 703 | ## [0.0.4](https://github.com/sous-chefs/elasticsearch/tree/0.0.4) (2012-10-15) 704 | 705 | ## [0.0.3](https://github.com/sous-chefs/elasticsearch/tree/0.0.3) (2012-10-14) 706 | 707 | - min\_mem should be the same as max\_mem [\#35](https://github.com/sous-chefs/elasticsearch/issues/35) 708 | - The `elasticsearch::proxy\_nginx` should declare dependency on `nginx` cookbook [\#24](https://github.com/sous-chefs/elasticsearch/issues/24) 709 | - Appears to install nginx even in cases when it's not requested \(no proxy\) [\#23](https://github.com/sous-chefs/elasticsearch/issues/23) 710 | 711 | ## [0.0.2](https://github.com/sous-chefs/elasticsearch/tree/0.0.2) (2012-08-18) 712 | 713 | - -Xss128k is too low [\#25](https://github.com/sous-chefs/elasticsearch/issues/25) 714 | - Ubuntu Tests Failing [\#22](https://github.com/sous-chefs/elasticsearch/issues/22) 715 | - getting an error trying to install plugin [\#21](https://github.com/sous-chefs/elasticsearch/issues/21) 716 | - you must set ES\_CLASSPATH [\#20](https://github.com/sous-chefs/elasticsearch/issues/20) 717 | - Need a more comprehensive max\_mem calculation [\#15](https://github.com/sous-chefs/elasticsearch/issues/15) 718 | - Missing support for status command of the elasticsearch service [\#11](https://github.com/sous-chefs/elasticsearch/issues/11) 719 | - Discovery settings in elasticsearch.yml.erb [\#9](https://github.com/sous-chefs/elasticsearch/issues/9) 720 | - Monit issues \(template file name, internal issues\) [\#8](https://github.com/sous-chefs/elasticsearch/issues/8) 721 | - Align elasticsearch-env.sh.erb with elasticsearch.in.sh [\#3](https://github.com/sous-chefs/elasticsearch/issues/3) 722 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please refer to 4 | [https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD) 5 | -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | # Reference: http://danger.systems/reference.html 2 | 3 | # A pull request summary is required. Add a description of the pull request purpose. 4 | # Changelog must be updated for each pull request that changes code. 5 | # Warnings will be issued for: 6 | # Pull request with more than 400 lines of code changed 7 | # Pull reqest that change more than 5 lines without test changes 8 | # Failures will be issued for: 9 | # Pull request without summary 10 | # Pull requests with code changes without changelog entry 11 | 12 | def code_changes? 13 | code = %w(libraries attributes recipes resources files templates) 14 | code.each do |location| 15 | return true unless git.modified_files.grep(/#{location}/).empty? 16 | end 17 | false 18 | end 19 | 20 | def test_changes? 21 | tests = %w(spec test kitchen.yml kitchen.dokken.yml) 22 | tests.each do |location| 23 | return true unless git.modified_files.grep(/#{location}/).empty? 24 | end 25 | false 26 | end 27 | 28 | failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10 29 | 30 | warn 'This is a big Pull Request.' if git.lines_of_code > 400 31 | 32 | warn 'This is a Table Flip.' if git.lines_of_code > 2000 33 | 34 | # Require a CHANGELOG entry for non-test changes. 35 | if !git.modified_files.include?('CHANGELOG.md') && code_changes? 36 | failure 'Please include a CHANGELOG entry.' 37 | end 38 | 39 | # Require Major Minor Patch version labels 40 | unless github.pr_labels.grep /minor|major|patch/i 41 | warn 'Please add a release label to this pull request' 42 | end 43 | 44 | # A sanity check for tests. 45 | if git.lines_of_code > 5 && code_changes? && !test_changes? 46 | warn 'This Pull Request is probably missing tests.' 47 | end 48 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # Frequently asked questions 2 | 3 | ## Versions and Support 4 | 5 | ### Does this cookbook install [Java](https://www.java.com/en/)? What version? 6 | 7 | This cookbook requires java, but does not provide it. Please install Java before using any recipe in this cookbook. Please also note that Elasticsearch itself has [specific minimum Java version requirements](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#jvm-version). We recommend [this cookbook](https://github.com/agileorbit-cookbooks/java) to install Java. 8 | 9 | ### What version of [Chef](https://www.chef.io/) does this cookbook require/support? 10 | 11 | This cookbook follows the [recommended Chef community cookbook policy](https://github.com/chef/chef-rfc/blob/master/rfc092-dependency-update-cadence.md#cookbook-and-ecosystem-tooling-support) regarding Chef support; specifically, we support at least the last 6 months of Chef Client versions. We explicitly don't support anything less than Chef 12.5 and greater. We run CI as well as testing with chefspec and test-kitchen. 12 | 13 | ### What versions of [Elasticsearch](https://www.elastic.co/products/elasticsearch) does this cookbook support? 14 | 15 | This cookbook is being written and tested to support Elasticsearch 6.x and greater. If you must have a cookbook that works with older versions of Elasticsearch, please test and then pin to a specific, older `major.minor` version of this cookbook and only leave the patch release to float. Older versions can be found via [Git tags](https://github.com/elastic/cookbook-elasticsearch/tags) or on [Chef Supermarket](https://supermarket.chef.io/cookbooks/elasticsearch). We also maintain bugfix branches for major released lines (0.x, 1.x, 2.x, 3.x) of this cookbook so that we can still release fixes for older cookbooks. Previous versions of this cookbook may be found using the git tags on this repository. 16 | 17 | ## How do I 18 | 19 | ### How do I set the JVM heap size? 20 | 21 | The [allocated_memory](https://github.com/elastic/cookbook-elasticsearch/blob/master/libraries/provider_configure.rb#L27-L32) parameter controls this. 22 | If you do not set this parameter, the heap size will be set to 50% of system memory or 31g, whatever is smaller. 23 | 24 | ### How should I discover other Elasticsearch nodes? 25 | 26 | We recommend using [chef search](https://docs.chef.io/chef_search.html) in your wrapper cookbook, or using one of the contributing plugins that leverage cloud-specific features (e.g. `discovery-ec2`). 27 | 28 | ### How do I create EBS block devices or other block devices? 29 | 30 | We recommend [the aws cookbook](https://github.com/chef-cookbooks/aws). 31 | 32 | ### How do I upgrade Elasticsearch in place? 33 | 34 | Upgrading Elasticsearch in place is not recommended, and generally not supported by this cookbook. We strongly recommend you pin versions of Elasticsearch and spin up new servers to migrate to a new version, one node at a time. This cookbook does not generally set destructive options like asking the package manager to overwrite configuration files without prompting, either. 35 | 36 | See also: 37 | 38 | ### How do I override settings in the systemd unit file? 39 | 40 | If you'd like to modify the system unit file, you have two supported options: 41 | 42 | 1. [Specify a different source template](https://github.com/elastic/cookbook-elasticsearch/blob/master/libraries/resource_service.rb#L26-L27) 43 | 1. Use an override file (see "Unit File Load Path" in the [systemd documentation](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)) 44 | 45 | Typically, the override file should go in something like: `/etc/systemd/system/elasticsearch.service.d/elasticsearch.conf`. 46 | 47 | Check out for more information. 48 | 49 | ### How do I avoid running various elasticsearch_* resource? 50 | 51 | If you're running this cookbook inside docker, or manually performing some of the steps to install, configure, or run Elasticsearch, you will notice immediately that this cookbook complains about any missing resources. In order to provide the cookbook will appropriate settings (some resources _need_ information from others, e.g. configuring elasticsearch requires knowing where it is installed), you should simply use the missing resource but specify `action :none`. See #573 for more information 52 | 53 | For example, `elasticsearch_plugin` needs to source the environment file used by `elasticsearch_service` in order to be sure it uses the same settings. If you're running in a container, you may not want to use a service. Therefore, do something like this: 54 | 55 | ```ruby 56 | elasticsearch_service 'elasticsearch' do 57 | args '-d' # let other resources know we need to use -d, but don't touch the service 58 | action :none 59 | end 60 | ``` 61 | 62 | ## Specific errors and messages 63 | 64 | ### Elasticsearch complains about data paths on startup 65 | 66 | Per 5.3.1 release notes, Elasticsearch now fails to start if you provide default.path.data and an array of path.data in order to correct a bug from 5.3.0 that merged the default into the array instead of ignoring it. However, default values for cookbook attributes that set those values are also preventing ES from starting, even though path.data isn't an array. 67 | 68 | TL;DR -- you should upgrade and get the bugfix (of the original bugfix). See for more information. 69 | 70 | ### Java "trust anchors" error when installing Elasticseach plugins 71 | 72 | If you're using OpenJDK, installing Elasticsearch plugins might fail with a Java SSL exception: 73 | 74 | ```text 75 | Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty 76 | ``` 77 | 78 | This can be fixed by running the configuration for the `ca-certificates-java` package before installing any plugins: 79 | 80 | ```ruby 81 | # http://phutchins.com/blog/2017/03/14/java-trust-anchors-error-when-installing-es-plugins/ 82 | execute "ca-certificates-configure" do 83 | command "sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure" 84 | end 85 | ``` 86 | 87 | See [this article](http://phutchins.com/blog/2017/03/14/java-trust-anchors-error-when-installing-es-plugins/) for more details. 88 | 89 | ### Chef::Exceptions::Package: Installed package is newer than candidate package 90 | 91 | You may be trying to downgrade Elasticsearch, or the newer package has gone missing from their repos. Depending on what you'd like to do next, you may [provide package_options arguments](https://github.com/elastic/cookbook-elasticsearch/blob/master/libraries/resource_install.rb#L27) to yum or apt to tell it what you'd like to do more specifically. In #571, someone else has figured out how to direct apt/dpkg to upgrade the way they want, but we didn't want to prescribe what end users want their package manager to do. 92 | 93 | Alternately, you can add some logic to skip the install if the correct version is already installed (e.g. add `not_if "rpm -qa | grep -s elasticsearch"` to your `elasticsearch_install` resource). 94 | 95 | ### Elasticsearch is installed in the wrong directory name; the version is incorrect 96 | 97 | If you install by URL, and don't provide the version attribute to the `elasticsearch_install` resource, this cookbook can't tell what version you've provided (any arbitrary filename works, so there's no guarantee we can even figure it out). You will get the default version included in the directory name in this case, unless you specify which version you're installing as well. See #535 for more information. 98 | 99 | ### Elasticsearch won't start with configuration it doesn't recognize 100 | 101 | There's a chicken-and-egg issue with installing a plugin and then configuring it. It would be nice if Elasticsearch allowed configuration settings that didn't do anything, and emitted a warning instead of a fatal error. 102 | 103 | You have two options to workaround this -- (a) Don't start Elasticsearch until the plugin is installed; in other words, use one elasticsearch_configure and don't issue a :start action to elasticsearch_service until the plugin resource runs its own actions. Alternately, (b) check for whether or not x-pack is installed at the start of a Chef run, and don't configure any x-pack settings unless it's installed (this will require 2 chef runs to fully configure x-pack, as the ::File.exists? is evaluated very early in the Chef run), e.g.: 104 | 105 | ```ruby 106 | x_pack_installed = ::File.exists?("#{es_conf.path_plugins}/x-pack") 107 | 108 | settings = { 109 | 'http.port' => port, 110 | 'cluster.name' => cluster_name, 111 | 'node.name' => node_name, 112 | 'bootstrap.memory_lock' => false, 113 | 'discovery.zen.minimum_master_nodes' => 1 114 | } 115 | 116 | if x_pack_installed 117 | settings['xpack.monitoring.enabled'] = true 118 | ... 119 | end 120 | 121 | es_conf = elasticsearch_configure 'elasticsearch' do 122 | allocated_memory '512m' 123 | configuration settings 124 | end 125 | es_conf.path_data data_location if data_location 126 | 127 | ... 128 | ``` 129 | 130 | ### .deb package installs fail inside containers 131 | 132 | This is a known issue upstream and the packaging folks have been working to resolve it. You can follow along at: 133 | 134 | 135 | ### How do I test multiple Elasticsearch nodes in test-kitchen? 136 | 137 | Check out for an example of one possible solution. 138 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This software is licensed under the Apache 2 license, quoted below. 2 | 3 | Copyright (c) 2015 Elasticsearch 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elasticsearch Chef Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/elasticsearch.svg)](https://supermarket.chef.io/cookbooks/elasticsearch) 4 | 5 | **Please** review the [frequently asked questions](FAQ.md) and [contributing guidelines](CONTRIBUTING.md) before opening issues or submitting pull requests. 6 | 7 | ## Looking for Elasticsearch 5.x or 6.x? 8 | 9 | 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. 10 | 11 | ## Resources 12 | 13 | ## Notifications and Service Start/Restart 14 | 15 | 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. 16 | 17 | 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 18 | actions to the underlying service resource if you wish to notify it. 19 | 20 | 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. 21 | 22 | ### Resource names 23 | 24 | Many of the resources provided in this cookbook need to share configuration 25 | values. For example, the `elasticsearch_service` resource needs to know the path 26 | to the configuration file(s) generated by `elasticsearch_configure` and the path 27 | to the actual ES binary installed by `elasticsearch_install`. And they both need 28 | to know the appropriate system user and group defined by `elasticsearch_user`. 29 | 30 | Search order: In order to make this easy, all resources in this cookbook use the following 31 | search order to locate resources that apply to the same overall 32 | Elasticsearch setup: 33 | 34 | 1. Resources that share the same resource name 35 | 1. Resources that share the same value for `instance_name` 36 | 1. Resources named `default` or resources named `elasticsearch` 37 | - This fails if both `default` and `elasticsearch` resources exist 38 | 39 | Examples of more complicated resource names are left to the reader, but here we 40 | present a typical example that should work in most cases: 41 | 42 | ```ruby 43 | elasticsearch_user 'elasticsearch' 44 | elasticsearch_install 'elasticsearch' 45 | elasticsearch_configure 'elasticsearch' 46 | elasticsearch_service 'elasticsearch' 47 | elasticsearch_plugin 'x-pack' 48 | ``` 49 | 50 | ### elasticsearch_user 51 | 52 | Actions: `:create`, `:remove` 53 | 54 | Creates a user and group on the system for use by elasticsearch. Here is an 55 | example with many of the default options and default values (all options except 56 | a resource name may be omitted). 57 | 58 | Examples: 59 | 60 | ```ruby 61 | elasticsearch_user 'elasticsearch' 62 | ``` 63 | 64 | ```ruby 65 | elasticsearch_user 'elasticsearch' do 66 | username 'elasticsearch' 67 | groupname 'elasticsearch' 68 | shell '/bin/bash' 69 | comment 'Elasticsearch User' 70 | 71 | action :create 72 | end 73 | ``` 74 | 75 | ### elasticsearch_install 76 | 77 | Actions: `:install`, `:remove` 78 | 79 | Downloads the elasticsearch software, and unpacks it on the system. There are 80 | currently three ways to install -- `'repository'` (the default), which creates an 81 | apt or yum repo and installs from there, `'package'`, which downloads the appropriate 82 | package from elasticsearch.org and uses the package manager to install it, and 83 | `'tarball'` which downloads a tarball from elasticsearch.org and unpacks it. 84 | This resource also comes with a `:remove` action which will remove the package 85 | or directory elasticsearch was unpacked into. 86 | 87 | You may always specify a download_url and/or download_checksum, and you may 88 | include `%s` which will be replaced by the version parameter you supply. 89 | 90 | Please be sure to consult the above attribute section as that controls how 91 | Elasticsearch version, download URL and checksum are determined if you omit 92 | them. 93 | 94 | **NOTE**: The `:remove` action has not been implemented yet. Pull requests are 95 | very much welcome & encouraged, if you'd like to see this feature. 96 | 97 | Examples: 98 | 99 | ```ruby 100 | elasticsearch_install 'elasticsearch' 101 | ``` 102 | 103 | ```ruby 104 | elasticsearch_install 'my_es_installation' do 105 | type 'package' 106 | version '7.8.0' 107 | action :install 108 | end 109 | ``` 110 | 111 | ```ruby 112 | elasticsearch_install 'my_es_installation' do 113 | type 'tarball' 114 | dir '/usr/local' # where to install 115 | 116 | download_url "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz" 117 | # sha256 118 | download_checksum "6f81935e270c403681e120ec4395c28b2ddc87e659ff7784608b86beb5223dd2" 119 | 120 | action :install 121 | end 122 | ``` 123 | 124 | ```ruby 125 | elasticsearch_install 'my_es_installation' do 126 | type 'tarball' 127 | version '7.8.0' 128 | action :install # could be :remove as well 129 | end 130 | ``` 131 | 132 | ```ruby 133 | elasticsearch_install 'my_es_installation' do 134 | type 'package' # type of install 135 | download_url "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb" 136 | # sha256 137 | download_checksum "791fb9f2131be2cf8c1f86ca35e0b912d7155a53f89c2df67467ca2105e77ec2" 138 | instance_name 'elasticsearch' 139 | action :install # could be :remove as well 140 | end 141 | ``` 142 | 143 | ### elasticsearch_configure 144 | 145 | Actions: `:manage`, `:remove` 146 | 147 | Configures an elasticsearch instance; creates directories for configuration, 148 | logs, and data. Writes files `log4j2.properties`, `elasticsearch.in.sh` and 149 | `elasticsearch.yml`. 150 | 151 | The main attribute for this resource is `configuration`, 152 | which is a hash of any elasticsearch configuration directives. The 153 | other important attribute is `default_configuration` -- this contains the 154 | minimal set of required defaults. 155 | 156 | Note that these are both *not* a Chef mash, everything must be in a single level 157 | of keys and values. Any settings you pass in configuration will be merged into 158 | (and potentially overwrite) any default settings. 159 | 160 | See the examples, [as well as the attributes in the resource file](libraries/resource_configure.rb), 161 | for more. 162 | 163 | Examples: 164 | 165 | With all defaults - 166 | 167 | ```ruby 168 | elasticsearch_configure 'elasticsearch' 169 | ``` 170 | 171 | With mostly defaults - 172 | 173 | ```ruby 174 | elasticsearch_configure 'elasticsearch' do 175 | allocated_memory '512m' 176 | configuration ({ 177 | 'cluster.name' => 'escluster', 178 | 'node.name' => 'node01', 179 | 'http.port' => 9201 180 | }) 181 | end 182 | ``` 183 | 184 | Very complicated - 185 | 186 | ```ruby 187 | elasticsearch_configure 'my_elasticsearch' do 188 | # if you override one of these, you probably want to override all 189 | path_home "/opt/elasticsearch" 190 | path_conf "/etc/opt/elasticsearch" 191 | path_data "/var/opt/elasticsearch" 192 | path_logs "/var/log/elasticsearch" 193 | path_pid "/var/run/elasticsearch" 194 | path_plugins "/opt/elasticsearch/plugins" 195 | path_bin "/opt/elasticsearch/bin" 196 | 197 | # override logging parameters 198 | cookbook_log4j2_properties "my_wrapper_cookbook" 199 | template_log4j2_properties "my_log4j2.properties.erb" 200 | 201 | logging({:"action" => 'INFO'}) 202 | 203 | allocated_memory '123m' 204 | 205 | jvm_options %w( 206 | -XX:+UseParNewGC 207 | -XX:+UseConcMarkSweepGC 208 | -XX:CMSInitiatingOccupancyFraction=75 209 | -XX:+UseCMSInitiatingOccupancyOnly 210 | -XX:+HeapDumpOnOutOfMemoryError 211 | -XX:+PrintGCDetails 212 | ) 213 | 214 | configuration ({ 215 | 'node.name' => 'crazy' 216 | }) 217 | 218 | action :manage 219 | end 220 | ``` 221 | 222 | ### elasticsearch_service 223 | 224 | Actions: `:configure`, `:remove` 225 | 226 | Writes out a system service configuration of the appropriate type, and enables 227 | it to start on boot. You can override almost all of the relevant settings in 228 | such a way that you may run multiple instances. Most settings will be taken from 229 | a matching `elasticsearch_config` resource in the collection. 230 | 231 | ```ruby 232 | elasticsearch_service 'elasticsearch' 233 | ``` 234 | 235 | If you'd like to skip init scripts and systemd scripts, simply pass `nil` for 236 | the template file (init_source or systemd_source) and this cookbook will 237 | entirely skip trying to setup those scripts. Combined with changing the default 238 | service actions, this will have the same effect as `action :nothing`. 239 | 240 | ### elasticsearch_plugin 241 | 242 | Actions: `:install`, `:remove` 243 | 244 | Installs or removes a plugin to a given elasticsearch instance and plugin 245 | directory. Please note that there is currently no way to upgrade an existing 246 | plugin using commandline tools, so we haven't exposed that feature here either. 247 | Furthermore, there isn't a way to determine if a plugin is compatible with ES or 248 | even what version it is. So once we install a plugin to a directory, we 249 | generally assume that is the desired one and we don't touch it further. 250 | 251 | See for more info. 252 | 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. 253 | 254 | Officially supported or commercial plugins require just the plugin name: 255 | 256 | ```ruby 257 | elasticsearch_plugin 'analysis-icu' do 258 | action :install 259 | end 260 | elasticsearch_plugin 'shield' do 261 | action :install 262 | end 263 | ``` 264 | 265 | Plugins from GitHub require a URL of 'username/repository' or 'username/repository/version': 266 | 267 | ```ruby 268 | elasticsearch_plugin 'kopf' do 269 | url 'lmenezes/elasticsearch-kopf' 270 | action :install 271 | end 272 | 273 | elasticsearch_plugin 'kopf' do 274 | url 'lmenezes/elasticsearch-kopf/1.5.7' 275 | action :install 276 | end 277 | ``` 278 | 279 | Plugins from Maven Central or Sonatype require 'groupId/artifactId/version': 280 | 281 | ```ruby 282 | elasticsearch_plugin 'mapper-attachments' do 283 | url 'org.elasticsearch/elasticsearch-mapper-attachments/2.6.0' 284 | action :install 285 | end 286 | ``` 287 | 288 | Plugins can be installed from a custom URL or file location as follows: 289 | 290 | ```ruby 291 | elasticsearch_plugin 'mapper-attachments' do 292 | url 'http://some.domain.name//my-plugin-1.0.0.zip' 293 | action :install 294 | end 295 | 296 | elasticsearch_plugin 'mapper-attachments' do 297 | url 'file:/path/to/my-plugin-1.0.0.zip' 298 | action :install 299 | end 300 | ``` 301 | 302 | The plugin resource respects the `https_proxy` or `http_proxy` (non-SSL) 303 | [Chef settings](https://docs.chef.io/config_rb_client.html) unless explicitly 304 | disabled using `chef_proxy false`: 305 | 306 | ```ruby 307 | elasticsearch_plugin 'kopf' do 308 | url 'lmenezes/elasticsearch-kopf' 309 | chef_proxy false 310 | action :install 311 | end 312 | ``` 313 | 314 | To run multiple instances per machine, an explicit `plugin_dir` location 315 | has to be provided: 316 | 317 | ```ruby 318 | elasticsearch_plugin 'x-pack' do 319 | plugin_dir '/usr/share/elasticsearch_foo/plugins' 320 | end 321 | ``` 322 | 323 | If for some reason, you want to name the resource something else, you may 324 | provide the true plugin name using the `plugin_name` parameter: 325 | 326 | ```ruby 327 | elasticsearch_plugin 'xyzzy' do 328 | plugin_name 'kopf' 329 | url 'lmenezes/elasticsearch-kopf' 330 | action :install 331 | end 332 | ``` 333 | 334 | ## License 335 | 336 | ```text 337 | This software is licensed under the Apache 2 license, quoted below. 338 | 339 | Copyright (c) 2015 Elasticsearch 340 | 341 | Licensed under the Apache License, Version 2.0 (the "License"); 342 | you may not use this file except in compliance with the License. 343 | You may obtain a copy of the License at 344 | 345 | http://www.apache.org/licenses/LICENSE-2.0 346 | 347 | Unless required by applicable law or agreed to in writing, software 348 | distributed under the License is distributed on an "AS IS" BASIS, 349 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 350 | See the License for the specific language governing permissions and 351 | limitations under the License. 352 | ``` 353 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/TESTING.MD). 4 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a Chef Infra Server or Supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | ehthumbs.db 9 | Icon? 10 | nohup.out 11 | Thumbs.db 12 | .envrc 13 | 14 | # EDITORS # 15 | ########### 16 | .#* 17 | .project 18 | .settings 19 | *_flymake 20 | *_flymake.* 21 | *.bak 22 | *.sw[a-z] 23 | *.tmproj 24 | *~ 25 | \#* 26 | REVISION 27 | TAGS* 28 | tmtags 29 | .vscode 30 | .editorconfig 31 | 32 | ## COMPILED ## 33 | ############## 34 | *.class 35 | *.com 36 | *.dll 37 | *.exe 38 | *.o 39 | *.pyc 40 | *.so 41 | */rdoc/ 42 | a.out 43 | mkmf.log 44 | 45 | # Testing # 46 | ########### 47 | .circleci/* 48 | .codeclimate.yml 49 | .delivery/* 50 | .foodcritic 51 | .kitchen* 52 | .mdlrc 53 | .overcommit.yml 54 | .rspec 55 | .rubocop.yml 56 | .travis.yml 57 | .watchr 58 | .yamllint 59 | azure-pipelines.yml 60 | Dangerfile 61 | examples/* 62 | features/* 63 | Guardfile 64 | kitchen*.yml 65 | mlc_config.json 66 | Procfile 67 | Rakefile 68 | spec/* 69 | test/* 70 | 71 | # SCM # 72 | ####### 73 | .git 74 | .gitattributes 75 | .gitconfig 76 | .github/* 77 | .gitignore 78 | .gitkeep 79 | .gitmodules 80 | .svn 81 | */.bzr/* 82 | */.git 83 | */.hg/* 84 | */.svn/* 85 | 86 | # Berkshelf # 87 | ############# 88 | Berksfile 89 | Berksfile.lock 90 | cookbooks/* 91 | tmp 92 | 93 | # Bundler # 94 | ########### 95 | vendor/* 96 | Gemfile 97 | Gemfile.lock 98 | 99 | # Policyfile # 100 | ############## 101 | Policyfile.rb 102 | Policyfile.lock.json 103 | 104 | # Documentation # 105 | ############# 106 | CODE_OF_CONDUCT* 107 | CONTRIBUTING* 108 | documentation/* 109 | TESTING* 110 | UPGRADING* 111 | 112 | # Vagrant # 113 | ########### 114 | .vagrant 115 | Vagrantfile 116 | -------------------------------------------------------------------------------- /documentation/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/elasticsearch/1c9b76276e8232313f54c5e56f667ddc10eb6cac/documentation/.gitkeep -------------------------------------------------------------------------------- /documentation/configure.md: -------------------------------------------------------------------------------- 1 | # elasticsearch_configure 2 | 3 | The `elasticsearch_configure` resource is used to manage Elasticsearch configuration files and directories. 4 | 5 | It provides a flexible way to configure Elasticsearch instances by allowing you to set various properties and paths for your Elasticsearch instance. 6 | 7 | ## Properties 8 | 9 | The following table describes the properties available for this resource: 10 | 11 | | Property | Default | Example Values | 12 | |------------------------------|------------------------------------|---------------------------------------------------------------| 13 | | `instance_name` | - | "my_es_instance" | 14 | | `path_home` | '/usr/share/elasticsearch' | "/opt/elasticsearch" | 15 | | `path_conf` | '/etc/elasticsearch' | "/opt/elasticsearch/config" | 16 | | `path_data` | '/var/lib/elasticsearch' | "/opt/elasticsearch/data" | 17 | | `path_logs` | '/var/log/elasticsearch' | "/opt/elasticsearch/logs" | 18 | | `path_pid` | '/var/run/elasticsearch' | "/opt/elasticsearch/pid" | 19 | | `path_plugins` | '/usr/share/elasticsearch/plugins' | "/opt/elasticsearch/plugins" | 20 | | `path_bin` | '/usr/share/elasticsearch/bin' | "/opt/elasticsearch/bin" | 21 | | `template_elasticsearch_env` | 'elasticsearch.in.sh.erb' | "custom_elasticsearch.in.sh.erb" | 22 | | `cookbook_elasticsearch_env` | 'elasticsearch' | "custom_cookbook" | 23 | | `template_jvm_options` | 'jvm_options.erb' | "custom_jvm_options.erb" | 24 | | `cookbook_jvm_options` | 'elasticsearch' | "custom_cookbook" | 25 | | `template_elasticsearch_yml` | 'elasticsearch.yml.erb' | "custom_elasticsearch.yml.erb" | 26 | | `cookbook_elasticsearch_yml` | 'elasticsearch' | "custom_cookbook" | 27 | | `template_log4j2_properties` | 'log4j2.properties.erb' | "custom_log4j2.properties.erb" | 28 | | `cookbook_log4j2_properties` | 'elasticsearch' | "custom_cookbook" | 29 | | `logging` | | { 'logger.level' => 'info' } | 30 | | `java_home` | - | "/usr/lib/jvm/java-11-openjdk" | 31 | | `memlock_limit` | 'unlimited' | "4096" | 32 | | `max_map_count` | '262144' | "1048575" | 33 | | `nofile_limit` | '65535' | "1048576" | 34 | | `startup_sleep_seconds` | 5 | 10 | 35 | | `restart_on_upgrade` | false | true | 36 | | `allocated_memory` | - | "4g", "1024m" | 37 | | `jvm_options` | Array with default values | ["-XX:MaxDirectMemorySize=1g"] | 38 | | `default_configuration` | Hash with default values | { 'node.name' => 'custom_node_name'} | 39 | | `configuration` | {} | { 'discovery.zen.ping.unicast.hosts' => '["host1", "host2"]'} | 40 | 41 | ## Examples 42 | 43 | ### Example 1: Configure Elasticsearch instance with default values 44 | 45 | The following example shows how to configure an Elasticsearch instance with default values: 46 | 47 | ```ruby 48 | elasticsearch_configure 'elasticsearch' 49 | ``` 50 | 51 | ### Example 2: Configure Elasticsearch instance with custom values 52 | 53 | The following example shows how to configure an Elasticsearch instance with custom values: 54 | 55 | ```ruby 56 | elasticsearch_configure 'elasticsearch' do 57 | allocated_memory '2g' 58 | configuration ({ 59 | 'node.name' => 'my_es_instance', 60 | 'discovery.zen.ping.unicast.hosts' => '["host1", "host2"]' 61 | }) 62 | end 63 | ``` 64 | -------------------------------------------------------------------------------- /documentation/install.md: -------------------------------------------------------------------------------- 1 | # `elasticsearch_install` 2 | 3 | The install_repository.rb class is part of the Elasticsearch Cookbook and is responsible for managing the installation and removal of Elasticsearch repositories. It includes helper methods from the ElasticsearchCookbook::Helpers module and utilizes `partials/_common.rb` and `partials/_repository.rb` for defining properties related to Elasticsearch instances and repository options. 4 | 5 | ## Properties 6 | 7 | The following table provides an overview of the available properties for the install resource, including properties inherited from the included partials: 8 | 9 | | Filename | Property | Description | 10 | |--------------------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------| 11 | | `install.rb` | `type` | Specifies the installation type for Elasticsearch. Accepts `package`, `tarball`, or `repository`. Default is `repository`. | 12 | | `partial/_common.rb` | `instance_name` | The name of the Elasticsearch instance. | 13 | | | `version` | The version of Elasticsearch to be installed. | 14 | | | `package_options` | Specifies additional package options. | 15 | | `partial/_package.rb` | `download_url` | `lazy { default_download_url(new_resource.version)` } | 16 | | | `download_checksum` | `lazy { default_download_checksum[new_resource.version](checksum_platform)` } | 17 | | `partial/_repository.rb` | `enable_repository_actions` | Determines whether repository actions are enabled. Can be `true` or `false`. Default is `true`. | 18 | 19 | ## Examples 20 | 21 | ### Example 1: Install Elasticsearch instance with default values 22 | 23 | The following example shows how to install an Elasticsearch instance with default values: 24 | 25 | ```ruby 26 | elasticsearch_install 'elasticsearch' 27 | ``` 28 | 29 | ### Example 2: Install Elasticsearch instance with custom values 30 | 31 | The following example shows how to install an Elasticsearch instance with custom values: 32 | 33 | ```ruby 34 | elasticsearch_install 'elasticsearch' do 35 | type 'repository' 36 | version '7.16.1' 37 | instance_name 'my_es_instance' 38 | action :install 39 | end 40 | -------------------------------------------------------------------------------- /documentation/install_package.md: -------------------------------------------------------------------------------- 1 | 2 | # install_package 3 | 4 | The install_package manages the installation and removal of Elasticsearch packages. 5 | 6 | It includes helper methods from the `ElasticsearchCookbook::Helpers` module and utilizes partials `_common.rb` and `_package.rb` for defining properties related to Elasticsearch instances and package options. 7 | 8 | ## Properties 9 | 10 | The following table provides an overview of the available properties for the install_package.rb class, including properties inherited from the included partials: 11 | 12 | | Filename | Properties | Default | 13 | |-----------------------|---------------------|-------------------------------------------------------------------------------| 14 | | `partial/_common.rb` | `instance_name` | - | 15 | | | `version` | "7.17.9" | 16 | | | `package_options` | - | 17 | | `partial/_package.rb` | `download_url` | `lazy { default_download_url(new_resource.version)` } | 18 | | | `download_checksum` | `lazy { default_download_checksum[new_resource.version](checksum_platform)` } | 19 | 20 | ## Notes 21 | 22 | The `download_url` and `download_checksum` properties have default values that are generated based on the specified Elasticsearch version. If you want to use custom values, you can override the defaults by providing your own values. 23 | 24 | ## Examples 25 | 26 | ```ruby 27 | elasticsearch_install 'elastic' do 28 | instance_name 'my_elasticsearch_instance' 29 | version '8.0.0' 30 | download_url 'https://example.com/elasticsearch-8.0.0.rpm' 31 | download_checksum 'c2d5e5a5e42a5ac5e5c5e5a5a5c2d5e5' 32 | package_options '--force-yes --no-install-recommends' 33 | end 34 | ``` 35 | 36 | This example installs an Elasticsearch instance with the name 'my_elasticsearch_instance', using version '8.0.0'. The download URL points to an RPM file, and the specified checksum is used for validation. Package options are provided to force the installation and avoid installing recommended packages. 37 | -------------------------------------------------------------------------------- /documentation/install_repository.md: -------------------------------------------------------------------------------- 1 | # install_repository 2 | 3 | The install_repository.rb class is part of the Elasticsearch Cookbook and is responsible for managing the installation and removal of Elasticsearch repositories. It includes helper methods from the ElasticsearchCookbook::Helpers module and utilizes `partials/_common.rb` and `partials/_repository.rb` for defining properties related to Elasticsearch instances and repository options. 4 | 5 | ## Notes 6 | 7 | Custom usernames and group names are not supported in Elasticsearch 6+ repository installations. The enable_repository_actions property allows you to control whether repository-related actions, such as adding or removing repositories, are enabled. 8 | 9 | ## Properties 10 | 11 | The following table provides an overview of the available properties for the install_repository.rb class, including properties inherited from the included partials: 12 | 13 | | Filename | Properties | Default | Example Values | 14 | |--------------------------|-----------------------------|----------|----------------------------------------------| 15 | | `partial/_common.rb` | `instance_name` | - | "elasticsearch", "my_elasticsearch_instance" | 16 | | | `version` | "7.17.9" | "7.17.9", "8.0.0" | 17 | | | `package_options` | - | "--force-yes", "--no-install-recommends" | 18 | | `partial/_repository.rb` | `enable_repository_actions` | true | true, false | 19 | 20 | ## Examples 21 | 22 | ```ruby 23 | elasticsearch_install_repository 'elastic_repo' do 24 | instance_name 'my_elasticsearch_instance' 25 | version '8.0.0' 26 | package_options '--force-yes --no-install-recommends' 27 | enable_repository_actions true 28 | end 29 | ``` 30 | 31 | This example installs an Elasticsearch repository for version '8.0.0' with package options to force the installation and avoid installing recommended packages. The enable_repository_actions property is set to true, allowing repository-related actions to be performed. 32 | -------------------------------------------------------------------------------- /documentation/plugin.md: -------------------------------------------------------------------------------- 1 | # elasticsearch-plugin 2 | 3 | This custom resource is used to install and remove Elasticsearch plugins. 4 | 5 | ## Properties 6 | 7 | The following table provides an overview of the available properties for the elasticsearch_plugin resource: 8 | 9 | | Property | Type | Description | 10 | |---------------|--------|-----------------------------------------------------| 11 | | `plugin_name` | String | The name of the plugin to install or remove. | 12 | | `url` | String | The URL of the plugin to install. | 13 | | `options` | String | Additional options to pass to the plugin installer. | 14 | 15 | ## Examples 16 | 17 | ### Install a plugin 18 | 19 | The following example installs the `analysis-icu` plugin: 20 | 21 | ```ruby 22 | elasticsearch_plugin 'analysis-icu' 23 | ``` 24 | 25 | ### Install a plugin from a URL 26 | 27 | The following example installs the `analysis-icu` plugin from a URL: 28 | 29 | ```ruby 30 | elasticsearch_plugin 'analysis-icu' do 31 | url 'http://mydomain.com/analysis-icu-2.4.0.zip' 32 | end 33 | ``` 34 | -------------------------------------------------------------------------------- /documentation/service.md: -------------------------------------------------------------------------------- 1 | # elasticsearch_service 2 | 3 | This custom resource is used to manage the Elasticsearch service. 4 | 5 | ## Properties 6 | 7 | The following table provides an overview of the available properties for the elasticsearch_service resource: 8 | 9 | | Property | Type | Description | 10 | |-------------------|-------------------------|-----------------------------------------------------------------------------------| 11 | | `instance_name` | String | The name of the Elasticsearch instance. Default is `elasticsearch`. | 12 | | `service_name` | String | The name of the Elasticsearch service. Default is `elasticsearch`. | 13 | | `args` | String | Additional arguments to pass to the Elasticsearch service. | 14 | | `service_actions` | [Symbol, String, Array] | The actions to take on the Elasticsearch service. Default is `[:enable, :start]`. | 15 | 16 | ## Examples 17 | 18 | ### Start the service 19 | 20 | The following example starts the Elasticsearch service: 21 | 22 | ```ruby 23 | elasticsearch_service 'elasticsearch' 24 | ``` 25 | -------------------------------------------------------------------------------- /documentation/user.md: -------------------------------------------------------------------------------- 1 | # elasticsearch_user 2 | 3 | This custom resource is used to create and manage Elasticsearch users and groups. 4 | Properties 5 | 6 | ## Properties 7 | 8 | The following table provides an overview of the available properties for the elasticsearch_user resource: 9 | 10 | | Property | Type | Description | 11 | |-------------|-------------------|------------------------------------------------------------------------| 12 | | `username` | String | The username for the Elasticsearch user. (name property) | 13 | | `groupname` | String | The group name for the Elasticsearch user. Default is `elasticsearch`. | 14 | | `shell` | String | The shell for the Elasticsearch user. Default is `/bin/false`. | 15 | | `uid` | [String, Integer] | The user ID for the Elasticsearch user. | 16 | | `gid` | [String, Integer] | The group ID for the Elasticsearch user. | 17 | 18 | ## Examples 19 | 20 | ### Create a user 21 | 22 | The following example creates a user named `elasticsearch`: 23 | 24 | ```ruby 25 | elasticsearch_user 'elasticsearch' 26 | ``` 27 | 28 | ### Create a user with a custom group, shell, and UID 29 | 30 | The following example creates a user named `elasticsearch` with a custom group, shell, and UID: 31 | 32 | ```ruby 33 | elasticsearch_user 'myuser' do 34 | groupname 'mygroup' 35 | shell '/bin/bash' 36 | uid 1234 37 | end 38 | ``` 39 | -------------------------------------------------------------------------------- /files/elasticsearch.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v2.0.14 (GNU/Linux) 3 | 4 | mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBD 5 | A+bGFOwyhbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9 6 | CUliQe324qvObU2QRtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZ 7 | j3SF1SPO+TB5QrHkrQHBsmX+Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd 8 | 1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD 9 | 2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEBAAG0RUVsYXN0aWNzZWFyY2gg 10 | KEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3BzQGVsYXN0aWNzZWFy 11 | Y2gub3JnPokBOAQTAQIAIgUCUjceygIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgEC 12 | F4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj4XAJvuZDG0HILiUt+pPnz75 13 | nsf0NWhqR4yGFlmpuctgCmTD+HzYtV9fp9qW/bwVuJCNtKXk3sdzYABY+Yl0Cez/ 14 | 7C2GuGCOlbn0luCNT9BxJnh4mC9h/cKI3y5jvZ7wavwe41teqG14V+EoFSn3NPKm 15 | TxcDTFrV7SmVPxCBcQze00cJhprKxkuZMPPVqpBS+JfDQtzUQD/LSFfhHj9eD+Xe 16 | 8d7sw+XvxB2aN4gnTlRzjL1nTRp0h2/IOGkqYfIG9rWmSLNlxhB2t+c0RsjdGM4/ 17 | eRlPWylFbVMc5pmDpItrkWSnzBfkmXL3vO2X3WvwmSFiQbkBDQRSNx7KAQgA5JUl 18 | zcMW5/cuyZR8alSacKqhSbvoSqqbzHKcUQZmlzNMKGTABFG1yRx9r+wa/fvqP6OT 19 | RzRDvVS/cycws8YX7Ddum7x8uI95b9ye1/Xy5noPEm8cD+hplnpU+PBQZJ5XJ2I+ 20 | 1l9Nixx47wPGXeClLqcdn0ayd+v+Rwf3/XUJrvccG2YZUiQ4jWZkoxsA07xx7Bj+ 21 | Lt8/FKG7sHRFvePFU0ZS6JFx9GJqjSBbHRRkam+4emW3uWgVfZxuwcUCn1ayNgRt 22 | KiFv9jQrg2TIWEvzYx9tywTCxc+FFMWAlbCzi+m4WD+QUWWfDQ009U/WM0ks0Kww 23 | EwSk/UDuToxGnKU2dQARAQABiQEfBBgBAgAJBQJSNx7KAhsMAAoJENJ9ZmzYjkK0 24 | c3MIAIE9hAR20mqJWLcsxLtrRs6uNF1VrpB+4n/55QU7oxA1iVBO6IFu4qgsF12J 25 | TavnJ5MLaETlggXY+zDef9syTPXoQctpzcaNVDmedwo1SiL03uMoblOvWpMR/Y0j 26 | 6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZEyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7 27 | vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWgR7U2r+a210W6vnUxU4oN0PmM 28 | cursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNtfllxIu9XYmiBERQ/ 29 | qPDlGRlOgVTd9xUfHFkzB52c70E= 30 | =92oX 31 | -----END PGP PUBLIC KEY BLOCK----- 32 | -------------------------------------------------------------------------------- /kitchen.dokken.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: dokken 3 | privileged: true 4 | chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> 5 | 6 | transport: { name: dokken } 7 | provisioner: { name: dokken } 8 | 9 | platforms: 10 | - name: almalinux-8 11 | driver: 12 | image: dokken/almalinux-8 13 | pid_one_command: /usr/lib/systemd/systemd 14 | 15 | - name: almalinux-9 16 | driver: 17 | image: dokken/almalinux-9 18 | pid_one_command: /usr/lib/systemd/systemd 19 | 20 | - name: almalinux-10 21 | driver: 22 | image: dokken/almalinux-10 23 | pid_one_command: /usr/lib/systemd/systemd 24 | 25 | - name: amazonlinux-2023 26 | driver: 27 | image: dokken/amazonlinux-2023 28 | pid_one_command: /usr/lib/systemd/systemd 29 | 30 | - name: centos-stream-9 31 | driver: 32 | image: dokken/centos-stream-9 33 | pid_one_command: /usr/lib/systemd/systemd 34 | 35 | - name: centos-stream-10 36 | driver: 37 | image: dokken/centos-stream-10 38 | pid_one_command: /usr/lib/systemd/systemd 39 | 40 | - name: debian-11 41 | driver: 42 | image: dokken/debian-11 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-12 46 | driver: 47 | image: dokken/debian-12 48 | pid_one_command: /bin/systemd 49 | 50 | - name: fedora-latest 51 | driver: 52 | image: dokken/fedora-latest 53 | pid_one_command: /usr/lib/systemd/systemd 54 | 55 | - name: opensuse-leap-15 56 | driver: 57 | image: dokken/opensuse-leap-15 58 | pid_one_command: /usr/lib/systemd/systemd 59 | 60 | - name: oraclelinux-8 61 | driver: 62 | image: dokken/oraclelinux-8 63 | pid_one_command: /usr/lib/systemd/systemd 64 | 65 | - name: oraclelinux-9 66 | driver: 67 | image: dokken/oraclelinux-9 68 | pid_one_command: /usr/lib/systemd/systemd 69 | 70 | - name: rockylinux-8 71 | driver: 72 | image: dokken/rockylinux-8 73 | pid_one_command: /usr/lib/systemd/systemd 74 | 75 | - name: rockylinux-9 76 | driver: 77 | image: dokken/rockylinux-9 78 | pid_one_command: /usr/lib/systemd/systemd 79 | 80 | - name: ubuntu-20.04 81 | driver: 82 | image: dokken/ubuntu-20.04 83 | pid_one_command: /bin/systemd 84 | 85 | - name: ubuntu-22.04 86 | driver: 87 | image: dokken/ubuntu-22.04 88 | pid_one_command: /bin/systemd 89 | 90 | - name: ubuntu-24.04 91 | driver: 92 | image: dokken/ubuntu-24.04 93 | pid_one_command: /bin/systemd 94 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /kitchen.global.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_infra 4 | product_name: chef 5 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 6 | channel: stable 7 | install_strategy: once 8 | chef_license: accept 9 | enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> 10 | multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> 11 | deprecations_as_errors: true 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | 14 | verifier: 15 | name: inspec 16 | 17 | platforms: 18 | - name: almalinux-8 19 | - name: almalinux-9 20 | - name: amazonlinux-2023 21 | - name: centos-stream-9 22 | - name: debian-11 23 | - name: debian-12 24 | - name: fedora-latest 25 | - name: opensuse-leap-15 26 | - name: oraclelinux-8 27 | - name: oraclelinux-9 28 | - name: rockylinux-8 29 | - name: rockylinux-9 30 | - name: ubuntu-20.04 31 | - name: ubuntu-22.04 32 | - name: ubuntu-24.04 33 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | 5 | provisioner: 6 | name: chef_zero 7 | deprecations_as_errors: true 8 | chef_license: accept 9 | product_name: chef 10 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 11 | install_strategy: once 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | nodes_path: "test/fixtures/nodes" 14 | 15 | verifier: 16 | name: inspec 17 | 18 | platforms: 19 | - name: almalinux-8 20 | - name: almalinux-9 21 | - name: amazonlinux-2023 22 | - name: centos-stream-9 23 | - name: debian-11 24 | - name: debian-12 25 | - name: fedora-latest 26 | - name: opensuse-leap-15 27 | - name: oraclelinux-8 28 | - name: oraclelinux-9 29 | - name: rockylinux-8 30 | - name: rockylinux-9 31 | - name: ubuntu-20.04 32 | - name: ubuntu-22.04 33 | - name: ubuntu-24.04 34 | 35 | suites: 36 | - name: repository 37 | run_list: 38 | - recipe[test::default_with_plugins] 39 | attributes: 40 | elasticsearch: 41 | install: 42 | type: repository 43 | 44 | - name: package 45 | run_list: 46 | - recipe[test::default_with_plugins] 47 | attributes: 48 | elasticsearch: 49 | install: 50 | type: package 51 | -------------------------------------------------------------------------------- /libraries/helpers.rb: -------------------------------------------------------------------------------- 1 | module ElasticsearchCookbook 2 | # Helper methods included by various providers and passed to the template engine 3 | module Helpers 4 | def find_es_resource(run_context, resource_type, resource) 5 | resource_name = resource.name 6 | instance_name = resource.instance_name 7 | 8 | # if we are truly given a specific name to find 9 | name_match = begin 10 | find_exact_resource(run_context, resource_type, resource_name) 11 | rescue 12 | nil 13 | end 14 | return name_match if name_match 15 | 16 | # first try by instance name attribute 17 | name_instance = begin 18 | find_instance_name_resource(run_context, resource_type, instance_name) 19 | rescue 20 | nil 21 | end 22 | return name_instance if name_instance 23 | 24 | # otherwise try the defaults 25 | name_default = begin 26 | find_exact_resource(run_context, resource_type, 'default') 27 | rescue 28 | nil 29 | end 30 | name_elasticsearch = begin 31 | find_exact_resource(run_context, resource_type, 'elasticsearch') 32 | rescue 33 | nil 34 | end 35 | 36 | # if we found exactly one default name that matched 37 | return name_default if name_default && !name_elasticsearch 38 | return name_elasticsearch if name_elasticsearch && !name_default 39 | 40 | raise "Could not find exactly one #{resource_type} resource, and no specific resource or instance name was given" 41 | end 42 | 43 | # find exactly the resource name and type, but raise if there's multiple matches 44 | # see https://github.com/chef/chef/blob/master/lib/chef/resource_collection/resource_set.rb#L80 45 | def find_exact_resource(run_context, resource_type, resource_name) 46 | rc = run_context.resource_collection 47 | result = rc.find(resource_type => resource_name) 48 | 49 | if result && result.is_a?(Array) 50 | str = '' 51 | str << "more than one #{resource_type} was found, " 52 | str << 'you must specify a precise resource name' 53 | raise str 54 | end 55 | 56 | result 57 | end 58 | 59 | def find_instance_name_resource(run_context, resource_type, instance_name) 60 | results = [] 61 | rc = run_context.resource_collection 62 | 63 | rc.each do |r| 64 | next unless r.resource_name == resource_type && r.instance_name == instance_name 65 | results << r 66 | end 67 | 68 | if !results.empty? && results.length > 1 69 | str = '' 70 | str << "more than one #{resource_type} was found, " 71 | str << 'you must specify a precise instance name' 72 | raise str 73 | elsif !results.empty? 74 | return results.first 75 | end 76 | 77 | nil 78 | end 79 | 80 | # proxy helper for chef sets JVM 8 proxy options 81 | def get_java_proxy_arguments(enabled = true) 82 | return '' unless enabled 83 | require 'uri' 84 | output = '' 85 | 86 | if Chef::Config[:http_proxy] && !Chef::Config[:http_proxy].empty? 87 | parsed_uri = URI(Chef::Config[:http_proxy]) 88 | output += "-Dhttp.proxyHost=#{parsed_uri.host} -Dhttp.proxyPort=#{parsed_uri.port} " 89 | end 90 | 91 | if Chef::Config[:https_proxy] && !Chef::Config[:https_proxy].empty? 92 | parsed_uri = URI(Chef::Config[:https_proxy]) 93 | output += "-Dhttps.proxyHost=#{parsed_uri.host} -Dhttps.proxyPort=#{parsed_uri.port} " 94 | end 95 | 96 | output 97 | rescue 98 | '' 99 | end 100 | end 101 | 102 | def es_user 103 | find_es_resource(Chef.run_context, :elasticsearch_user, new_resource) 104 | end 105 | 106 | class HashAndMashBlender 107 | attr_accessor :target 108 | def initialize(hash_or_mash_or_whatever) 109 | self.target = hash_or_mash_or_whatever 110 | end 111 | 112 | def to_hash 113 | target.each_with_object({}) do |(k, v), hsh| 114 | hsh[k] = 115 | if v.respond_to?(:to_hash) 116 | self.class.new(v).to_hash 117 | elsif v.respond_to?(:to_a) 118 | v.to_a 119 | else 120 | v 121 | end 122 | end 123 | end 124 | end 125 | end 126 | -------------------------------------------------------------------------------- /libraries/versions.rb: -------------------------------------------------------------------------------- 1 | module ElasticsearchCookbook 2 | module VersionHelpers 3 | def default_download_url(version) 4 | platform_family = node['platform_family'] 5 | machine = node['kernel']['machine'] 6 | 7 | case platform_family 8 | when 'debian' 9 | arch = machine.include?('x86_64') ? 'amd64' : 'arm64' 10 | file_type = 'deb' 11 | when 'rhel', 'fedora', 'amazon' 12 | arch = machine.include?('x86_64') ? 'x86_64' : 'aarch64' 13 | file_type = 'rpm' 14 | else 15 | raise "Unsupported platform family: #{platform_family}" 16 | end 17 | 18 | base_url = 'https://artifacts.elastic.co/downloads/elasticsearch' 19 | "#{base_url}/elasticsearch-#{version}-#{arch}.#{file_type}" 20 | end 21 | 22 | def checksum_platform 23 | platform_family = node['platform_family'] 24 | arch = if arm? 25 | platform_family == 'debian' ? 'arm64' : 'aarch64' 26 | else 27 | 'x86_64' 28 | end 29 | 30 | "#{platform_family == 'debian' ? 'debian' : 'rpm'}_#{arch}" 31 | end 32 | 33 | def default_download_checksum(version) 34 | case version 35 | when '6.5.0' 36 | { 37 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 38 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 39 | } 40 | when '6.5.1' 41 | { 42 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 43 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 44 | } 45 | when '6.5.2' 46 | { 47 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 48 | 'debian_x86_64' => '9cb0997dc6d2be16c988c0ee43ccafd19a8b2e757326af84f4cead40f74c614f', 49 | } 50 | when '6.5.3' 51 | { 52 | 'rpm_x86_64' => '2f3eb7682e06211061bea90a0314a515f0c4ef683f45c8e57bfb1dfb14679c3a', 53 | 'debian_x86_64' => '38b30461201fe8d126d124f04d961e7c037bea7a6fb9ca485c08e681d8d30456', 54 | } 55 | when '6.5.4' 56 | { 57 | 'rpm_x86_64' => 'aa4006f754bd1a0bfaa338ba40d93a1762917c1862951577c62b1f073026b5ba', 58 | 'debian_x86_64' => 'c0a062ffb45f989cd3091c66f62605178c41c3735991d95506a6986a90924833', 59 | } 60 | when '6.6.0' 61 | { 62 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 63 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 64 | } 65 | when '6.6.1' 66 | { 67 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 68 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 69 | } 70 | when '6.6.2' 71 | { 72 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 73 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 74 | } 75 | when '6.7.0' 76 | { 77 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 78 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 79 | } 80 | when '6.7.1' 81 | { 82 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 83 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 84 | } 85 | when '6.7.2' 86 | { 87 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 88 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 89 | } 90 | when '6.8.2' 91 | { 92 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 93 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 94 | } 95 | when '6.8.3' 96 | { 97 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 98 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 99 | } 100 | when '6.8.4' 101 | { 102 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 103 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 104 | } 105 | when '6.8.5' 106 | { 107 | 'rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 108 | 'debian_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 109 | } 110 | when '6.8.6' 111 | { 112 | 'rpm_x86_64' => '4880396d1a78046efe4a6ec45c1cc2f1f9f0d328466aa32355e95f9834d9d0af', 113 | 'debian_x86_64' => '82dce29bb3c9108f44e936c3fc6200ce7264bb1a27c1a1cc6dde39b6eac03487', 114 | } 115 | when '7.0.1' 116 | { 117 | 'x86_64rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 118 | 'debian_arm64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 119 | } 120 | when '7.1.0' 121 | { 122 | 'debian_arm64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 123 | 'x86_64rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 124 | } 125 | when '7.1.1' 126 | { 127 | 'x86_64rpm_x86_64' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 128 | 'debian_arm64' => '2ef15cb7e37d32b93c51ad537959831bd72cac2627f255d22cc574cec5de6aef', 129 | } 130 | when '7.2.0' 131 | { 132 | 'debian_x86_64' => '1ff7b88c4bc38438a67719df499b17d4f7082a77eda89f39016f83414554ea95', 133 | 'rpm_x86_64' => 'a854decb443631a0031a9492c1d5acbed00222381cb63cba68ae6d5deee3994c', 134 | } 135 | when '7.2.1' 136 | { 137 | 'debian_x86_64' => '41f507b83fc49a3da5109afd18cc626ec5458acf567f00a80ac3f1c34b6d4b7f', 138 | 'rpm_x86_64' => '96fdac0a8e6c74182d920b39e3f4830b722731a646126222c189e12a95302e6e', 139 | } 140 | when '7.3.0' 141 | { 142 | 'debian_x86_64' => '72ae24cf0f5d97a307f35d116a41e1165e80f58f08b0ca4e6de3ec5228f06f9c', 143 | 'rpm_x86_64' => 'f49dc809cf48369b70546f13dfb28b43e1a07387b681ca786c794762d52847ca', 144 | } 145 | when '7.3.1' 146 | { 147 | 'debian_x86_64' => '570af7456603fd103408ed61ccec4473302976d46e1ff845b74a881122977e02', 148 | 'rpm_x86_64' => '240f93d16da4c20d2cc377b7c6a61dbf4fb9634d74829ccb5f7cd42c023bc967', 149 | } 150 | when '7.3.2' 151 | { 152 | 'debian_x86_64' => '690e98653b3dc50ec5f8e65c480ec41c8c4db0d2c63b5ed3f25fef53d6aaaa55', 153 | 'rpm_x86_64' => 'bdada0a4c7b5574c41726154212b6b25373e2b4d7d2a64e24238b206ad422ecd', 154 | } 155 | when '7.4.0' 156 | { 157 | 'debian_x86_64' => '3edf17d9d63a08a0f7eb7d9727a1737e1c770277f64fe44342115e62f752cc51', 158 | 'rpm_x86_64' => '1bfae41734c77af3bc66084ac0cc04add1190f9311b045d3c184ea7b3e688334', 159 | } 160 | when '7.4.1' 161 | { 162 | 'debian_x86_64' => '55a92288e81856e9bb6c36c0f7149b24cf36432527ca809fc48e25775b0cf584', 163 | 'rpm_x86_64' => '8ec30fbd95235cb15d0f27cd40f75a43f640f5832e2ee2d44fe8d2983cd5724f', 164 | } 165 | when '7.4.2' 166 | { 167 | 'debian_x86_64' => '514a8e21e173481edb9130ebbf33f15209b467df5c2222632d63c4527c16abc6', 168 | 'rpm_x86_64' => 'af616eed2cd30411f400dee0c993eb8fccd55e510548697d7cc0eb178ac4adec', 169 | } 170 | when '7.5.0' 171 | { 172 | 'debian_x86_64' => '5b167d15461049f6aa58a96d805c9bcd297ad19467392eea125ce91c5eaaf908', 173 | 'rpm_x86_64' => 'a8e802c74c3163272fb7119a9d23c1e8f7bbe76e6502a3fcc30709705bc57f4a', 174 | } 175 | when '7.5.1' 176 | { 177 | 'debian_x86_64' => 'e566a88e15d8f85cf793c8f971b51eeae6465a0aa73f968ae4b1ee6aa71e4c20', 178 | 'rpm_x86_64' => 'e6202bba2bd8644d23dcbef9ad7780c847dfe4ee699d3dc1804f6f62eed59c2d', 179 | } 180 | when '7.16.3' 181 | { 182 | 'debian_x86_64' => '03992d97930b734155981076b3cd250c22742f3876f5f135f374940d1cb3ae2e', 183 | 'debian_arm64' => 'c383e5b45eb070e1b6d53b9dc56218634794e2e0b27ea42a7d4a12650eec2b70', 184 | 'rpm_aarch64' => 'f833e86db87240bcdc822ea40fc6103f019c35bafcfd7ac6063ef01d5b588e1c', 185 | 'rpm_x86_64' => '9edf142b9a25b9000a9bf8638bc0590916f367b66e4abb3ce80d8f00f9de0c9c', 186 | } 187 | when '7.17.8' 188 | { 189 | 'debian_x86_64' => 'd4875477129214519f6150aaf35374103f075886913307d6ed7c138d04ae6fa1', 190 | 'debian_arm64' => '7dd69704b8d6d71aa58bb05f86d63fb34c00f2fcabdff244e9dab37226ca48af', 191 | 'rpm_aarch64' => 'bb151d40c7979e5c5c6b9b1a227d494bb463642af938a6b21ae46a4eae767c74', 192 | 'rpm_x86_64' => 'd1d1cf15143029c658224d39ebf174f8da802bb26800cd88f974ad2a0ee16484', 193 | } 194 | when '7.17.9' 195 | { 196 | 'debian_x86_64' => '7832e13c0b67239370058b729d321af1a12f0b329c0a3828c57d2fd4a9cb6555', 197 | 'debian_arm64' => 'ec7064982bd3601280478b5d1ea01b8b8d95cbaaffad441e7bef194c53e8cccd', 198 | 'rpm_aarch64' => '16a6e97440b0a4542d9d69168287fe143d40db138e9a3fd3e6348e60abe77175', 199 | 'rpm_x86_64' => '751beebbe28ebefcd451796c1075208421b109bdae752383122142fd00a04559', 200 | } 201 | when '8.6.1' 202 | { 203 | 'debian_x86_64' => 'a4ea8a7409a9c32752688f03f1df628624fa48a1c38bc5d0eee21883d5b34083', 204 | 'debian_arm64' => '84fbd0d36e98aff028eac5027e4bcc2cc8b84bf63dc175fc72e4ea3649c5c8b7', 205 | 'rpm_aarch64' => '39e80fe8cc3b864601848e008cf8a0b45b76076408abac093bedc14d0c1328bf', 206 | 'rpm_x86_64' => '939daa9480693df658d75bd38c75c2cbf5876e31ff74a543ef8a9d45a81ac728', 207 | } 208 | when '8.6.2' 209 | { 210 | 'debian_x86_64' => '8bd0b859e7fa7df8d9e632120c327530f088c5b564cd3b5538eda1b92a181676', 211 | 'debian_arm64' => '6e0088c9ac8c2d51f3d60360607f344b6511feaf5d0f3931a4c9d81448757ba9', 212 | 'rpm_aarch64' => 'f20a70195e807e1b2981ec37960df8fffef5412f89936b0834d9e8d64d2c8cc1', 213 | 'rpm_x86_64' => '5fc28cdfd3aeeeb746778ca873ce47d9836eb6d26746a562b98650c655bb8a3b', 214 | } 215 | else 216 | raise "Unsupported version #{version}" 217 | end 218 | end 219 | end 220 | end 221 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'elasticsearch' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Installs and configures Elasticsearch' 6 | version '5.1.17' 7 | issues_url 'https://github.com/sous-chefs/elasticsearch/issues' 8 | source_url 'https://github.com/sous-chefs/elasticsearch' 9 | chef_version '>= 16.0' 10 | 11 | supports 'amazon' 12 | supports 'centos' 13 | supports 'debian' 14 | supports 'fedora' 15 | supports 'redhat' 16 | supports 'ubuntu' 17 | 18 | depends 'ark' 19 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "groupName": "Actions", 7 | "matchUpdateTypes": ["minor", "patch", "pin"], 8 | "automerge": true, 9 | "addLabels": ["Release: Patch", "Skip: Announcements"] 10 | }, 11 | { 12 | "groupName": "Actions", 13 | "matchUpdateTypes": ["major"], 14 | "automerge": false, 15 | "addLabels": ["Release: Patch", "Skip: Announcements"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /resources/configure.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | # this is what helps the various resources find each other 3 | property :instance_name, String 4 | 5 | # If you override one of these, you should probably override them all 6 | property :path_home, String, default: '/usr/share/elasticsearch' 7 | property :path_conf, String, default: '/etc/elasticsearch' 8 | property :path_data, [String, Array], default: '/var/lib/elasticsearch' 9 | property :path_logs, String, default: '/var/log/elasticsearch' 10 | property :path_pid, String, default: '/var/run/elasticsearch' 11 | property :path_plugins, String, default: '/usr/share/elasticsearch/plugins' 12 | property :path_bin, String, default: '/usr/share/elasticsearch/bin' 13 | 14 | property :template_elasticsearch_env, String, default: 'elasticsearch.in.sh.erb' 15 | property :cookbook_elasticsearch_env, String, default: 'elasticsearch' 16 | 17 | property :template_jvm_options, String, default: 'jvm_options.erb' 18 | property :cookbook_jvm_options, String, default: 'elasticsearch' 19 | 20 | property :template_elasticsearch_yml, String, default: 'elasticsearch.yml.erb' 21 | property :cookbook_elasticsearch_yml, String, default: 'elasticsearch' 22 | 23 | property :template_log4j2_properties, String, default: 'log4j2.properties.erb' 24 | property :cookbook_log4j2_properties, String, default: 'elasticsearch' 25 | 26 | property :logging, Hash, default: {}.freeze 27 | property :java_home, String 28 | 29 | # other settings in /etc/default or /etc/sysconfig 30 | property :memlock_limit, String, default: 'unlimited' 31 | property :max_map_count, String, default: '262144' 32 | property :nofile_limit, String, default: '65535' 33 | property :startup_sleep_seconds, [String, Integer], default: 5 34 | property :restart_on_upgrade, [true, false], default: false 35 | 36 | # Calculations for this are done in the provider, as we can't do them in the 37 | # resource definition. default is 50% of RAM or 31GB, which ever is smaller. 38 | property :allocated_memory, String 39 | 40 | property :jvm_options, Array, default: 41 | %w( 42 | 8-13:-XX:+UseConcMarkSweepGC 43 | 8-13:-XX:CMSInitiatingOccupancyFraction=75 44 | 8-13:-XX:+UseCMSInitiatingOccupancyOnly 45 | 14-:-XX:+UseG1GC 46 | -Djava.io.tmpdir=${ES_TMPDIR} 47 | -XX:+HeapDumpOnOutOfMemoryError 48 | 9-:-XX:+ExitOnOutOfMemoryError 49 | -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log 50 | 8:-XX:+PrintGCDetails 51 | 8:-XX:+PrintGCDateStamps 52 | 8:-XX:+PrintTenuringDistribution 53 | 8:-XX:+PrintGCApplicationStoppedTime 54 | 8:-Xloggc:/var/log/elasticsearch/gc.log 55 | 8:-XX:+UseGCLogFileRotation 56 | 8:-XX:NumberOfGCLogFiles=32 57 | 8:-XX:GCLogFileSize=64m 58 | 9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m 59 | ).freeze 60 | 61 | # These are the default settings. Most of the time, you want to override 62 | # the `configuration` attribute below. If you do override the defaults, you 63 | # must supply ALL needed defaults, and don't use nil as a value in the hash. 64 | property :default_configuration, Hash, default: { 65 | 'cluster.name' => 'elasticsearch', 66 | 'node.name' => Chef::Config[:node_name], 67 | } 68 | 69 | # These settings are merged with the `default_configuration` attribute, 70 | # allowing you to override and set specific settings. Unless you intend to 71 | # wipe out all default settings, your configuration items should go here. 72 | # 73 | property :configuration, Hash, default: {} 74 | 75 | include ElasticsearchCookbook::Helpers 76 | 77 | action :manage do 78 | # lookup existing ES resources 79 | es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource) 80 | es_svc = find_es_resource(Chef.run_context, :elasticsearch_service, new_resource) 81 | es_install = find_es_resource(Chef.run_context, :elasticsearch_install, new_resource) 82 | 83 | default_configuration = new_resource.default_configuration.dup 84 | # if a subdir parameter is missing but dir is set, infer the subdir name 85 | # then go and be sure it's also set in the YML hash if it wasn't given there 86 | if new_resource.path_data && default_configuration['path.data'].nil? 87 | default_configuration['path.data'] = new_resource.path_data 88 | end 89 | 90 | if new_resource.path_logs && default_configuration['path.logs'].nil? 91 | default_configuration['path.logs'] = new_resource.path_logs 92 | end 93 | 94 | # Calculation for memory allocation; 50% or 31g, whatever is smaller 95 | # 96 | unless new_resource.allocated_memory 97 | half = ((node['memory']['total'].to_i * 0.5).floor / 1024) 98 | malloc_str = (half > 30_500 ? '30500m' : "#{half}m") 99 | new_resource.allocated_memory malloc_str 100 | end 101 | 102 | # Create ES directories 103 | # 104 | [new_resource.path_conf, "#{new_resource.path_conf}/scripts"].each do |path| 105 | directory path do 106 | owner es_user.username 107 | group es_user.groupname 108 | mode '0750' 109 | recursive true 110 | action :create 111 | end 112 | end 113 | 114 | directory new_resource.path_logs do 115 | owner es_user.username 116 | group es_user.groupname 117 | mode '0750' 118 | recursive true 119 | action :create 120 | end 121 | 122 | if new_resource.path_data.is_a?(String) 123 | directory new_resource.path_data do 124 | owner es_user.username 125 | group es_user.groupname 126 | mode '0750' 127 | recursive true 128 | action :create 129 | end 130 | else 131 | new_resource.path_data.each do |path| 132 | directory path.strip do 133 | owner es_user.username 134 | group es_user.groupname 135 | mode '0750' 136 | recursive true 137 | action :create 138 | end 139 | end 140 | end 141 | 142 | # Create elasticsearch shell variables file 143 | # 144 | # Valid values in /etc/sysconfig/elasticsearch or /etc/default/elasticsearch 145 | # ES_HOME JAVA_HOME ES_PATH_CONF DATA_DIR LOG_DIR PID_DIR ES_JAVA_OPTS 146 | # RESTART_ON_UPGRADE ES_USER ES_GROUP ES_STARTUP_SLEEP_TIME MAX_OPEN_FILES 147 | # MAX_LOCKED_MEMORY MAX_MAP_COUNT 148 | # 149 | # We provide these values as resource attributes/parameters directly 150 | params = {} 151 | params[:ES_HOME] = new_resource.path_home 152 | params[:JAVA_HOME] = new_resource.java_home 153 | params[:ES_PATH_CONF] = new_resource.path_conf 154 | params[:DATA_DIR] = new_resource.path_data 155 | params[:LOG_DIR] = new_resource.path_logs 156 | params[:PID_DIR] = new_resource.path_pid 157 | params[:RESTART_ON_UPGRADE] = new_resource.restart_on_upgrade 158 | params[:ES_USER] = es_user.username if es_install.type == 'tarball' 159 | params[:ES_GROUP] = es_user.groupname if es_install.type == 'tarball' 160 | params[:ES_STARTUP_SLEEP_TIME] = new_resource.startup_sleep_seconds.to_s 161 | params[:MAX_OPEN_FILES] = new_resource.nofile_limit 162 | params[:MAX_LOCKED_MEMORY] = new_resource.memlock_limit 163 | params[:MAX_MAP_COUNT] = new_resource.max_map_count 164 | 165 | default_config_name = es_svc.service_name || es_svc.instance_name || new_resource.instance_name || 'elasticsearch' 166 | 167 | with_run_context :root do 168 | template "elasticsearch.in.sh-#{default_config_name}" do 169 | path platform_family?('rhel', 'amazon') ? "/etc/sysconfig/#{default_config_name}" : "/etc/default/#{default_config_name}" 170 | source new_resource.template_elasticsearch_env 171 | cookbook new_resource.cookbook_elasticsearch_env 172 | mode '0644' 173 | variables(params: params) 174 | action :create 175 | end 176 | end 177 | 178 | template "jvm_options-#{default_config_name}" do 179 | path "#{new_resource.path_conf}/jvm.options" 180 | source new_resource.template_jvm_options 181 | cookbook new_resource.cookbook_jvm_options 182 | owner es_user.username 183 | group es_user.groupname 184 | mode '0644' 185 | variables(jvm_options: [ 186 | "-Xms#{new_resource.allocated_memory}", 187 | "-Xmx#{new_resource.allocated_memory}", 188 | new_resource.jvm_options, 189 | ].flatten.join("\n")) 190 | action :create 191 | end 192 | 193 | template "log4j2_properties-#{default_config_name}" do 194 | path "#{new_resource.path_conf}/log4j2.properties" 195 | source new_resource.template_log4j2_properties 196 | cookbook new_resource.cookbook_log4j2_properties 197 | owner es_user.username 198 | group es_user.groupname 199 | mode '0640' 200 | variables(logging: new_resource.logging) 201 | action :create 202 | end 203 | 204 | # Create ES elasticsearch.yml file 205 | # 206 | merged_configuration = default_configuration.merge(new_resource.configuration.dup) 207 | 208 | # Warn if someone is using symbols. We don't support. 209 | found_symbols = merged_configuration.keys.select { |s| s.is_a?(Symbol) } 210 | unless found_symbols.empty? 211 | Chef::Log.warn("Please change the following to strings in order to work with this Elasticsearch cookbook: #{found_symbols.join(',')}") 212 | end 213 | 214 | # workaround for https://github.com/sous-chefs/elasticsearch/issues/590 215 | config_vars = ElasticsearchCookbook::HashAndMashBlender.new(merged_configuration).to_hash 216 | 217 | with_run_context :root do 218 | template "elasticsearch.yml-#{default_config_name}" do 219 | path "#{new_resource.path_conf}/elasticsearch.yml" 220 | source new_resource.template_elasticsearch_yml 221 | cookbook new_resource.cookbook_elasticsearch_yml 222 | owner es_user.username 223 | group es_user.groupname 224 | mode '0640' 225 | helpers(ElasticsearchCookbook::Helpers) 226 | variables(config: config_vars) 227 | action :create 228 | end 229 | end 230 | end 231 | -------------------------------------------------------------------------------- /resources/install.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | use 'partial/_common' 3 | use 'partial/_package' 4 | use 'partial/_repository' 5 | 6 | property :type, 7 | String, 8 | equal_to: %w(package tarball repository), 9 | default: 'repository' 10 | 11 | action :install do 12 | case new_resource.type 13 | when 'tarball' 14 | raise 'Tarball method is not currently supported, due to no supporting systemd service' 15 | when 'package' 16 | elasticsearch_install_package "ElasticSearch #{new_resource.version}" do 17 | version new_resource.version 18 | instance_name new_resource.instance_name 19 | download_url new_resource.download_url 20 | download_checksum new_resource.download_checksum 21 | end 22 | when 'repository' 23 | elasticsearch_install_repository "ElasticSearch #{new_resource.version}" do 24 | version new_resource.version 25 | instance_name new_resource.instance_name 26 | enable_repository_actions new_resource.enable_repository_actions 27 | package_options new_resource.package_options 28 | end 29 | else 30 | raise "#{new_resource.type} is not a valid install type" 31 | end 32 | end 33 | 34 | action :remove do 35 | case new_resource.type 36 | when 'package' 37 | elasticsearch_install_package "ElasticSearch #{new_resource.version}" do 38 | action :remove 39 | end 40 | when 'repository' 41 | elasticsearch_install_repository "ElasticSearch #{new_resource.version}" do 42 | action :remove 43 | end 44 | else 45 | raise "#{new_resource.type} is not a valid install type" 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /resources/install_package.rb: -------------------------------------------------------------------------------- 1 | include ElasticsearchCookbook::Helpers 2 | unified_mode true 3 | use 'partial/_common' 4 | use 'partial/_package' 5 | 6 | action :install do 7 | remote_file "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" do 8 | source new_resource.download_url 9 | checksum new_resource.download_checksum 10 | mode '0644' 11 | action :create 12 | end 13 | 14 | if platform_family?('debian') 15 | dpkg_package filename_from_url do 16 | options new_resource.package_options 17 | source "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" 18 | action :install 19 | end 20 | else 21 | package filename_from_url do 22 | options new_resource.package_options 23 | source "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" 24 | action :install 25 | end 26 | end 27 | end 28 | 29 | action :remove do 30 | package "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" do 31 | action :temove 32 | end 33 | end 34 | 35 | action_class do 36 | include ElasticsearchCookbook::Helpers 37 | 38 | def filename_from_url 39 | new_resource.download_url.split('/').last 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /resources/install_repository.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | use 'partial/_common' 3 | use 'partial/_repository' 4 | 5 | include ElasticsearchCookbook::Helpers 6 | 7 | action :install do 8 | major_version = new_resource.version.split('.')[0] 9 | 10 | es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource) 11 | 12 | unless es_user && es_user.username == 'elasticsearch' && es_user.groupname == 'elasticsearch' 13 | raise 'Custom usernames/group names is not supported in Elasticsearch 6+ repository installation' 14 | end 15 | 16 | if new_resource.enable_repository_actions 17 | if platform_family?('debian') 18 | apt_repository "elastic-#{major_version}.x" do 19 | uri "https://artifacts.elastic.co/packages/#{major_version}.x/apt" 20 | key 'elasticsearch.asc' 21 | cookbook 'elasticsearch' 22 | components ['main'] 23 | distribution 'stable' 24 | end 25 | else 26 | yum_repository "elastic-#{major_version}.x" do 27 | baseurl "https://artifacts.elastic.co/packages/#{major_version}.x/yum" 28 | gpgkey 'https://artifacts.elastic.co/GPG-KEY-elasticsearch' 29 | action :create 30 | end 31 | end 32 | end 33 | 34 | package 'elasticsearch' do 35 | options new_resource.package_options 36 | version new_resource.version 37 | action :install 38 | end 39 | end 40 | 41 | action :remove do 42 | if new_resource.enable_repository_actions 43 | if platform_family?('debian') 44 | apt_repository "elastic-#{new_resource.version}.x" do 45 | action :remove 46 | end 47 | else 48 | yum_repository "elastic-#{new_resource.version}.x" do 49 | action :remove 50 | end 51 | end 52 | end 53 | 54 | package 'elasticsearch' do 55 | options new_resource.package_options 56 | version new_resource.version 57 | action :remove 58 | end 59 | end 60 | 61 | action_class do 62 | include ElasticsearchCookbook::Helpers 63 | end 64 | -------------------------------------------------------------------------------- /resources/partial/_common.rb: -------------------------------------------------------------------------------- 1 | include ElasticsearchCookbook::Helpers 2 | include ElasticsearchCookbook::VersionHelpers 3 | 4 | property :instance_name, 5 | String 6 | 7 | property :version, 8 | String, 9 | default: '7.17.9' 10 | 11 | property :package_options, 12 | String 13 | -------------------------------------------------------------------------------- /resources/partial/_package.rb: -------------------------------------------------------------------------------- 1 | property :download_url, 2 | String, 3 | default: lazy { default_download_url(version) } 4 | 5 | property :download_checksum, 6 | String, 7 | default: lazy { default_download_checksum(version)[checksum_platform] } 8 | -------------------------------------------------------------------------------- /resources/partial/_repository.rb: -------------------------------------------------------------------------------- 1 | property :enable_repository_actions, 2 | [true, false], 3 | default: true 4 | -------------------------------------------------------------------------------- /resources/plugin.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | 3 | include ElasticsearchCookbook::Helpers 4 | 5 | property :plugin_name, 6 | String, 7 | name_property: true 8 | 9 | property :url, 10 | String 11 | 12 | property :options, 13 | String, 14 | default: '' 15 | 16 | # this is what helps the various resources find each other 17 | property :instance_name, 18 | String 19 | 20 | action :install do 21 | execute "Install plugin #{new_resource.plugin_name}" do 22 | command "#{es_conf.path_bin}/elasticsearch-plugin install #{new_resource.options} #{config[:plugin_name]}".chomp(' ') 23 | not_if { plugin_exists? } 24 | environment env 25 | user config[:user] unless config[:install_type] == 'package' || config[:install_type] == 'repository' 26 | group config[:group] unless config[:install_type] == 'package' || config[:install_type] == 'repository' 27 | end 28 | end 29 | 30 | action :remove do 31 | execute "Remove plugin #{new_resource.plugin_name}" do 32 | command "#{es_conf.path_bin}/elasticsearch-plugin remove #{new_resource.options} #{config[:plugin_name]}".chomp(' ') 33 | only_if { plugin_exists? } 34 | environment env 35 | user config[:user] unless config[:install_type] == 'package' || config[:install_type] == 'repository' 36 | group config[:group] unless config[:install_type] == 'package' || config[:install_type] == 'repository' 37 | end 38 | end 39 | 40 | action_class do 41 | def es_user 42 | find_es_resource(Chef.run_context, :elasticsearch_user, new_resource) 43 | end 44 | 45 | def es_install 46 | find_es_resource(Chef.run_context, :elasticsearch_install, new_resource) 47 | end 48 | 49 | def es_conf 50 | find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource) 51 | end 52 | 53 | def env 54 | include_file_resource = find_exact_resource(Chef.run_context, :template, "elasticsearch.in.sh-#{config[:name]}") 55 | { 'ES_INCLUDE' => include_file_resource.path } 56 | end 57 | 58 | def config 59 | { 60 | name: new_resource.instance_name || es_conf.instance_name || 'elasticsearch', 61 | plugin_name: new_resource.url || new_resource.plugin_name, 62 | install_type: es_install.type, 63 | user: es_user.username, 64 | group: es_user.groupname, 65 | path_conf: es_conf.path_conf, 66 | path_plugins: es_conf.path_plugins, 67 | path_bin: es_conf.path_bin, 68 | } 69 | end 70 | 71 | def plugin_exists? 72 | # This is quicker than shelling out to the plugin list command 73 | # The plugin install command checks for the existsance of the plugin directory anyway 74 | es_conf = find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource) 75 | path = es_conf.path_plugins 76 | 77 | Dir.entries(path).any? do |plugin| 78 | next if plugin =~ /^\./ 79 | config[:plugin_name] == plugin 80 | end 81 | rescue 82 | false 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /resources/service.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | 3 | include ElasticsearchCookbook::Helpers 4 | 5 | # this is what helps the various resources find each other 6 | property :instance_name, 7 | String 8 | 9 | property :service_name, 10 | String, 11 | name_property: true 12 | 13 | property :service_actions, 14 | [Symbol, String, Array], 15 | default: [:enable, :start] 16 | 17 | action :configure do 18 | es_user = find_es_resource(Chef.run_context, :elasticsearch_user, new_resource) 19 | es_conf = find_es_resource(Chef.run_context, :elasticsearch_configure, new_resource) 20 | default_config_name = new_resource.service_name || new_resource.instance_name || es_conf.instance_name || 'elasticsearch' 21 | 22 | directory "#{es_conf.path_pid}-#{default_config_name}" do 23 | path es_conf.path_pid 24 | owner es_user.username 25 | group es_user.groupname 26 | mode '0755' 27 | recursive true 28 | action :create 29 | end 30 | 31 | default_conf_dir = platform_family?('rhel', 'amazon') ? '/etc/sysconfig' : '/etc/default' 32 | 33 | systemd_unit new_resource.service_name do 34 | content( 35 | Unit: { 36 | Description: 'Elasticsearch', 37 | Documentation: 'https://www.elastic.co', 38 | Wants: 'network-online.target', 39 | After: 'network-online.target', 40 | }, 41 | Service: { 42 | Type: 'notify', 43 | RuntimeDirectory: 'elasticsearch', 44 | PrivateTmp: 'true', 45 | Environment: [ 46 | "ES_HOME=#{es_conf.path_home}", 47 | 'ES_PATH_CONF=/etc/elasticsearch', 48 | "PID_DIR=#{es_conf.path_pid}", 49 | 'ES_SD_NOTIFY=true', 50 | ], 51 | EnvironmentFile: "-#{default_conf_dir}/#{new_resource.service_name}", 52 | WorkingDirectory: "#{es_conf.path_home}", 53 | User: es_user.username, 54 | Group: es_user.groupname, 55 | ExecStart: "#{es_conf.path_home}/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet", 56 | StandardOutput: 'journal', 57 | StandardError: 'inherit', 58 | LimitNOFILE: '65535', 59 | LimitNPROC: '4096', 60 | LimitAS: 'infinity', 61 | LimitFSIZE: 'infinity', 62 | TimeoutStopSec: '0', 63 | KillSignal: 'SIGTERM', 64 | KillMode: 'process', 65 | SendSIGKILL: 'no', 66 | SuccessExitStatus: '143', 67 | TimeoutStartSec: '900', 68 | }, 69 | Install: { 70 | WantedBy: 'multi-user.target', 71 | } 72 | ) 73 | verify false 74 | action :create 75 | unit_name "#{new_resource.service_name}.service" 76 | end 77 | 78 | # flatten in an array here, in case the service_actions are a symbol vs. array 79 | [new_resource.service_actions].flatten.each do |act| 80 | passthrough_action(act) 81 | end 82 | end 83 | 84 | # Passthrough actions to service[service_name] 85 | # 86 | action :enable do 87 | passthrough_action(:enable) 88 | end 89 | 90 | action :disable do 91 | passthrough_action(:disable) 92 | end 93 | 94 | action :start do 95 | passthrough_action(:start) 96 | end 97 | 98 | action :stop do 99 | passthrough_action(:stop) 100 | end 101 | 102 | action :restart do 103 | passthrough_action(:restart) 104 | end 105 | 106 | action :status do 107 | passthrough_action(:status) 108 | end 109 | 110 | action_class do 111 | def passthrough_action(action) 112 | svc_r = lookup_service_resource 113 | svc_r.run_action(action) 114 | new_resource.updated_by_last_action(true) if svc_r.updated_by_last_action? 115 | end 116 | 117 | def lookup_service_resource 118 | rc = Chef.run_context.resource_collection 119 | rc.find("service[#{new_resource.service_name}]") 120 | rescue 121 | service new_resource.service_name do 122 | supports status: true, restart: true 123 | action :nothing 124 | end 125 | end 126 | end 127 | -------------------------------------------------------------------------------- /resources/user.rb: -------------------------------------------------------------------------------- 1 | include ElasticsearchCookbook::Helpers 2 | 3 | unified_mode true 4 | 5 | property :instance_name, 6 | String 7 | 8 | property :username, 9 | String, 10 | name_property: true 11 | 12 | property :groupname, 13 | String, 14 | default: lazy { username } 15 | 16 | property :shell, 17 | String, 18 | default: '/bin/bash' 19 | 20 | property :uid, 21 | Integer 22 | 23 | property :comment, 24 | String, 25 | default: 'Elasticsearch User' 26 | 27 | property :gid, 28 | Integer 29 | 30 | action :create do 31 | group_r = group new_resource.groupname do 32 | gid new_resource.gid 33 | action :nothing 34 | system true 35 | end 36 | 37 | group_r.run_action(:create) 38 | 39 | new_resource.updated_by_last_action(true) if group_r.updated_by_last_action? 40 | 41 | user_r = user new_resource.username do 42 | comment new_resource.comment 43 | shell new_resource.shell 44 | uid new_resource.uid 45 | gid new_resource.groupname 46 | 47 | manage_home false 48 | action :nothing 49 | system true 50 | end 51 | 52 | user_r.run_action(:create) 53 | 54 | new_resource.updated_by_last_action(true) if user_r.updated_by_last_action? 55 | end 56 | 57 | action :remove do 58 | user_r = user new_resource.username do 59 | action :nothing 60 | end 61 | 62 | user_r.run_action(:remove) 63 | 64 | new_resource.updated_by_last_action(true) if user_r.updated_by_last_action? 65 | 66 | group_r = group new_resource.groupname do 67 | action :nothing 68 | end 69 | 70 | group_r.run_action(:remove) 71 | 72 | new_resource.updated_by_last_action(true) if group_r.updated_by_last_action? 73 | end 74 | -------------------------------------------------------------------------------- /spec/install_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative 'spec_helper' 2 | 3 | describe 'test::tarball' do 4 | before { stub_resources } 5 | supported_platforms.each do |platform, versions| 6 | versions.each do |version| 7 | context "on #{platform.capitalize} #{version}" do 8 | let(:chef_run) do 9 | ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_install']) do |node, server| 10 | node_resources(node) # data for this node 11 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 12 | end.converge(described_recipe) 13 | end 14 | end 15 | end 16 | end 17 | end 18 | 19 | describe 'test::package' do 20 | before { stub_resources } 21 | supported_platforms.each do |platform, versions| 22 | versions.each do |version| 23 | context "on #{platform.capitalize} #{version}" do 24 | let(:chef_run) do 25 | ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_install']) do |node, server| 26 | node_resources(node) # data for this node 27 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 28 | end.converge(described_recipe) 29 | end 30 | end 31 | end 32 | end 33 | end 34 | 35 | describe 'test::tarball with bad version' do 36 | before { stub_resources } 37 | supported_platforms.each do |platform, versions| 38 | versions.each do |version| 39 | context "on #{platform.capitalize} #{version}" do 40 | let(:chef_run) do 41 | ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_install']) do |node, server| 42 | node_resources(node) # data for this node 43 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 44 | node.override['elasticsearch']['version'] = '99.99.99' 45 | end.converge('test::tarball') 46 | end 47 | end 48 | end 49 | end 50 | end 51 | 52 | describe 'test::tarball with bad low version' do 53 | before { stub_resources } 54 | supported_platforms.each do |platform, versions| 55 | versions.each do |version| 56 | context "on #{platform.capitalize} #{version}" do 57 | let(:chef_run) do 58 | ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_install']) do |node, server| 59 | node_resources(node) # data for this node 60 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 61 | node.override['elasticsearch']['version'] = '0.0.1' 62 | end.converge('test::tarball') 63 | end 64 | end 65 | end 66 | end 67 | end 68 | 69 | # describe 'test::package with username foo' do 70 | # before { stub_resources } 71 | # supported_platforms.each do |platform, versions| 72 | # versions.each do |version| 73 | # %w(repository package tarball).each do |install_type| 74 | # context "Install Elasticsearch as #{install_type}" do 75 | # let(:chef_run) do 76 | # ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_install']) do |node, server| 77 | # node_resources(node) # data for this node 78 | # stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 79 | # node.override['elasticsearch']['user']['username'] = 'foo' 80 | # node.override['elasticsearch']['user']['groupname'] = 'bar' 81 | # node.override['elasticsearch']['install']['type'] = install_type 82 | # end.converge('test::default_with_plugins') 83 | # end 84 | 85 | # it 'converge status' do 86 | # if install_type != 'tarball' 87 | # expect { chef_run }.to raise_error(RuntimeError, /Custom usernames/) 88 | # else 89 | # expect { chef_run }.to_not raise_error 90 | # end 91 | # end 92 | # end 93 | # end 94 | # end 95 | # end 96 | # end 97 | -------------------------------------------------------------------------------- /spec/plugin_proxy_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative 'spec_helper' 2 | require_relative '../libraries/helpers' 3 | 4 | describe 'test::default_with_plugins' do 5 | before { stub_resources } 6 | supported_platforms.each do |platform, versions| 7 | versions.each do |version| 8 | context "on #{platform.capitalize} #{version}" do 9 | let(:chef_run) do 10 | ChefSpec::ServerRunner.new(platform: platform, version: version) do |node, server| 11 | node_resources(node) # data for this node 12 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 13 | end.converge(described_recipe) 14 | end 15 | 16 | before do 17 | extend ElasticsearchCookbook::Helpers 18 | Chef::Config['http_proxy'] = nil 19 | Chef::Config['https_proxy'] = nil 20 | end 21 | 22 | it 'installs elasticsearch without proxy' do 23 | args = get_java_proxy_arguments 24 | expect(args).to eq('') 25 | end 26 | 27 | it 'installs elasticsearch with proxy host' do 28 | Chef::Config['http_proxy'] = 'http://example.com' 29 | args = get_java_proxy_arguments 30 | expect(args).to eq('-Dhttp.proxyHost=example.com -Dhttp.proxyPort=80 ') 31 | end 32 | 33 | it 'installs elasticsearch with proxy' do 34 | Chef::Config['http_proxy'] = 'http://example.com:8080' 35 | args = get_java_proxy_arguments 36 | expect(args).to eq('-Dhttp.proxyHost=example.com -Dhttp.proxyPort=8080 ') 37 | end 38 | 39 | it 'installs elasticsearch with proxy host (ssl)' do 40 | Chef::Config['https_proxy'] = 'https://example.com' 41 | args = get_java_proxy_arguments 42 | expect(args).to eq('-Dhttps.proxyHost=example.com -Dhttps.proxyPort=443 ') 43 | end 44 | 45 | it 'installs elasticsearch with proxy (ssl)' do 46 | Chef::Config['https_proxy'] = 'https://example.com:8080' 47 | args = get_java_proxy_arguments 48 | expect(args).to eq('-Dhttps.proxyHost=example.com -Dhttps.proxyPort=8080 ') 49 | end 50 | end 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rspec/expectations' 2 | require 'chefspec' 3 | require 'chefspec/berkshelf' 4 | require 'chef/application' 5 | require 'json' 6 | 7 | Dir['./test/unit/spec/support/**/*.rb'].sort.each { |f| require f } 8 | 9 | # use node.default or node.set to put stub data for every node in every test 10 | # could also use this method to stub other node-related things like environment 11 | def node_resources(node) 12 | # Stub the node and any calls to Environment.Load to return this environment 13 | env = Chef::Environment.new 14 | env.name 'chefspec' # matches ./test/integration/ 15 | allow(node).to receive(:chef_environment).and_return(env.name) 16 | allow(Chef::Environment).to receive(:load).and_return(env) 17 | end 18 | 19 | # Stub one guard from the test fixture cookbook to prevent rspec from failing 20 | def stub_resources 21 | stub_command('/usr/share/elasticsearch/bin/x-pack/users list | grep -q testuser').and_return(0) 22 | end 23 | 24 | def stub_chef_zero(platform, version, server) 25 | Dir['./test/fixtures/nodes/*.json'].sort.each do |f| 26 | node_data = JSON.parse(IO.read(f), symbolize_names: false) 27 | node_name = node_data['name'] 28 | server.create_node(node_name, node_data) 29 | platform.to_s # pacify rubocop 30 | version.to_s # pacify rubocop 31 | end 32 | 33 | Dir['./test/fixtures/environments/*.json'].sort.each do |f| 34 | env_data = JSON.parse(IO.read(f), symbolize_names: false) 35 | env_name = env_data['name'] 36 | server.create_environment(env_name, env_data) 37 | end 38 | end 39 | 40 | def supported_platforms 41 | { 42 | 'ubuntu' => ['18.04', '20.04'], 43 | 'centos' => ['7.8.2003', '8'], 44 | } 45 | end 46 | -------------------------------------------------------------------------------- /spec/user_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative 'spec_helper' 2 | 3 | describe 'test::user' do 4 | before { stub_resources } 5 | supported_platforms.each do |platform, versions| 6 | versions.each do |version| 7 | context "on #{platform.capitalize} #{version}" do 8 | let(:chef_run) do 9 | ChefSpec::ServerRunner.new(platform: platform, version: version, step_into: ['elasticsearch_user']) do |node, server| 10 | node_resources(node) # data for this node 11 | stub_chef_zero(platform, version, server) # stub other nodes in chef-zero 12 | end.converge(described_recipe) 13 | end 14 | 15 | it 'creates elasticsearch user deleteme in group foo' do 16 | expect(chef_run).to create_elasticsearch_user('deleteme') 17 | end 18 | 19 | it 'deletes user deleteme' do 20 | expect(chef_run).to remove_elasticsearch_user('deleteme') 21 | end 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /templates/amazon/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # <%= @program_name %> 4 | # 5 | # chkconfig: 2345 80 20 6 | # description: Starts and stops a single elasticsearch instance on this system 7 | # 8 | 9 | ### BEGIN INIT INFO 10 | # Provides: Elasticsearch 11 | # Required-Start: $network $named 12 | # Required-Stop: $network $named 13 | # Default-Start: 2 3 4 5 14 | # Default-Stop: 0 1 6 15 | # Short-Description: This service manages the elasticsearch daemon 16 | # Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. 17 | ### END INIT INFO 18 | 19 | # 20 | # init.d / servicectl compatibility (openSUSE) 21 | # 22 | if [ -f /etc/rc.status ]; then 23 | . /etc/rc.status 24 | rc_reset 25 | fi 26 | 27 | # 28 | # Source function library. 29 | # 30 | if [ -f /etc/rc.d/init.d/functions ]; then 31 | . /etc/rc.d/init.d/functions 32 | fi 33 | 34 | # Sets the default values for elasticsearch variables used in this script 35 | ES_HOME="/usr/share/elasticsearch" 36 | MAX_OPEN_FILES=65535 37 | MAX_MAP_COUNT=262144 38 | ES_PATH_CONF="/etc/elasticsearch" 39 | 40 | PID_DIR="/var/run/elasticsearch" 41 | 42 | # Source the default env file 43 | ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>" 44 | if [ -f "$ES_ENV_FILE" ]; then 45 | . "$ES_ENV_FILE" 46 | fi 47 | 48 | <% if @install_type != 'tarball' %> 49 | # ES_USER and ES_GROUP settings were removed 50 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 51 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 52 | exit 1 53 | fi 54 | <% end %> 55 | 56 | exec="$ES_HOME/bin/elasticsearch" 57 | prog="elasticsearch" 58 | pidfile="$PID_DIR/${prog}.pid" 59 | 60 | export ES_JAVA_OPTS 61 | export JAVA_HOME 62 | export ES_PATH_CONF 63 | export ES_STARTUP_SLEEP_TIME 64 | 65 | lockfile=/var/lock/subsys/$prog 66 | 67 | if [ ! -x "$exec" ]; then 68 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec" 69 | exit 1 70 | fi 71 | 72 | start() { 73 | [ -x $exec ] || exit 5 74 | 75 | if [ -n "$MAX_OPEN_FILES" ]; then 76 | ulimit -n $MAX_OPEN_FILES 77 | fi 78 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 79 | ulimit -l $MAX_LOCKED_MEMORY 80 | fi 81 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 82 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 83 | fi 84 | 85 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 86 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 87 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 88 | fi 89 | if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then 90 | touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile" 91 | fi 92 | 93 | cd $ES_HOME 94 | echo -n $"Starting $prog: " 95 | # if not running, start it up here, usually something like "daemon $exec" 96 | daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d 97 | retval=$? 98 | echo 99 | [ $retval -eq 0 ] && touch $lockfile 100 | return $retval 101 | } 102 | 103 | stop() { 104 | echo -n $"Stopping $prog: " 105 | # stop it here, often "killproc $prog" 106 | killproc -p $pidfile -d 86400 $prog 107 | retval=$? 108 | echo 109 | [ $retval -eq 0 ] && rm -f $lockfile 110 | return $retval 111 | } 112 | 113 | restart() { 114 | stop 115 | start 116 | } 117 | 118 | reload() { 119 | restart 120 | } 121 | 122 | force_reload() { 123 | restart 124 | } 125 | 126 | rh_status() { 127 | # run checks to determine if the service is running or use generic status 128 | status -p $pidfile $prog 129 | } 130 | 131 | rh_status_q() { 132 | rh_status >/dev/null 2>&1 133 | } 134 | 135 | 136 | case "$1" in 137 | start) 138 | rh_status_q && exit 0 139 | $1 140 | ;; 141 | stop) 142 | rh_status_q || exit 0 143 | $1 144 | ;; 145 | restart) 146 | $1 147 | ;; 148 | reload) 149 | rh_status_q || exit 7 150 | $1 151 | ;; 152 | force-reload) 153 | force_reload 154 | ;; 155 | status) 156 | rh_status 157 | ;; 158 | condrestart|try-restart) 159 | rh_status_q || exit 0 160 | restart 161 | ;; 162 | *) 163 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 164 | exit 2 165 | esac 166 | exit $? 167 | -------------------------------------------------------------------------------- /templates/centos/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # <%= @program_name %> 4 | # 5 | # chkconfig: 2345 80 20 6 | # description: Starts and stops a single elasticsearch instance on this system 7 | # 8 | 9 | ### BEGIN INIT INFO 10 | # Provides: Elasticsearch 11 | # Required-Start: $network $named 12 | # Required-Stop: $network $named 13 | # Default-Start: 2 3 4 5 14 | # Default-Stop: 0 1 6 15 | # Short-Description: This service manages the elasticsearch daemon 16 | # Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. 17 | ### END INIT INFO 18 | 19 | # 20 | # init.d / servicectl compatibility (openSUSE) 21 | # 22 | if [ -f /etc/rc.status ]; then 23 | . /etc/rc.status 24 | rc_reset 25 | fi 26 | 27 | # 28 | # Source function library. 29 | # 30 | if [ -f /etc/rc.d/init.d/functions ]; then 31 | . /etc/rc.d/init.d/functions 32 | fi 33 | 34 | # Sets the default values for elasticsearch variables used in this script 35 | ES_HOME="/usr/share/elasticsearch" 36 | MAX_OPEN_FILES=65535 37 | MAX_MAP_COUNT=262144 38 | ES_PATH_CONF="/etc/elasticsearch" 39 | 40 | PID_DIR="/var/run/elasticsearch" 41 | 42 | # Source the default env file 43 | ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>" 44 | if [ -f "$ES_ENV_FILE" ]; then 45 | . "$ES_ENV_FILE" 46 | fi 47 | 48 | <% if @install_type != 'tarball' %> 49 | # ES_USER and ES_GROUP settings were removed 50 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 51 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 52 | exit 1 53 | fi 54 | <% end %> 55 | 56 | exec="$ES_HOME/bin/elasticsearch" 57 | prog="elasticsearch" 58 | pidfile="$PID_DIR/${prog}.pid" 59 | 60 | export ES_JAVA_OPTS 61 | export JAVA_HOME 62 | export ES_PATH_CONF 63 | export ES_STARTUP_SLEEP_TIME 64 | 65 | lockfile=/var/lock/subsys/$prog 66 | 67 | if [ ! -x "$exec" ]; then 68 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec" 69 | exit 1 70 | fi 71 | 72 | start() { 73 | [ -x $exec ] || exit 5 74 | 75 | if [ -n "$MAX_OPEN_FILES" ]; then 76 | ulimit -n $MAX_OPEN_FILES 77 | fi 78 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 79 | ulimit -l $MAX_LOCKED_MEMORY 80 | fi 81 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 82 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 83 | fi 84 | 85 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 86 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 87 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 88 | fi 89 | if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then 90 | touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile" 91 | fi 92 | 93 | cd $ES_HOME 94 | echo -n $"Starting $prog: " 95 | # if not running, start it up here, usually something like "daemon $exec" 96 | daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d 97 | retval=$? 98 | echo 99 | [ $retval -eq 0 ] && touch $lockfile 100 | return $retval 101 | } 102 | 103 | stop() { 104 | echo -n $"Stopping $prog: " 105 | # stop it here, often "killproc $prog" 106 | killproc -p $pidfile -d 86400 $prog 107 | retval=$? 108 | echo 109 | [ $retval -eq 0 ] && rm -f $lockfile 110 | return $retval 111 | } 112 | 113 | restart() { 114 | stop 115 | start 116 | } 117 | 118 | reload() { 119 | restart 120 | } 121 | 122 | force_reload() { 123 | restart 124 | } 125 | 126 | rh_status() { 127 | # run checks to determine if the service is running or use generic status 128 | status -p $pidfile $prog 129 | } 130 | 131 | rh_status_q() { 132 | rh_status >/dev/null 2>&1 133 | } 134 | 135 | 136 | case "$1" in 137 | start) 138 | rh_status_q && exit 0 139 | $1 140 | ;; 141 | stop) 142 | rh_status_q || exit 0 143 | $1 144 | ;; 145 | restart) 146 | $1 147 | ;; 148 | reload) 149 | rh_status_q || exit 7 150 | $1 151 | ;; 152 | force-reload) 153 | force_reload 154 | ;; 155 | status) 156 | rh_status 157 | ;; 158 | condrestart|try-restart) 159 | rh_status_q || exit 0 160 | restart 161 | ;; 162 | *) 163 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 164 | exit 2 165 | esac 166 | exit $? 167 | -------------------------------------------------------------------------------- /templates/debian/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # /etc/init.d/<%= @program_name %> -- startup script for Elasticsearch 4 | # 5 | ### BEGIN INIT INFO 6 | # Provides: <%= @program_name %> 7 | # Required-Start: $network $remote_fs $named 8 | # Required-Stop: $network $remote_fs $named 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Starts elasticsearch 12 | # Description: Starts elasticsearch using start-stop-daemon 13 | ### END INIT INFO 14 | 15 | PATH=/bin:/usr/bin:/sbin:/usr/sbin 16 | NAME=<%= @program_name %> 17 | DESC="Elasticsearch Server" 18 | DEFAULT=/etc/default/$NAME 19 | 20 | if [ `id -u` -ne 0 ]; then 21 | echo "You need root privileges to run this script" 22 | exit 1 23 | fi 24 | 25 | 26 | . /lib/lsb/init-functions 27 | 28 | if [ -r /etc/default/rcS ]; then 29 | . /etc/default/rcS 30 | fi 31 | 32 | 33 | # The following variables can be overwritten in $DEFAULT 34 | 35 | # Directory where the Elasticsearch binary distribution resides 36 | ES_HOME=/usr/share/$NAME 37 | 38 | # Additional Java OPTS 39 | #ES_JAVA_OPTS= 40 | 41 | # Maximum number of open files 42 | MAX_OPEN_FILES=65535 43 | 44 | # Maximum amount of locked memory 45 | #MAX_LOCKED_MEMORY= 46 | 47 | # Elasticsearch configuration directory 48 | ES_PATH_CONF=/etc/$NAME 49 | 50 | # Maximum number of VMA (Virtual Memory Areas) a process can own 51 | MAX_MAP_COUNT=262144 52 | 53 | # Elasticsearch PID file directory 54 | PID_DIR="/var/run/elasticsearch" 55 | 56 | # End of variables that can be overwritten in $DEFAULT 57 | 58 | # overwrite settings from default file 59 | if [ -f "$DEFAULT" ]; then 60 | . "$DEFAULT" 61 | fi 62 | 63 | <% if @install_type != 'tarball' %> 64 | # ES_USER and ES_GROUP settings were removed 65 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 66 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 67 | exit 1 68 | fi 69 | <% end %> 70 | 71 | # Define other required variables 72 | PID_FILE="$PID_DIR/$NAME.pid" 73 | DAEMON=$ES_HOME/bin/elasticsearch 74 | DAEMON_OPTS="-d -p $PID_FILE" 75 | 76 | export ES_JAVA_OPTS 77 | export JAVA_HOME 78 | export ES_PATH_CONF 79 | 80 | if [ ! -x "$DAEMON" ]; then 81 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON" 82 | exit 1 83 | fi 84 | 85 | case "$1" in 86 | start) 87 | 88 | log_daemon_msg "Starting $DESC" 89 | 90 | pid=`pidofproc -p $PID_FILE elasticsearch` 91 | if [ -n "$pid" ] ; then 92 | log_begin_msg "Already running." 93 | log_end_msg 0 94 | exit 0 95 | fi 96 | 97 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 98 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 99 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 100 | fi 101 | if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then 102 | touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE" 103 | fi 104 | 105 | if [ -n "$MAX_OPEN_FILES" ]; then 106 | ulimit -n $MAX_OPEN_FILES 107 | fi 108 | 109 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 110 | ulimit -l $MAX_LOCKED_MEMORY 111 | fi 112 | 113 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 114 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 115 | fi 116 | 117 | # Start Daemon 118 | start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS 119 | return=$? 120 | if [ $return -eq 0 ]; then 121 | i=0 122 | timeout=10 123 | # Wait for the process to be properly started before exiting 124 | until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1 125 | do 126 | sleep 1 127 | i=$(($i + 1)) 128 | if [ $i -gt $timeout ]; then 129 | log_end_msg 1 130 | exit 1 131 | fi 132 | done 133 | fi 134 | log_end_msg $return 135 | exit $return 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC" 139 | 140 | if [ -f "$PID_FILE" ]; then 141 | start-stop-daemon --stop --pidfile "$PID_FILE" \ 142 | --user elasticsearch \ 143 | --quiet \ 144 | --retry forever/TERM/20 > /dev/null 145 | if [ $? -eq 1 ]; then 146 | log_progress_msg "$DESC is not running but pid file exists, cleaning up" 147 | elif [ $? -eq 3 ]; then 148 | PID="`cat $PID_FILE`" 149 | log_failure_msg "Failed to stop $DESC (pid $PID)" 150 | exit 1 151 | fi 152 | rm -f "$PID_FILE" 153 | else 154 | log_progress_msg "(not running)" 155 | fi 156 | log_end_msg 0 157 | ;; 158 | status) 159 | status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $? 160 | ;; 161 | restart|force-reload) 162 | if [ -f "$PID_FILE" ]; then 163 | $0 stop 164 | fi 165 | $0 start 166 | ;; 167 | *) 168 | log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" 169 | exit 1 170 | ;; 171 | esac 172 | 173 | exit 0 174 | -------------------------------------------------------------------------------- /templates/default/elasticsearch.in.sh.erb: -------------------------------------------------------------------------------- 1 | ################################ 2 | # THIS FILE IS MANAGED BY CHEF 3 | ################################ 4 | # Elasticsearch 5 | ################################ 6 | # CHANGES MAY BE OVERWRITTEN 7 | ################################ 8 | 9 | <% 10 | @params.sort.each do |key, value| 11 | next if key.nil? || value.nil? 12 | %><%= key.to_s %>=<%= value.to_s %> 13 | <% end %> 14 | -------------------------------------------------------------------------------- /templates/default/elasticsearch.yml.erb: -------------------------------------------------------------------------------- 1 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | # THIS FILE IS MANAGED BY CHEF, DO NOT EDIT MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN! 3 | # 4 | # Please see the documentation for further information on configuration options: 5 | # 6 | # 7 | <% require 'yaml' %> 8 | <%= @config.to_yaml.to_s %> 9 | -------------------------------------------------------------------------------- /templates/default/jvm_options.erb: -------------------------------------------------------------------------------- 1 | ## JVM configuration 2 | 3 | <%= @jvm_options %> 4 | -------------------------------------------------------------------------------- /templates/default/log4j2.properties.erb: -------------------------------------------------------------------------------- 1 | status = error 2 | 3 | # log action execution errors for easier debugging 4 | logger.action.name = org.elasticsearch.action 5 | logger.action.level = debug 6 | 7 | appender.console.type = Console 8 | appender.console.name = console 9 | appender.console.layout.type = PatternLayout 10 | appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n 11 | 12 | ######## Server JSON ############################ 13 | appender.rolling.type = RollingFile 14 | appender.rolling.name = rolling 15 | appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server.json 16 | appender.rolling.layout.type = ESJsonLayout 17 | appender.rolling.layout.type_name = server 18 | 19 | appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.gz 20 | appender.rolling.policies.type = Policies 21 | appender.rolling.policies.time.type = TimeBasedTriggeringPolicy 22 | appender.rolling.policies.time.interval = 1 23 | appender.rolling.policies.time.modulate = true 24 | appender.rolling.policies.size.type = SizeBasedTriggeringPolicy 25 | appender.rolling.policies.size.size = 128MB 26 | appender.rolling.strategy.type = DefaultRolloverStrategy 27 | appender.rolling.strategy.fileIndex = nomax 28 | appender.rolling.strategy.action.type = Delete 29 | appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path} 30 | appender.rolling.strategy.action.condition.type = IfFileName 31 | appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-* 32 | appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize 33 | appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB 34 | ################################################ 35 | ######## Server - old style pattern ########### 36 | appender.rolling_old.type = RollingFile 37 | appender.rolling_old.name = rolling_old 38 | appender.rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log 39 | appender.rolling_old.layout.type = PatternLayout 40 | appender.rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n 41 | 42 | appender.rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz 43 | appender.rolling_old.policies.type = Policies 44 | appender.rolling_old.policies.time.type = TimeBasedTriggeringPolicy 45 | appender.rolling_old.policies.time.interval = 1 46 | appender.rolling_old.policies.time.modulate = true 47 | appender.rolling_old.policies.size.type = SizeBasedTriggeringPolicy 48 | appender.rolling_old.policies.size.size = 128MB 49 | appender.rolling_old.strategy.type = DefaultRolloverStrategy 50 | appender.rolling_old.strategy.fileIndex = nomax 51 | appender.rolling_old.strategy.action.type = Delete 52 | appender.rolling_old.strategy.action.basepath = ${sys:es.logs.base_path} 53 | appender.rolling_old.strategy.action.condition.type = IfFileName 54 | appender.rolling_old.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-* 55 | appender.rolling_old.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize 56 | appender.rolling_old.strategy.action.condition.nested_condition.exceeds = 2GB 57 | ################################################ 58 | 59 | rootLogger.level = info 60 | rootLogger.appenderRef.console.ref = console 61 | rootLogger.appenderRef.rolling.ref = rolling 62 | rootLogger.appenderRef.rolling_old.ref = rolling_old 63 | 64 | ######## Deprecation JSON ####################### 65 | appender.deprecation_rolling.type = RollingFile 66 | appender.deprecation_rolling.name = deprecation_rolling 67 | appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json 68 | appender.deprecation_rolling.layout.type = ESJsonLayout 69 | appender.deprecation_rolling.layout.type_name = deprecation 70 | appender.deprecation_rolling.layout.esmessagefields=x-opaque-id 71 | 72 | appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.json.gz 73 | appender.deprecation_rolling.policies.type = Policies 74 | appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy 75 | appender.deprecation_rolling.policies.size.size = 1GB 76 | appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy 77 | appender.deprecation_rolling.strategy.max = 4 78 | ################################################# 79 | ######## Deprecation - old style pattern ####### 80 | appender.deprecation_rolling_old.type = RollingFile 81 | appender.deprecation_rolling_old.name = deprecation_rolling_old 82 | appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log 83 | appender.deprecation_rolling_old.layout.type = PatternLayout 84 | appender.deprecation_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n 85 | 86 | appender.deprecation_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 87 | _deprecation-%i.log.gz 88 | appender.deprecation_rolling_old.policies.type = Policies 89 | appender.deprecation_rolling_old.policies.size.type = SizeBasedTriggeringPolicy 90 | appender.deprecation_rolling_old.policies.size.size = 1GB 91 | appender.deprecation_rolling_old.strategy.type = DefaultRolloverStrategy 92 | appender.deprecation_rolling_old.strategy.max = 4 93 | ################################################# 94 | logger.deprecation.name = org.elasticsearch.deprecation 95 | logger.deprecation.level = warn 96 | logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling 97 | logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old 98 | logger.deprecation.additivity = false 99 | 100 | ######## Search slowlog JSON #################### 101 | appender.index_search_slowlog_rolling.type = RollingFile 102 | appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling 103 | appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\ 104 | .cluster_name}_index_search_slowlog.json 105 | appender.index_search_slowlog_rolling.layout.type = ESJsonLayout 106 | appender.index_search_slowlog_rolling.layout.type_name = index_search_slowlog 107 | appender.index_search_slowlog_rolling.layout.esmessagefields=message,took,took_millis,total_hits,types,stats,search_type,total_shards,source,id 108 | 109 | appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\ 110 | .cluster_name}_index_search_slowlog-%i.json.gz 111 | appender.index_search_slowlog_rolling.policies.type = Policies 112 | appender.index_search_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy 113 | appender.index_search_slowlog_rolling.policies.size.size = 1GB 114 | appender.index_search_slowlog_rolling.strategy.type = DefaultRolloverStrategy 115 | appender.index_search_slowlog_rolling.strategy.max = 4 116 | ################################################# 117 | ######## Search slowlog - old style pattern #### 118 | appender.index_search_slowlog_rolling_old.type = RollingFile 119 | appender.index_search_slowlog_rolling_old.name = index_search_slowlog_rolling_old 120 | appender.index_search_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 121 | _index_search_slowlog.log 122 | appender.index_search_slowlog_rolling_old.layout.type = PatternLayout 123 | appender.index_search_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n 124 | 125 | appender.index_search_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 126 | _index_search_slowlog-%i.log.gz 127 | appender.index_search_slowlog_rolling_old.policies.type = Policies 128 | appender.index_search_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy 129 | appender.index_search_slowlog_rolling_old.policies.size.size = 1GB 130 | appender.index_search_slowlog_rolling_old.strategy.type = DefaultRolloverStrategy 131 | appender.index_search_slowlog_rolling_old.strategy.max = 4 132 | ################################################# 133 | logger.index_search_slowlog_rolling.name = index.search.slowlog 134 | logger.index_search_slowlog_rolling.level = trace 135 | logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling 136 | logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling_old.ref = index_search_slowlog_rolling_old 137 | logger.index_search_slowlog_rolling.additivity = false 138 | 139 | ######## Indexing slowlog JSON ################## 140 | appender.index_indexing_slowlog_rolling.type = RollingFile 141 | appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling 142 | appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 143 | _index_indexing_slowlog.json 144 | appender.index_indexing_slowlog_rolling.layout.type = ESJsonLayout 145 | appender.index_indexing_slowlog_rolling.layout.type_name = index_indexing_slowlog 146 | appender.index_indexing_slowlog_rolling.layout.esmessagefields=message,took,took_millis,doc_type,id,routing,source 147 | 148 | appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 149 | _index_indexing_slowlog-%i.json.gz 150 | appender.index_indexing_slowlog_rolling.policies.type = Policies 151 | appender.index_indexing_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy 152 | appender.index_indexing_slowlog_rolling.policies.size.size = 1GB 153 | appender.index_indexing_slowlog_rolling.strategy.type = DefaultRolloverStrategy 154 | appender.index_indexing_slowlog_rolling.strategy.max = 4 155 | ################################################# 156 | ######## Indexing slowlog - old style pattern ## 157 | appender.index_indexing_slowlog_rolling_old.type = RollingFile 158 | appender.index_indexing_slowlog_rolling_old.name = index_indexing_slowlog_rolling_old 159 | appender.index_indexing_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 160 | _index_indexing_slowlog.log 161 | appender.index_indexing_slowlog_rolling_old.layout.type = PatternLayout 162 | appender.index_indexing_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n 163 | 164 | appender.index_indexing_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\ 165 | _index_indexing_slowlog-%i.log.gz 166 | appender.index_indexing_slowlog_rolling_old.policies.type = Policies 167 | appender.index_indexing_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy 168 | appender.index_indexing_slowlog_rolling_old.policies.size.size = 1GB 169 | appender.index_indexing_slowlog_rolling_old.strategy.type = DefaultRolloverStrategy 170 | appender.index_indexing_slowlog_rolling_old.strategy.max = 4 171 | ################################################# 172 | 173 | logger.index_indexing_slowlog.name = index.indexing.slowlog.index 174 | logger.index_indexing_slowlog.level = trace 175 | logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling 176 | logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling_old.ref = index_indexing_slowlog_rolling_old 177 | logger.index_indexing_slowlog.additivity = false 178 | -------------------------------------------------------------------------------- /templates/default/sysctl.d-elasticsearch.conf.erb: -------------------------------------------------------------------------------- 1 | vm.max_map_count=262144 2 | -------------------------------------------------------------------------------- /templates/default/systemd_unit.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Elasticsearch 3 | Documentation=https://www.elastic.co 4 | Wants=network-online.target 5 | After=network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | RuntimeDirectory=elasticsearch 10 | PrivateTmp=true 11 | Environment=ES_HOME=/usr/share/elasticsearch 12 | Environment=ES_PATH_CONF=/etc/elasticsearch 13 | Environment=PID_DIR=/var/run/elasticsearch 14 | Environment=ES_SD_NOTIFY=true 15 | EnvironmentFile=-<%= @default_dir %>/<%= @program_name %> 16 | 17 | WorkingDirectory=<%= @path_home %> 18 | 19 | User=<%= @es_user %> 20 | Group=<%= @es_group %> 21 | 22 | ExecStart=<%= @path_home %>/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet 23 | 24 | # StandardOutput is configured to redirect to journalctl since 25 | # some error messages may be logged in standard output before 26 | # elasticsearch logging system is initialized. Elasticsearch 27 | # stores its logs in /var/log/elasticsearch and does not use 28 | # journalctl by default. If you also want to enable journalctl 29 | # logging, you can simply remove the "quiet" option from ExecStart. 30 | StandardOutput=journal 31 | StandardError=inherit 32 | 33 | # Specifies the maximum file descriptor number that can be opened by this process 34 | LimitNOFILE=65535 35 | 36 | # Specifies the maximum number of processes 37 | LimitNPROC=4096 38 | 39 | # Specifies the maximum size of virtual memory 40 | LimitAS=infinity 41 | 42 | # Specifies the maximum file size 43 | LimitFSIZE=infinity 44 | 45 | # Disable timeout logic and wait until process is stopped 46 | TimeoutStopSec=0 47 | 48 | # SIGTERM signal is used to stop the Java process 49 | KillSignal=SIGTERM 50 | 51 | # Send the signal only to the JVM rather than its control group 52 | KillMode=process 53 | 54 | # Java process is never killed 55 | SendSIGKILL=no 56 | 57 | # When a JVM receives a SIGTERM signal it exits with code 143 58 | SuccessExitStatus=143 59 | 60 | [Install] 61 | WantedBy=multi-user.target 62 | 63 | # Built by elasticsearch chef cookbook for elasticsearch version <%= @version %> 64 | -------------------------------------------------------------------------------- /templates/default/tmpfiles.d-elasticsearch.conf.erb: -------------------------------------------------------------------------------- 1 | d /var/run/elasticsearch 0755 elasticsearch elasticsearch - - 2 | -------------------------------------------------------------------------------- /templates/oracle/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # <%= @program_name %> 4 | # 5 | # chkconfig: 2345 80 20 6 | # description: Starts and stops a single elasticsearch instance on this system 7 | # 8 | 9 | ### BEGIN INIT INFO 10 | # Provides: Elasticsearch 11 | # Required-Start: $network $named 12 | # Required-Stop: $network $named 13 | # Default-Start: 2 3 4 5 14 | # Default-Stop: 0 1 6 15 | # Short-Description: This service manages the elasticsearch daemon 16 | # Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. 17 | ### END INIT INFO 18 | 19 | # 20 | # init.d / servicectl compatibility (openSUSE) 21 | # 22 | if [ -f /etc/rc.status ]; then 23 | . /etc/rc.status 24 | rc_reset 25 | fi 26 | 27 | # 28 | # Source function library. 29 | # 30 | if [ -f /etc/rc.d/init.d/functions ]; then 31 | . /etc/rc.d/init.d/functions 32 | fi 33 | 34 | # Sets the default values for elasticsearch variables used in this script 35 | ES_HOME="/usr/share/elasticsearch" 36 | MAX_OPEN_FILES=65535 37 | MAX_MAP_COUNT=262144 38 | ES_PATH_CONF="/etc/elasticsearch" 39 | 40 | PID_DIR="/var/run/elasticsearch" 41 | 42 | # Source the default env file 43 | ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>" 44 | if [ -f "$ES_ENV_FILE" ]; then 45 | . "$ES_ENV_FILE" 46 | fi 47 | 48 | <% if @install_type != 'tarball' %> 49 | # ES_USER and ES_GROUP settings were removed 50 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 51 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 52 | exit 1 53 | fi 54 | <% end %> 55 | 56 | exec="$ES_HOME/bin/elasticsearch" 57 | prog="elasticsearch" 58 | pidfile="$PID_DIR/${prog}.pid" 59 | 60 | export ES_JAVA_OPTS 61 | export JAVA_HOME 62 | export ES_PATH_CONF 63 | export ES_STARTUP_SLEEP_TIME 64 | 65 | lockfile=/var/lock/subsys/$prog 66 | 67 | if [ ! -x "$exec" ]; then 68 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec" 69 | exit 1 70 | fi 71 | 72 | start() { 73 | [ -x $exec ] || exit 5 74 | 75 | if [ -n "$MAX_OPEN_FILES" ]; then 76 | ulimit -n $MAX_OPEN_FILES 77 | fi 78 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 79 | ulimit -l $MAX_LOCKED_MEMORY 80 | fi 81 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 82 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 83 | fi 84 | 85 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 86 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 87 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 88 | fi 89 | if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then 90 | touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile" 91 | fi 92 | 93 | cd $ES_HOME 94 | echo -n $"Starting $prog: " 95 | # if not running, start it up here, usually something like "daemon $exec" 96 | daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d 97 | retval=$? 98 | echo 99 | [ $retval -eq 0 ] && touch $lockfile 100 | return $retval 101 | } 102 | 103 | stop() { 104 | echo -n $"Stopping $prog: " 105 | # stop it here, often "killproc $prog" 106 | killproc -p $pidfile -d 86400 $prog 107 | retval=$? 108 | echo 109 | [ $retval -eq 0 ] && rm -f $lockfile 110 | return $retval 111 | } 112 | 113 | restart() { 114 | stop 115 | start 116 | } 117 | 118 | reload() { 119 | restart 120 | } 121 | 122 | force_reload() { 123 | restart 124 | } 125 | 126 | rh_status() { 127 | # run checks to determine if the service is running or use generic status 128 | status -p $pidfile $prog 129 | } 130 | 131 | rh_status_q() { 132 | rh_status >/dev/null 2>&1 133 | } 134 | 135 | 136 | case "$1" in 137 | start) 138 | rh_status_q && exit 0 139 | $1 140 | ;; 141 | stop) 142 | rh_status_q || exit 0 143 | $1 144 | ;; 145 | restart) 146 | $1 147 | ;; 148 | reload) 149 | rh_status_q || exit 7 150 | $1 151 | ;; 152 | force-reload) 153 | force_reload 154 | ;; 155 | status) 156 | rh_status 157 | ;; 158 | condrestart|try-restart) 159 | rh_status_q || exit 0 160 | restart 161 | ;; 162 | *) 163 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 164 | exit 2 165 | esac 166 | exit $? 167 | -------------------------------------------------------------------------------- /templates/redhat/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # <%= @program_name %> 4 | # 5 | # chkconfig: 2345 80 20 6 | # description: Starts and stops a single elasticsearch instance on this system 7 | # 8 | 9 | ### BEGIN INIT INFO 10 | # Provides: Elasticsearch 11 | # Required-Start: $network $named 12 | # Required-Stop: $network $named 13 | # Default-Start: 2 3 4 5 14 | # Default-Stop: 0 1 6 15 | # Short-Description: This service manages the elasticsearch daemon 16 | # Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. 17 | ### END INIT INFO 18 | 19 | # 20 | # init.d / servicectl compatibility (openSUSE) 21 | # 22 | if [ -f /etc/rc.status ]; then 23 | . /etc/rc.status 24 | rc_reset 25 | fi 26 | 27 | # 28 | # Source function library. 29 | # 30 | if [ -f /etc/rc.d/init.d/functions ]; then 31 | . /etc/rc.d/init.d/functions 32 | fi 33 | 34 | # Sets the default values for elasticsearch variables used in this script 35 | ES_HOME="/usr/share/elasticsearch" 36 | MAX_OPEN_FILES=65535 37 | MAX_MAP_COUNT=262144 38 | ES_PATH_CONF="/etc/elasticsearch" 39 | 40 | PID_DIR="/var/run/elasticsearch" 41 | 42 | # Source the default env file 43 | ES_ENV_FILE="/etc/sysconfig/<%= @program_name %>" 44 | if [ -f "$ES_ENV_FILE" ]; then 45 | . "$ES_ENV_FILE" 46 | fi 47 | 48 | <% if @install_type != 'tarball' %> 49 | # ES_USER and ES_GROUP settings were removed 50 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 51 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 52 | exit 1 53 | fi 54 | <% end %> 55 | 56 | exec="$ES_HOME/bin/elasticsearch" 57 | prog="elasticsearch" 58 | pidfile="$PID_DIR/${prog}.pid" 59 | 60 | export ES_JAVA_OPTS 61 | export JAVA_HOME 62 | export ES_PATH_CONF 63 | export ES_STARTUP_SLEEP_TIME 64 | 65 | lockfile=/var/lock/subsys/$prog 66 | 67 | if [ ! -x "$exec" ]; then 68 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec" 69 | exit 1 70 | fi 71 | 72 | start() { 73 | [ -x $exec ] || exit 5 74 | 75 | if [ -n "$MAX_OPEN_FILES" ]; then 76 | ulimit -n $MAX_OPEN_FILES 77 | fi 78 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 79 | ulimit -l $MAX_LOCKED_MEMORY 80 | fi 81 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 82 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 83 | fi 84 | 85 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 86 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 87 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 88 | fi 89 | if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then 90 | touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile" 91 | fi 92 | 93 | cd $ES_HOME 94 | echo -n $"Starting $prog: " 95 | # if not running, start it up here, usually something like "daemon $exec" 96 | daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d 97 | retval=$? 98 | echo 99 | [ $retval -eq 0 ] && touch $lockfile 100 | return $retval 101 | } 102 | 103 | stop() { 104 | echo -n $"Stopping $prog: " 105 | # stop it here, often "killproc $prog" 106 | killproc -p $pidfile -d 86400 $prog 107 | retval=$? 108 | echo 109 | [ $retval -eq 0 ] && rm -f $lockfile 110 | return $retval 111 | } 112 | 113 | restart() { 114 | stop 115 | start 116 | } 117 | 118 | reload() { 119 | restart 120 | } 121 | 122 | force_reload() { 123 | restart 124 | } 125 | 126 | rh_status() { 127 | # run checks to determine if the service is running or use generic status 128 | status -p $pidfile $prog 129 | } 130 | 131 | rh_status_q() { 132 | rh_status >/dev/null 2>&1 133 | } 134 | 135 | 136 | case "$1" in 137 | start) 138 | rh_status_q && exit 0 139 | $1 140 | ;; 141 | stop) 142 | rh_status_q || exit 0 143 | $1 144 | ;; 145 | restart) 146 | $1 147 | ;; 148 | reload) 149 | rh_status_q || exit 7 150 | $1 151 | ;; 152 | force-reload) 153 | force_reload 154 | ;; 155 | status) 156 | rh_status 157 | ;; 158 | condrestart|try-restart) 159 | rh_status_q || exit 0 160 | restart 161 | ;; 162 | *) 163 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 164 | exit 2 165 | esac 166 | exit $? 167 | -------------------------------------------------------------------------------- /templates/ubuntu/initscript.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # /etc/init.d/<%= @program_name %> -- startup script for Elasticsearch 4 | # 5 | ### BEGIN INIT INFO 6 | # Provides: <%= @program_name %> 7 | # Required-Start: $network $remote_fs $named 8 | # Required-Stop: $network $remote_fs $named 9 | # Default-Start: 2 3 4 5 10 | # Default-Stop: 0 1 6 11 | # Short-Description: Starts elasticsearch 12 | # Description: Starts elasticsearch using start-stop-daemon 13 | ### END INIT INFO 14 | 15 | PATH=/bin:/usr/bin:/sbin:/usr/sbin 16 | NAME=<%= @program_name %> 17 | DESC="Elasticsearch Server" 18 | DEFAULT=/etc/default/$NAME 19 | 20 | if [ `id -u` -ne 0 ]; then 21 | echo "You need root privileges to run this script" 22 | exit 1 23 | fi 24 | 25 | 26 | . /lib/lsb/init-functions 27 | 28 | if [ -r /etc/default/rcS ]; then 29 | . /etc/default/rcS 30 | fi 31 | 32 | 33 | # The following variables can be overwritten in $DEFAULT 34 | 35 | # Directory where the Elasticsearch binary distribution resides 36 | ES_HOME=/usr/share/$NAME 37 | 38 | # Additional Java OPTS 39 | #ES_JAVA_OPTS= 40 | 41 | # Maximum number of open files 42 | MAX_OPEN_FILES=65535 43 | 44 | # Maximum amount of locked memory 45 | #MAX_LOCKED_MEMORY= 46 | 47 | # Elasticsearch configuration directory 48 | ES_PATH_CONF=/etc/$NAME 49 | 50 | # Maximum number of VMA (Virtual Memory Areas) a process can own 51 | MAX_MAP_COUNT=262144 52 | 53 | # Elasticsearch PID file directory 54 | PID_DIR="/var/run/elasticsearch" 55 | 56 | # End of variables that can be overwritten in $DEFAULT 57 | 58 | # overwrite settings from default file 59 | if [ -f "$DEFAULT" ]; then 60 | . "$DEFAULT" 61 | fi 62 | 63 | <% if @install_type != 'tarball' %> 64 | # ES_USER and ES_GROUP settings were removed 65 | if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then 66 | echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch." 67 | exit 1 68 | fi 69 | <% end %> 70 | 71 | # Define other required variables 72 | PID_FILE="$PID_DIR/$NAME.pid" 73 | DAEMON=$ES_HOME/bin/elasticsearch 74 | DAEMON_OPTS="-d -p $PID_FILE" 75 | 76 | export ES_JAVA_OPTS 77 | export JAVA_HOME 78 | export ES_PATH_CONF 79 | 80 | if [ ! -x "$DAEMON" ]; then 81 | echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON" 82 | exit 1 83 | fi 84 | 85 | case "$1" in 86 | start) 87 | 88 | log_daemon_msg "Starting $DESC" 89 | 90 | pid=`pidofproc -p $PID_FILE elasticsearch` 91 | if [ -n "$pid" ] ; then 92 | log_begin_msg "Already running." 93 | log_end_msg 0 94 | exit 0 95 | fi 96 | 97 | # Ensure that the PID_DIR exists (it is cleaned at OS startup time) 98 | if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then 99 | mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR" 100 | fi 101 | if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then 102 | touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE" 103 | fi 104 | 105 | if [ -n "$MAX_OPEN_FILES" ]; then 106 | ulimit -n $MAX_OPEN_FILES 107 | fi 108 | 109 | if [ -n "$MAX_LOCKED_MEMORY" ]; then 110 | ulimit -l $MAX_LOCKED_MEMORY 111 | fi 112 | 113 | if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then 114 | sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT 115 | fi 116 | 117 | # Start Daemon 118 | start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS 119 | return=$? 120 | if [ $return -eq 0 ]; then 121 | i=0 122 | timeout=10 123 | # Wait for the process to be properly started before exiting 124 | until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1 125 | do 126 | sleep 1 127 | i=$(($i + 1)) 128 | if [ $i -gt $timeout ]; then 129 | log_end_msg 1 130 | exit 1 131 | fi 132 | done 133 | fi 134 | log_end_msg $return 135 | exit $return 136 | ;; 137 | stop) 138 | log_daemon_msg "Stopping $DESC" 139 | 140 | if [ -f "$PID_FILE" ]; then 141 | start-stop-daemon --stop --pidfile "$PID_FILE" \ 142 | --user elasticsearch \ 143 | --quiet \ 144 | --retry forever/TERM/20 > /dev/null 145 | if [ $? -eq 1 ]; then 146 | log_progress_msg "$DESC is not running but pid file exists, cleaning up" 147 | elif [ $? -eq 3 ]; then 148 | PID="`cat $PID_FILE`" 149 | log_failure_msg "Failed to stop $DESC (pid $PID)" 150 | exit 1 151 | fi 152 | rm -f "$PID_FILE" 153 | else 154 | log_progress_msg "(not running)" 155 | fi 156 | log_end_msg 0 157 | ;; 158 | status) 159 | status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $? 160 | ;; 161 | restart|force-reload) 162 | if [ -f "$PID_FILE" ]; then 163 | $0 stop 164 | fi 165 | $0 start 166 | ;; 167 | *) 168 | log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" 169 | exit 1 170 | ;; 171 | esac 172 | 173 | exit 0 174 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'A wrapper cookbook for use in testing that elasticsearch cookbook works well with wrappers calling it' 6 | version '0.1.0' 7 | 8 | depends 'apt' 9 | depends 'yum' 10 | depends 'elasticsearch' 11 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/default_with_plugins.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: test 3 | # Recipe:: default_with_plugins 4 | # 5 | # This cookbook is designed to be just elasticsearch::default plus installing 6 | # some plugins. We want to test the default plugin resource without any 7 | # interesting overrides, but don't want to ship that as a recipe in the main 8 | # cookbook (unlike install, configure, and service, which we do ship in the 9 | # default cookbook). 10 | 11 | elasticsearch_user 'elasticsearch' 12 | 13 | elasticsearch_install 'elasticsearch' do 14 | type node['elasticsearch']['install']['type'] 15 | end 16 | 17 | elasticsearch_configure 'elasticsearch' 18 | 19 | elasticsearch_service 'elasticsearch' 20 | 21 | elasticsearch_plugin 'analysis-icu' do 22 | notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed 23 | end 24 | 25 | elasticsearch_plugin 'mapper-size' do 26 | notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed 27 | end 28 | 29 | # remove a non-existent plugin 30 | elasticsearch_plugin 'pleasedontexist' do 31 | action :remove 32 | notifies :restart, 'elasticsearch_service[elasticsearch]', :delayed 33 | end 34 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/doubleinstances.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: test 3 | # Recipe:: doubleinstances 4 | # 5 | # Example of creating two ES instances on a single server 6 | 7 | elasticsearch_user 'elasticsearch' 8 | 9 | # for package install, share the various paths across instances 10 | elasticsearch_install 'elasticsearch' 11 | 12 | settings = { 13 | alpha: { 14 | http_port: 9201, 15 | transport_port: 9301, 16 | discovery_hosts: '127.0.0.1:9302', 17 | }, 18 | beta: { 19 | http_port: 9202, 20 | transport_port: 9302, 21 | discovery_hosts: '127.0.0.1:9301', 22 | }, 23 | } 24 | 25 | %w(alpha beta).each do |instance_name| 26 | elasticsearch_configure "elasticsearch_#{instance_name}" do 27 | instance_name instance_name 28 | path_home '/usr/share/elasticsearch' 29 | path_conf "/etc/elasticsearch-#{instance_name}" 30 | path_data "/var/lib/elasticsearch/#{instance_name}" 31 | path_logs "/var/log/elasticsearch-#{instance_name}" 32 | path_pid "/var/run/elasticsearch-#{instance_name}" 33 | path_plugins '/usr/share/elasticsearch/bin/plugin' 34 | path_bin '/usr/share/elasticsearch/bin' 35 | allocated_memory '128m' 36 | configuration( 37 | 'cluster.name' => 'mycluster', 38 | 'node.name' => "node_#{instance_name}", 39 | 'network.host' => '127.0.0.1', 40 | 'http.port' => settings[instance_name.to_sym][:http_port].to_s, 41 | 'transport.tcp.port' => settings[instance_name.to_sym][:transport_port].to_s, 42 | 'discovery.zen.ping.unicast.hosts' => settings[instance_name.to_sym][:discovery_hosts].to_s 43 | ) 44 | end 45 | 46 | elasticsearch_plugin "analysis_icu_#{instance_name}" do 47 | instance_name instance_name 48 | plugin_name 'analysis-icu' 49 | notifies :restart, "elasticsearch_service[elasticsearch_#{instance_name}]", :delayed 50 | end 51 | 52 | elasticsearch_plugin "mapper_size_#{instance_name}" do 53 | instance_name instance_name 54 | plugin_name 'mapper-size' 55 | notifies :restart, "elasticsearch_service[elasticsearch_#{instance_name}]", :delayed 56 | end 57 | 58 | elasticsearch_service "elasticsearch_#{instance_name}" do 59 | instance_name instance_name 60 | service_actions [:enable, :start] 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/fix_cacerts.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: test 3 | # Recipe:: fix_cacerts 4 | # 5 | 6 | # apparently some distros of Ubuntu don't have good SSL trust stores by default. 7 | execute 'update-ca-certificates -f && update-ca-certificates -f' do 8 | only_if 'which update-ca-certificates' 9 | end 10 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/package.rb: -------------------------------------------------------------------------------- 1 | # this is a test fixture used to test that the elasticsearch cookbook's 2 | # resources, providers, and recipes can be used correctly from a wrapper 3 | 4 | # create user with all non-default overriden options (except user/group, ESv6) 5 | elasticsearch_user 'foobar' do 6 | groupname 'elasticsearch' # can't override this w/ package in ESv6 7 | username 'elasticsearch' # can't override this in systemd, so can't test! 8 | uid 1111 9 | gid 2222 10 | shell '/bin/sh' 11 | instance_name 'special_package_instance' 12 | end 13 | 14 | # we're going to test both types on a single system! 15 | elasticsearch_install 'elasticsearch_p' do 16 | type 'package' 17 | instance_name 'special_package_instance' 18 | end 19 | 20 | elasticsearch_configure 'my_elasticsearch' do 21 | logging(action: 'INFO') 22 | 23 | allocated_memory '123m' 24 | 25 | configuration('node.name' => 'arbitrary_name') 26 | # plugin_dir '/usr/local/awesome/elasticsearch-1.7.3/plugins' 27 | action :manage 28 | instance_name 'special_package_instance' 29 | end 30 | 31 | elasticsearch_plugin 'analysis-icu' do 32 | instance_name 'special_package_instance' 33 | notifies :restart, 'elasticsearch_service[elasticsearch-crazy]' 34 | end 35 | 36 | elasticsearch_plugin 'mapper-size' do 37 | instance_name 'special_package_instance' 38 | notifies :restart, 'elasticsearch_service[elasticsearch-crazy]' 39 | end 40 | 41 | elasticsearch_service 'elasticsearch-crazy' do 42 | instance_name 'special_package_instance' 43 | service_actions [:enable, :start] 44 | end 45 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/tarball.rb: -------------------------------------------------------------------------------- 1 | # this is a test fixture used to test that the elasticsearch cookbook's 2 | # resources, providers, and recipes can be used correctly from a wrapper 3 | 4 | # create user with all non-default overriden options 5 | elasticsearch_user 'foobar' do 6 | username 'elasticsearch' 7 | groupname 'bar' 8 | uid 1111 9 | gid 2222 10 | shell '/bin/sh' 11 | instance_name 'special_tarball_instance' 12 | end 13 | 14 | elasticsearch_install 'elasticsearch_s' do 15 | type 'tarball' 16 | dir '/usr/local/awesome' 17 | instance_name 'special_tarball_instance' 18 | end 19 | 20 | elasticsearch_configure 'my_elasticsearch' do 21 | path_home '/usr/local/awesome/elasticsearch' 22 | path_conf '/usr/local/awesome/etc/elasticsearch' 23 | path_data '/usr/local/awesome/var/data/elasticsearch' 24 | path_logs '/usr/local/awesome/var/log/elasticsearch' 25 | path_pid '/usr/local/awesome/var/run' 26 | path_plugins '/usr/local/awesome/elasticsearch/plugins' 27 | path_bin '/usr/local/bin' 28 | 29 | logging(action: 'INFO') 30 | 31 | allocated_memory '123m' 32 | 33 | jvm_options %w( 34 | -server 35 | -Djava.awt.headless=true 36 | -XX:+UseG1GC 37 | -XX:+HeapDumpOnOutOfMemoryError 38 | -XX:+PrintGCDetails 39 | ) 40 | 41 | configuration('node.name' => 'crazy') 42 | action :manage 43 | instance_name 'special_tarball_instance' 44 | end 45 | 46 | elasticsearch_plugin 'analysis-icu' do 47 | instance_name 'special_tarball_instance' 48 | end 49 | 50 | elasticsearch_plugin 'mapper-size' do 51 | instance_name 'special_tarball_instance' 52 | end 53 | 54 | elasticsearch_service 'elasticsearch-crazy' do 55 | # path_conf '/usr/local/awesome/etc/elasticsearch' 56 | # path_pid '/usr/local/awesome/var/run' 57 | instance_name 'special_tarball_instance' 58 | service_actions [:enable, :start] 59 | end 60 | -------------------------------------------------------------------------------- /test/fixtures/cookbooks/test/recipes/user.rb: -------------------------------------------------------------------------------- 1 | begin 2 | user = find(elasticsearch_user: 'deleteme') 3 | rescue 4 | user = elasticsearch_user 'deleteme' 5 | end 6 | 7 | user.groupname 'foo' 8 | user.action [:create, :remove] 9 | -------------------------------------------------------------------------------- /test/fixtures/environments/chefspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chefspec", 3 | "description": "Stubbed Environment for Chefspec", 4 | "cookbook_versions": { 5 | }, 6 | "json_class": "Chef::Environment", 7 | "chef_type": "environment", 8 | "default_attributes": { 9 | }, 10 | "override_attributes": { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/integration/default/controls/extension_spec.rb: -------------------------------------------------------------------------------- 1 | auth_data = 'testuser:testpass@' 2 | 3 | control 'Plugin' do 4 | describe http("http://#{auth_data}127.0.0.1:9200/_cat/plugins") do 5 | its('status') { should eq 200 } 6 | its('body') { should match(/analysis-icu/) } 7 | its('body') { should match(/mapper-size/) } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/integration/default/controls/service_spec.rb: -------------------------------------------------------------------------------- 1 | control 'Service' do 2 | describe service('elasticsearch') do 3 | it { should be_installed } 4 | it { should be_enabled } 5 | it { should be_running } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/integration/default/controls/user_spec.rb: -------------------------------------------------------------------------------- 1 | control 'User' do 2 | describe group('elasticsearch') do 3 | it { should exist } 4 | end 5 | 6 | describe user('elasticsearch') do 7 | it { should exist } 8 | it { should have_login_shell '/bin/bash' } 9 | it { should belong_to_group 'elasticsearch' } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /test/integration/default/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: default 3 | title: Default Tests for ElasticSearch 4 | summary: This InSpec profile contains integration tests for the ElasticSearch cookbook 5 | supports: 6 | - os-family: linux 7 | - os-family: bsd 8 | -------------------------------------------------------------------------------- /test/integration/package/controls/package_test.rb: -------------------------------------------------------------------------------- 1 | control 'Elasticsearch package' do 2 | describe package('elasticsearch') do 3 | it { should be_installed } 4 | end 5 | end 6 | 7 | include_controls 'default' 8 | -------------------------------------------------------------------------------- /test/integration/package/inspec.yml: -------------------------------------------------------------------------------- 1 | name: elasticsearch package test 2 | title: Elasticsearch Package Test 3 | version: 0.1.0 4 | supports: 5 | - os-family: linux 6 | - os-family: bsd 7 | depends: 8 | - name: default 9 | path: test/integration/default 10 | -------------------------------------------------------------------------------- /test/integration/repository/controls/default_spec.rb: -------------------------------------------------------------------------------- 1 | describe package('elasticsearch') do 2 | it { should be_installed } 3 | end 4 | 5 | include_controls 'default' 6 | -------------------------------------------------------------------------------- /test/integration/repository/inspec.yml: -------------------------------------------------------------------------------- 1 | name: elasticsearch repository test 2 | title: Elasticsearch Repository Test 3 | version: 0.1.0 4 | supports: 5 | - os-family: linux 6 | - os-family: bsd 7 | depends: 8 | - name: default 9 | path: test/integration/default 10 | --------------------------------------------------------------------------------