Skip to content

Commit

Permalink
Fix OpenSearch compatibility issue (mastodon#30278)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored May 14, 2024
1 parent 3a7aec2 commit b5b84fa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ jobs:
ports:
- 6379:6379

search:
image: ${{ matrix.search-image }}
elasticsearch:
image: ${{ contains(matrix.search-image, 'elasticsearch') && matrix.search-image || '' }}
env:
discovery.type: single-node
xpack.security.enabled: false
Expand All @@ -277,6 +277,20 @@ jobs:
ports:
- 9200:9200

opensearch:
image: ${{ contains(matrix.search-image, 'opensearch') && matrix.search-image || '' }}
env:
discovery.type: single-node
DISABLE_INSTALL_DEMO_CONFIG: true
DISABLE_SECURITY_PLUGIN: true
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200

env:
DB_HOST: localhost
DB_USER: postgres
Expand All @@ -300,6 +314,8 @@ jobs:
include:
- ruby-version: '.ruby-version'
search-image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
- ruby-version: '.ruby-version'
search-image: opensearchproject/opensearch:2

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
require_relative '../lib/public_file_server_middleware'
require_relative '../lib/devise/strategies/two_factor_ldap_authenticatable'
require_relative '../lib/devise/strategies/two_factor_pam_authenticatable'
require_relative '../lib/elasticsearch/client_extensions'
require_relative '../lib/chewy/settings_extensions'
require_relative '../lib/chewy/index_extensions'
require_relative '../lib/chewy/strategy/mastodon'
Expand Down
11 changes: 11 additions & 0 deletions lib/elasticsearch/client_extensions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Elasticsearch
module ClientExtensions
def verify_elasticsearch
@verified = true
end
end
end

Elasticsearch::Client.prepend(Elasticsearch::ClientExtensions)

0 comments on commit b5b84fa

Please sign in to comment.