diff --git a/Berksfile b/Berksfile index d5228b4..2256783 100644 --- a/Berksfile +++ b/Berksfile @@ -52,3 +52,4 @@ cookbook 'mariadb', '= 0.3.1' cookbook 'ipfs', git: 'https://github.com/67P/ipfs-cookbook.git', ref: 'v0.4.1' +cookbook 'elasticsearch', '= 4.2.0' diff --git a/Berksfile.lock b/Berksfile.lock index 78ada7a..fab450f 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -11,6 +11,7 @@ DEPENDENCIES chef_client_updater (= 1.1.1) compat_resource (= 12.19.0) composer (~> 2.6.1) + elasticsearch (= 4.2.0) firewall (~> 2.6.3) git (= 6.0.0) homebrew (= 3.0.0) @@ -89,6 +90,11 @@ GRAPH php (>= 0.0.0) windows (>= 0.0.0) dmg (4.1.1) + elasticsearch (4.2.0) + apt (>= 0.0.0) + ark (>= 0.0.0) + chef-sugar (>= 0.0.0) + yum (>= 0.0.0) firewall (2.6.5) chef-sugar (>= 0.0.0) git (6.0.0) diff --git a/site-cookbooks/kosmos-mastodon/metadata.rb b/site-cookbooks/kosmos-mastodon/metadata.rb index 57d24ac..68ca72c 100644 --- a/site-cookbooks/kosmos-mastodon/metadata.rb +++ b/site-cookbooks/kosmos-mastodon/metadata.rb @@ -4,7 +4,7 @@ maintainer_email 'mail@kosmos.org' license 'MIT' description 'Installs/Configures kosmos-mastodon' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' +version '0.2.0' depends "kosmos-nginx" depends "kosmos-nodejs" @@ -15,4 +15,5 @@ depends "application_javascript" depends "postgresql" depends "kosmos-postgresql" depends "backup" +depends "elasticsearch" depends "tor-full" diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 99bd11d..0e4dba9 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -28,6 +28,19 @@ include_recipe "kosmos-nodejs" include_recipe "kosmos-redis" include_recipe "kosmos-postgresql" +elasticsearch_user 'elasticsearch' + +elasticsearch_install 'elasticsearch' do + type 'package' + version '6.8.2' +end + +elasticsearch_configure 'elasticsearch' do + allocated_memory '1536m' +end + +elasticsearch_service 'elasticsearch' + # TODO: Remove the condition once we have migrated mastodon to andromeda unless platform?('ubuntu') && node[:platform_version].to_f < 18.04 postgresql_data_bag_item = data_bag_item('credentials', 'postgresql') diff --git a/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb b/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb index 93cfe47..eb3b559 100644 --- a/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb +++ b/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb @@ -55,4 +55,9 @@ S3_REGION=<%= @s3_region %> VAPID_PRIVATE_KEY=<%= @vapid_private_key %> VAPID_PUBLIC_KEY=<%= @vapid_public_key %> +# Elasticsearch +ES_ENABLED=true +ES_HOST=localhost +ES_PORT=9200 + ALLOW_ACCESS_TO_HIDDEN_SERVICE=true