diff --git a/Berksfile b/Berksfile index ff0f8be..a401e91 100644 --- a/Berksfile +++ b/Berksfile @@ -49,7 +49,7 @@ cookbook 'mariadb', '= 0.3.1' cookbook 'ipfs', git: 'https://gitea.kosmos.org/kosmos/ipfs-cookbook.git', ref: 'v0.7.0' -cookbook 'elasticsearch', '= 4.2.0' +cookbook 'elasticsearch', '= 4.3.0' cookbook 'java', '~> 4.3.0' cookbook 'ulimit', '~> 1.0.0' cookbook 'golang', '~> 5.3.1' diff --git a/Berksfile.lock b/Berksfile.lock index 9bf79bb..90b3ba8 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -9,7 +9,7 @@ DEPENDENCIES chef-sugar (= 3.3.0) compat_resource (= 12.19.0) composer (~> 2.7.0) - elasticsearch (= 4.2.0) + elasticsearch (= 4.3.0) firewall (~> 2.6.3) git (~> 10.0.0) golang (~> 5.3.1) @@ -81,7 +81,7 @@ GRAPH apt (>= 0.0.0) php (>= 0.0.0) windows (>= 0.0.0) - elasticsearch (4.2.0) + elasticsearch (4.3.0) apt (>= 0.0.0) ark (>= 0.0.0) chef-sugar (>= 0.0.0) diff --git a/cookbooks/elasticsearch/CHANGELOG.md b/cookbooks/elasticsearch/CHANGELOG.md index 63df6f4..bcfa959 100644 --- a/cookbooks/elasticsearch/CHANGELOG.md +++ b/cookbooks/elasticsearch/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [v4.3.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.3.0) (2019-12-30) +- Default to Elasticsearch 7.4.2 + ## [v4.2.0](https://github.com/elastic/cookbook-elasticsearch/tree/v4.2.0) (2019-08-02) - Default to Elasticsearch 7.3.0 - Some fixes for the version logic when selecting v7 or higher ES diff --git a/cookbooks/elasticsearch/README.md b/cookbooks/elasticsearch/README.md index fed8cf8..82aa963 100644 --- a/cookbooks/elasticsearch/README.md +++ b/cookbooks/elasticsearch/README.md @@ -156,7 +156,7 @@ elasticsearch_install 'elasticsearch' ```ruby elasticsearch_install 'my_es_installation' do type 'package' # type of install - version '7.3.0' + version '7.4.2' action :install # could be :remove as well end ``` @@ -177,7 +177,7 @@ end ```ruby elasticsearch_install 'my_es_installation' do type 'tarball' # type of install - version '7.3.0' + version '7.4.2' action :install # could be :remove as well end ``` diff --git a/cookbooks/elasticsearch/attributes/default.rb b/cookbooks/elasticsearch/attributes/default.rb index be118ff..c15f2d0 100644 --- a/cookbooks/elasticsearch/attributes/default.rb +++ b/cookbooks/elasticsearch/attributes/default.rb @@ -140,6 +140,22 @@ default['elasticsearch']['checksums']['6.8.2']['debian'] = '9e6b591bef75d042abb4 default['elasticsearch']['checksums']['6.8.2']['rhel'] = '3561e6c1bbac324448928e752b9d6c0d2a413c569993625f6dd255b343f61a6c' default['elasticsearch']['checksums']['6.8.2']['tarball'] = '2dc3107475659dfd21afa74612a43d5ccbcf4942ab679e8e4e77167cafe27c94' +default['elasticsearch']['checksums']['6.8.3']['debian'] = '65220ba62793445dc0a6fc41078f6020dcfe5b3c9d5ee2ba75d17866b5e09d40' +default['elasticsearch']['checksums']['6.8.3']['rhel'] = '9c3c7d18f12db3e27fb8c751ffae1c5a5dd8db59266a5ebb69d620e3ae363de2' +default['elasticsearch']['checksums']['6.8.3']['tarball'] = '824078e421c9f7e5ab9c875e4019d9ebfe3ada99db286b54dec090f97d1cbe25' + +default['elasticsearch']['checksums']['6.8.4']['debian'] = '55b4248b38c72d254230c8469847649489fe4abf1b2e14e3a82f6ae5214f8a8f' +default['elasticsearch']['checksums']['6.8.4']['rhel'] = '1d618c51a263984da1992230d35611b012aff8ade4fee0a16338f9919a9a4a9b' +default['elasticsearch']['checksums']['6.8.4']['tarball'] = 'b8a545cc6d5fc3bd4be7adbe7057faa68fc548cf1923b30a2d90f328c6da96c9' + +default['elasticsearch']['checksums']['6.8.5']['debian'] = '115e5649962793fbcc628b0eb660eafe570ff67676ca88cf98e7cec830fd1dd4' +default['elasticsearch']['checksums']['6.8.5']['rhel'] = '96520e7c3b49bdad753ccfad76ce2899dbcecf6a1531f20a59b5087305a1c557' +default['elasticsearch']['checksums']['6.8.5']['tarball'] = '5fe84fa84a0ca0136aad9bbdfc2053f8dda9a3e166ddf34e947bb1fe24e4ce6d' + +default['elasticsearch']['checksums']['6.8.6']['debian'] = '82dce29bb3c9108f44e936c3fc6200ce7264bb1a27c1a1cc6dde39b6eac03487' +default['elasticsearch']['checksums']['6.8.6']['rhel'] = '4880396d1a78046efe4a6ec45c1cc2f1f9f0d328466aa32355e95f9834d9d0af' +default['elasticsearch']['checksums']['6.8.6']['tarball'] = '67b9b07a649831eb30779cf8264548a0828414ba9abb1be7bc592a8db91fdf7c' + default['elasticsearch']['checksums']['7.0.0']['debian'] = '491d36af33bc896f8c44c46e1ed550e304220c9eedee991091864f5f3434e2f4' default['elasticsearch']['checksums']['7.0.0']['rhel'] = '99ed1d22c128189ccb07c99babe7f437180e42c94af15782acf4b80d2520abc4' default['elasticsearch']['checksums']['7.0.0']['tarball'] = '68deee5e9c961ad48cc83859970ac7a79029fe5f5e6de7e58ea0f7c7713f25ba' @@ -167,3 +183,31 @@ default['elasticsearch']['checksums']['7.2.1']['tarball'] = 'd5d660895a39755ad6a default['elasticsearch']['checksums']['7.3.0']['debian'] = '72ae24cf0f5d97a307f35d116a41e1165e80f58f08b0ca4e6de3ec5228f06f9c' default['elasticsearch']['checksums']['7.3.0']['rhel'] = 'f49dc809cf48369b70546f13dfb28b43e1a07387b681ca786c794762d52847ca' default['elasticsearch']['checksums']['7.3.0']['tarball'] = '6cddb4d9a3c5e730f8e35e2155937c069d057129808ea135d31f0ed5f7f2ea22' + +default['elasticsearch']['checksums']['7.3.1']['debian'] = '570af7456603fd103408ed61ccec4473302976d46e1ff845b74a881122977e02' +default['elasticsearch']['checksums']['7.3.1']['rhel'] = '240f93d16da4c20d2cc377b7c6a61dbf4fb9634d74829ccb5f7cd42c023bc967' +default['elasticsearch']['checksums']['7.3.1']['tarball'] = '69864bcbca495603004c6c4e6f5d69bce4dc89cd6d672d1ebc7f5387a3d13c74' + +default['elasticsearch']['checksums']['7.3.2']['debian'] = '690e98653b3dc50ec5f8e65c480ec41c8c4db0d2c63b5ed3f25fef53d6aaaa55' +default['elasticsearch']['checksums']['7.3.2']['rhel'] = 'bdada0a4c7b5574c41726154212b6b25373e2b4d7d2a64e24238b206ad422ecd' +default['elasticsearch']['checksums']['7.3.2']['tarball'] = '8254dc2d98959cb7964a523a7abab3cd40362dde694ce020ae1efd554efb8e82' + +default['elasticsearch']['checksums']['7.4.0']['debian'] = '3edf17d9d63a08a0f7eb7d9727a1737e1c770277f64fe44342115e62f752cc51' +default['elasticsearch']['checksums']['7.4.0']['rhel'] = '1bfae41734c77af3bc66084ac0cc04add1190f9311b045d3c184ea7b3e688334' +default['elasticsearch']['checksums']['7.4.0']['tarball'] = 'b712ced4a7feae46c3f966d52ac24f1b3418ee3ffbf0495a97f27ccf40878873' + +default['elasticsearch']['checksums']['7.4.1']['debian'] = '55a92288e81856e9bb6c36c0f7149b24cf36432527ca809fc48e25775b0cf584' +default['elasticsearch']['checksums']['7.4.1']['rhel'] = '8ec30fbd95235cb15d0f27cd40f75a43f640f5832e2ee2d44fe8d2983cd5724f' +default['elasticsearch']['checksums']['7.4.1']['tarball'] = '39be609b1051bc92dc8a9481d47c4c16c9efd77e8a423eca97eb45fec5d4d156' + +default['elasticsearch']['checksums']['7.4.2']['debian'] = '514a8e21e173481edb9130ebbf33f15209b467df5c2222632d63c4527c16abc6' +default['elasticsearch']['checksums']['7.4.2']['rhel'] = 'af616eed2cd30411f400dee0c993eb8fccd55e510548697d7cc0eb178ac4adec' +default['elasticsearch']['checksums']['7.4.2']['tarball'] = 'f54475eafbf3384f4378002d87badf013018a9238937a4bd780e71271c670772' + +default['elasticsearch']['checksums']['7.5.0']['debian'] = '5b167d15461049f6aa58a96d805c9bcd297ad19467392eea125ce91c5eaaf908' +default['elasticsearch']['checksums']['7.5.0']['rhel'] = 'a8e802c74c3163272fb7119a9d23c1e8f7bbe76e6502a3fcc30709705bc57f4a' +default['elasticsearch']['checksums']['7.5.0']['tarball'] = '1e183717071e329591c109a8560a90b66ddd55958a68cc83385ae123d680b4ca' + +default['elasticsearch']['checksums']['7.5.1']['debian'] = 'e566a88e15d8f85cf793c8f971b51eeae6465a0aa73f968ae4b1ee6aa71e4c20' +default['elasticsearch']['checksums']['7.5.1']['rhel'] = 'e6202bba2bd8644d23dcbef9ad7780c847dfe4ee699d3dc1804f6f62eed59c2d' +default['elasticsearch']['checksums']['7.5.1']['tarball'] = '37c317efaacf33a1bae250a59e822864750fddd8caf08c4b6a6c235ffa5f47e8' diff --git a/cookbooks/elasticsearch/libraries/resource_install.rb b/cookbooks/elasticsearch/libraries/resource_install.rb index d20f839..c6ae796 100644 --- a/cookbooks/elasticsearch/libraries/resource_install.rb +++ b/cookbooks/elasticsearch/libraries/resource_install.rb @@ -11,7 +11,7 @@ class ElasticsearchCookbook::InstallResource < Chef::Resource::LWRPBase # if this version parameter is not set by the caller, we look at # `attributes/default.rb` for a default value to use, or we raise - attribute(:version, kind_of: String, default: '7.3.0') + attribute(:version, kind_of: String, default: '7.4.2') # we allow a string or symbol for this value attribute(:type, kind_of: String, equal_to: %w(package tarball repository), default: 'repository') diff --git a/cookbooks/elasticsearch/metadata.json b/cookbooks/elasticsearch/metadata.json index 2d7d38b..21d45f1 100644 --- a/cookbooks/elasticsearch/metadata.json +++ b/cookbooks/elasticsearch/metadata.json @@ -1 +1 @@ -{"name":"elasticsearch","version":"4.2.0","description":"Installs and configures Elasticsearch","long_description":"# Elasticsearch Chef Cookbook\n\n[![Build Status](https://travis-ci.org/elastic/cookbook-elasticsearch.svg?branch=master)](https://travis-ci.org/elastic/cookbook-elasticsearch) [![Cookbook Version](https://img.shields.io/cookbook/v/elasticsearch.svg)](https://supermarket.chef.io/cookbooks/elasticsearch)[![Build Status](https://jenkins-01.eastus.cloudapp.azure.com/job/elasticsearch-cookbook/badge/icon)](https://jenkins-01.eastus.cloudapp.azure.com/job/elasticsearch-cookbook/)\n\n**Please** review the [frequently asked questions](FAQ.md) and [contributing guidelines](CONTRIBUTING.md) before opening issues or submitting pull requests.\n\n## Looking for Elasticsearch 5.x or 6.x?\n\nPlease [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.\n\n## Attributes\n\nPlease consult [attributes/default.rb](attributes/default.rb) for a large list\nof checksums for many different archives and package files of different\nelasticsearch versions. Both recipes and resources/providers here use those\ndefault values.\n\nYou may use `%s` in your URL and this cookbook will use sprintf/format to insert\nthe version parameter as a string into your download_url.\n\n|Name|Default|Other values|\n|----|-------|------------|\n| For Elasticsearch < 7: ||\n|`default['elasticsearch']['download_urls']['debian']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n|`default['elasticsearch']['download_urls']['rhel']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n|`default['elasticsearch']['download_urls']['tarball']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n| For Elasticsearch >= 7: ||\n|`default['elasticsearch']['download_urls_v7']['debian']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n|`default['elasticsearch']['download_urls_v7']['rhel']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n|`default['elasticsearch']['download_urls_v7']['tarball']`|[See values](attributes/default.rb).|`%s` will be replaced with the version attribute above|\n\nThis cookbook's `elasticsearch::default` recipe also supports setting any `elasticsearch_` resource using attributes:\n\n```\ndefault['elasticsearch']['user'] = {}\ndefault['elasticsearch']['install'] = {}\ndefault['elasticsearch']['configure'] = {}\ndefault['elasticsearch']['service'] = {}\ndefault['elasticsearch']['plugin'] = {}\n```\n\nFor example, this will pass a username 'foo' to `elasticsearch_user` and set a uid to `1234`:\n```\ndefault['elasticsearch']['user']['username'] = 'foo'\ndefault['elasticsearch']['user']['uid'] = '1234'\n```\n\n## Recipes\n\nResources are the intended way to consume this cookbook, however we have\nprovided a single recipe that configures Elasticsearch by downloading an archive\ncontaining a distribution of Elasticsearch, and extracting that into `/usr/share`.\n\nSee the attributes section above to for what defaults you can adjust.\n\n### default\n\nThe default recipe creates an elasticsearch user, group, package installation,\nconfiguration files, and service with all of the default options.\n\nPlease note that there are [additional examples within the test fixtures](test/fixtures/cookbooks/elasticsearch_test),\nincluding a demonstration of how to configure two instances of Elasticsearch on a single server.\n\n## Resources\n\n## Notifications and Service Start/Restart\n\nThe 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.\n\nelasticsearch_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\nactions to the underlying service resource if you wish to notify it.\n\nYou **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.\n\nWe are supporting whyrun mode in this cookbook, simply because we're using all builtin resources from core Chef, and these also already support whyrun. If you contribute to this cookbook, please be sure to maintain that or guard dangerous Ruby code with something like `if !whyrun_mode? || nested_resource.whyrun_supported?`.\n\n### Resource names\n\nMany of the resources provided in this cookbook need to share configuration\nvalues. For example, the `elasticsearch_service` resource needs to know the path\nto the configuration file(s) generated by `elasticsearch_configure` and the path\nto the actual ES binary installed by `elasticsearch_install`. And they both need\nto know the appropriate system user and group defined by `elasticsearch_user`.\n\nSearch order: In order to make this easy, all resources in this cookbook use the following\nsearch order to locate resources that apply to the same overall\nElasticsearch setup:\n\n1. Resources that share the same resource name\n1. Resources that share the same value for `instance_name`\n1. Resources named `default` or resources named `elasticsearch`\n - This fails if both `default` and `elasticsearch` resources exist\n\nExamples of more complicated resource names are left to the reader, but here we\npresent a typical example that should work in most cases:\n\n```ruby\nelasticsearch_user 'elasticsearch'\nelasticsearch_install 'elasticsearch'\nelasticsearch_configure 'elasticsearch'\nelasticsearch_service 'elasticsearch'\nelasticsearch_plugin 'x-pack'\n```\n\n### elasticsearch_user\nActions: `:create`, `:remove`\n\nCreates a user and group on the system for use by elasticsearch. Here is an\nexample with many of the default options and default values (all options except\na resource name may be omitted).\n\nExamples:\n\n```ruby\nelasticsearch_user 'elasticsearch'\n```\n\n```ruby\nelasticsearch_user 'elasticsearch' do\n username 'elasticsearch'\n groupname 'elasticsearch'\n shell '/bin/bash'\n comment 'Elasticsearch User'\n\n action :create\nend\n```\n\n### elasticsearch_install\nActions: `:install`, `:remove`\n\nDownloads the elasticsearch software, and unpacks it on the system. There are\ncurrently three ways to install -- `'repository'` (the default), which creates an\napt or yum repo and installs from there, `'package'`, which downloads the appropriate\npackage from elasticsearch.org and uses the package manager to install it, and\n`'tarball'` which downloads a tarball from elasticsearch.org and unpacks it.\nThis resource also comes with a `:remove` action which will remove the package\nor directory elasticsearch was unpacked into.\n\nYou may always specify a download_url and/or download_checksum, and you may\ninclude `%s` which will be replaced by the version parameter you supply.\n\nPlease be sure to consult the above attribute section as that controls how\nElasticsearch version, download URL and checksum are determined if you omit\nthem.\n\n**NOTE**: The `:remove` action has not been implemented yet. Pull requests are\nvery much welcome & encouraged, if you'd like to see this feature.\n\nExamples:\n\n```ruby\nelasticsearch_install 'elasticsearch'\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n type 'package' # type of install\n version '7.3.0'\n action :install # could be :remove as well\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n type 'tarball' # type of install\n dir '/usr/local' # where to install\n\n download_url \"https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz\"\n # sha256\n download_checksum \"6f81935e270c403681e120ec4395c28b2ddc87e659ff7784608b86beb5223dd2\"\n\n action :install # could be :remove as well\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n type 'tarball' # type of install\n version '7.3.0'\n action :install # could be :remove as well\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n type 'package' # type of install\n download_url \"https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb\"\n # sha256\n download_checksum \"791fb9f2131be2cf8c1f86ca35e0b912d7155a53f89c2df67467ca2105e77ec2\"\n instance_name 'elasticsearch'\n action :install # could be :remove as well\nend\n```\n\n### elasticsearch_configure\nActions: `:manage`, `:remove`\n\nConfigures an elasticsearch instance; creates directories for configuration,\nlogs, and data. Writes files `log4j2.properties`, `elasticsearch.in.sh` and\n`elasticsearch.yml`.\n\nThe main attribute for this resource is `configuration`,\nwhich is a hash of any elasticsearch configuration directives. The\nother important attribute is `default_configuration` -- this contains the\nminimal set of required defaults.\n\nNote that these are both _not_ a Chef mash, everything must be in a single level\nof keys and values. Any settings you pass in configuration will be merged into\n(and potentially overwrite) any default settings.\n\nSee the examples, [as well as the attributes in the resource file](libraries/resource_configure.rb),\nfor more.\n\nExamples:\n\nWith all defaults -\n```ruby\nelasticsearch_configure 'elasticsearch'\n```\n\nWith mostly defaults -\n```ruby\nelasticsearch_configure 'elasticsearch' do\n allocated_memory '512m'\n configuration ({\n 'cluster.name' => 'escluster',\n 'node.name' => 'node01',\n 'http.port' => 9201\n })\nend\n```\n\nVery complicated -\n```ruby\nelasticsearch_configure 'my_elasticsearch' do\n # if you override one of these, you probably want to override all\n path_home \"/opt/elasticsearch\"\n path_conf \"/etc/opt/elasticsearch\"\n path_data \"/var/opt/elasticsearch\"\n path_logs \"/var/log/elasticsearch\"\n path_pid \"/var/run/elasticsearch\"\n path_plugins \"/opt/elasticsearch/plugins\"\n path_bin \"/opt/elasticsearch/bin\"\n\n # override logging parameters\n cookbook_log4j2_properties \"my_wrapper_cookbook\"\n template_log4j2_properties \"my_log4j2.properties.erb\"\n\n logging({:\"action\" => 'INFO'})\n\n allocated_memory '123m'\n\n jvm_options %w(\n -XX:+UseParNewGC\n -XX:+UseConcMarkSweepGC\n -XX:CMSInitiatingOccupancyFraction=75\n -XX:+UseCMSInitiatingOccupancyOnly\n -XX:+HeapDumpOnOutOfMemoryError\n -XX:+PrintGCDetails\n )\n\n configuration ({\n 'node.name' => 'crazy'\n })\n\n action :manage\nend\n```\n\n### elasticsearch_service\nActions: `:configure`, `:remove`\n\nWrites out a system service configuration of the appropriate type, and enables\nit to start on boot. You can override almost all of the relevant settings in\nsuch a way that you may run multiple instances. Most settings will be taken from\na matching `elasticsearch_config` resource in the collection.\n\n```ruby\nelasticsearch_service 'elasticsearch'\n```\n\nIf you'd like to skip init scripts and systemd scripts, simply pass `nil` for\nthe template file (init_source or systemd_source) and this cookbook will\nentirely skip trying to setup those scripts. Combined with changing the default\nservice actions, this will have the same effect as `action :nothing`.\n\n### elasticsearch_plugin\nActions: `:install`, `:remove`\n\nInstalls or removes a plugin to a given elasticsearch instance and plugin\ndirectory. Please note that there is currently no way to upgrade an existing\nplugin using commandline tools, so we haven't exposed that feature here either.\nFurthermore, there isn't a way to determine if a plugin is compatible with ES or\neven what version it is. So once we install a plugin to a directory, we\ngenerally assume that is the desired one and we don't touch it further.\n\nSee https://github.com/elastic/cookbook-elasticsearch/issues/264 for more info.\nNB: You [may encounter issues on certain distros](http://blog.backslasher.net/java-ssl-crash.html) with NSS 3.16.1 and OpenJDK 7.x.\n\nOfficially supported or commercial plugins require just the plugin name:\n\n```ruby\nelasticsearch_plugin 'analysis-icu' do\n action :install\nend\nelasticsearch_plugin 'shield' do\n action :install\nend\n```\n\nPlugins from GitHub require a URL of 'username/repository' or 'username/repository/version':\n\n```ruby\nelasticsearch_plugin 'kopf' do\n url 'lmenezes/elasticsearch-kopf'\n action :install\nend\n\nelasticsearch_plugin 'kopf' do\n url 'lmenezes/elasticsearch-kopf/1.5.7'\n action :install\nend\n```\n\nPlugins from Maven Central or Sonatype require 'groupId/artifactId/version':\n```ruby\nelasticsearch_plugin 'mapper-attachments' do\n url 'org.elasticsearch/elasticsearch-mapper-attachments/2.6.0'\n action :install\nend\n```\n\nPlugins can be installed from a custom URL or file location as follows:\n```ruby\nelasticsearch_plugin 'mapper-attachments' do\n url 'http://some.domain.name//my-plugin-1.0.0.zip'\n action :install\nend\n\nelasticsearch_plugin 'mapper-attachments' do\n url 'file:/path/to/my-plugin-1.0.0.zip'\n action :install\nend\n```\n\nThe plugin resource respects the `https_proxy` or `http_proxy` (non-SSL)\n[Chef settings](https://docs.chef.io/config_rb_client.html) unless explicitly\ndisabled using `chef_proxy false`:\n```ruby\nelasticsearch_plugin 'kopf' do\n url 'lmenezes/elasticsearch-kopf'\n chef_proxy false\n action :install\nend\n```\n\nTo run multiple instances per machine, an explicit `plugin_dir` location\nhas to be provided:\n\n```ruby\nelasticsearch_plugin 'x-pack' do\n plugin_dir '/usr/share/elasticsearch_foo/plugins'\nend\n```\n\nIf for some reason, you want to name the resource something else, you may\nprovide the true plugin name using the `plugin_name` parameter:\n\n```ruby\nelasticsearch_plugin 'xyzzy' do\n plugin_name 'kopf'\n url 'lmenezes/elasticsearch-kopf'\n action :install\nend\n```\n\n## License\n\nThis software is licensed under the Apache 2 license, quoted below.\n\n Copyright (c) 2015 Elasticsearch \n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n","maintainer":"Karel Minarik","maintainer_email":"karel.minarik@elasticsearch.org","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","redhat":">= 0.0.0","ubuntu":">= 0.0.0"},"dependencies":{"apt":">= 0.0.0","yum":">= 0.0.0","chef-sugar":">= 0.0.0","ark":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/elastic/cookbook-elasticsearch","issues_url":"https://github.com/elastic/cookbook-elasticsearch/issues","chef_version":[[">= 12.5"]],"ohai_version":[]} \ No newline at end of file +{"name":"elasticsearch","version":"4.3.0","description":"Installs and configures Elasticsearch","long_description":"","maintainer":"Karel Minarik","maintainer_email":"karel.minarik@elasticsearch.org","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","redhat":">= 0.0.0","ubuntu":">= 0.0.0"},"dependencies":{"apt":">= 0.0.0","yum":">= 0.0.0","chef-sugar":">= 0.0.0","ark":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/elastic/cookbook-elasticsearch","issues_url":"https://github.com/elastic/cookbook-elasticsearch/issues","chef_version":[[">= 12.5"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/elasticsearch/metadata.rb b/cookbooks/elasticsearch/metadata.rb index 0c1ec35..a7eec6d 100644 --- a/cookbooks/elasticsearch/metadata.rb +++ b/cookbooks/elasticsearch/metadata.rb @@ -4,8 +4,7 @@ maintainer 'Karel Minarik' maintainer_email 'karel.minarik@elasticsearch.org' license 'Apache-2.0' description 'Installs and configures Elasticsearch' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '4.2.0' +version '4.3.0' supports 'amazon' supports 'centos' diff --git a/nodes/mastodon-3.json b/nodes/mastodon-3.json index 66f0d9b..fe1625b 100644 --- a/nodes/mastodon-3.json +++ b/nodes/mastodon-3.json @@ -12,18 +12,19 @@ "hostname": "mastodon-3", "ipaddress": "192.168.122.161", "roles": [ + "kvm_guest", "mastodon", - "postgresql_client", - "kvm_guest" + "postgresql_client" ], "recipes": [ "kosmos-base", "kosmos-base::default", + "kosmos_kvm::guest", "kosmos_postgresql::hostsfile", "kosmos-mastodon", "kosmos-mastodon::default", "kosmos-mastodon::nginx", - "kosmos_kvm::guest", + "kosmos-mastodon::backup", "apt::default", "timezone_iii::default", "timezone_iii::debian", @@ -67,6 +68,8 @@ "nginx::commons_conf", "kosmos-nginx::firewall", "tor-full::default", + "backup::default", + "logrotate::default", "git::default", "git::package", "kosmos-base::letsencrypt" @@ -90,4 +93,4 @@ "role[kvm_guest]", "role[mastodon]" ] -} +} \ No newline at end of file diff --git a/roles/mastodon.rb b/roles/mastodon.rb index f1064c4..a69e384 100644 --- a/roles/mastodon.rb +++ b/roles/mastodon.rb @@ -4,4 +4,5 @@ run_list %w( role[postgresql_client] kosmos-mastodon kosmos-mastodon::nginx + kosmos-mastodon::backup ) diff --git a/roles/postgresql_primary.rb b/roles/postgresql_primary.rb index 7126cb2..183da14 100644 --- a/roles/postgresql_primary.rb +++ b/roles/postgresql_primary.rb @@ -5,4 +5,5 @@ run_list %w( kosmos_postgresql::firewall kosmos_gitea::pg_db kosmos_drone::pg_db + kosmos-mastodon::pg_db ) diff --git a/site-cookbooks/backup/metadata.rb b/site-cookbooks/backup/metadata.rb index d364631..d7ae4e2 100644 --- a/site-cookbooks/backup/metadata.rb +++ b/site-cookbooks/backup/metadata.rb @@ -8,3 +8,4 @@ name "backup" depends 'logrotate' depends 'mysql' +depends 'postgresql' diff --git a/site-cookbooks/backup/recipes/default.rb b/site-cookbooks/backup/recipes/default.rb index f2b9fa2..84a6b75 100644 --- a/site-cookbooks/backup/recipes/default.rb +++ b/site-cookbooks/backup/recipes/default.rb @@ -3,6 +3,7 @@ # Recipe:: default # +apt_package 'postgresql-client-12' build_essential 'backup gem' # Don't try to install packages on older Ubuntu, the repositories are 404 diff --git a/site-cookbooks/kosmos-mastodon/recipes/backup.rb b/site-cookbooks/kosmos-mastodon/recipes/backup.rb new file mode 100644 index 0000000..46bb664 --- /dev/null +++ b/site-cookbooks/kosmos-mastodon/recipes/backup.rb @@ -0,0 +1,18 @@ +# +# Cookbook Name:: kosmos-mastodon +# Recipe:: backup +# + +postgresql_data_bag_item = data_bag_item('credentials', 'postgresql') + +unless node.chef_environment == "development" + unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon' + node.override["backup"]["postgresql"]["host"] = "pg.kosmos.local" + node.override["backup"]["postgresql"]["databases"]["mastodon"] = { + username: "mastodon", + password: postgresql_data_bag_item['mastodon_user_password'] + } + end + + include_recipe "backup" +end diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 5dcba8b..e61f1ee 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -12,11 +12,28 @@ elasticsearch_user 'elasticsearch' elasticsearch_install 'elasticsearch' do type 'package' - version '6.8.2' + version '7.17.7' + action :install end elasticsearch_configure 'elasticsearch' do allocated_memory node["kosmos-mastodon"]["elasticsearch"]["allocated_memory"] + + jvm_options %w( + -Xms1536m + -Xmx1536m + -XX:+AlwaysPreTouch + -server + -Xss1m + -Djava.awt.headless=true + -Dfile.encoding=UTF-8 + -Djna.nosys=true + -XX:-OmitStackTraceInFastThrow + -Dio.netty.noUnsafe=true + -Dio.netty.noKeySetOptimization=true + -Dio.netty.recycler.maxCapacityPerThread=0 + -XX:+HeapDumpOnOutOfMemoryError + ) end elasticsearch_service 'elasticsearch' @@ -47,7 +64,7 @@ npm_package "yarn" do version "1.22.4" end -ruby_version = "2.7.2" +ruby_version = "3.0.3" execute "systemctl daemon-reload" do command "systemctl daemon-reload" @@ -166,7 +183,8 @@ application mastodon_path do end execute 'rake db:migrate' do - environment "RAILS_ENV" => "production", "HOME" => mastodon_path#, "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "true" + # environment "RAILS_ENV" => "production", "HOME" => mastodon_path#, "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "true" + environment "RAILS_ENV" => "production", "HOME" => mastodon_path, "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "true" user mastodon_user group mastodon_user cwd mastodon_path diff --git a/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb b/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb index af15e80..563a356 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb @@ -14,18 +14,3 @@ postgresql_database 'mastodon' do owner 'mastodon' action :create end - -# -# Backup -# - -unless node.chef_environment == "development" - unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon' - node.override["backup"]["postgresql"]["databases"]["mastodon"] = { - username: "mastodon", - password: postgresql_data_bag_item['mastodon_user_password'] - } - end - - include_recipe "backup" -end