Fix OpenSearch compatibility issue (#30278)
This commit is contained in:
		
							
								
								
									
										20
									
								
								.github/workflows/test-ruby.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/test-ruby.yml
									
									
									
									
										vendored
									
									
								
							@@ -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
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@ require_relative '../lib/mastodon/rack_middleware'
 | 
			
		||||
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'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								lib/elasticsearch/client_extensions.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/elasticsearch/client_extensions.rb
									
									
									
									
									
										Normal file
									
								
							@@ -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)
 | 
			
		||||
		Reference in New Issue
	
	Block a user