Configure Elasticsearch
This commit is contained in:
parent
6846af8668
commit
3e8e161937
|
@ -33,6 +33,11 @@ env:
|
|||
- RAILS_CACHE_REDIS_DB=1
|
||||
- RAILS_CACHE_REDIS_PASSWORD=
|
||||
|
||||
- ELASTICSEARCH_HOST=localhost
|
||||
- ELASTICSEARCH_PORT=9200
|
||||
- ELASTICSEARCH_USER=elastic
|
||||
- ELASTICSEARCH_PASSWORD=changeme
|
||||
|
||||
before_install:
|
||||
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
|
||||
- sudo tar -xvzf geckodriver*
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
conf = Rails.application.settings :elasticsearch
|
||||
|
||||
Elasticsearch::Model.client = Elasticsearch::Client.new(
|
||||
scheme: :http,
|
||||
host: '127.0.0.1',
|
||||
port: 9200,
|
||||
user: 'elastic',
|
||||
password: 'changeme',
|
||||
scheme: conf[:ssl] ? :https : :http,
|
||||
host: String(conf[:host]),
|
||||
port: Integer(conf[:port]),
|
||||
user: String(conf[:user]),
|
||||
password: String(conf[:password]),
|
||||
|
||||
transport_options: {
|
||||
request: { timeout: 5 },
|
||||
ssl: { ca_file: nil },
|
||||
ssl: { ca_file: conf.dig(:ssl_params, :ca_file) },
|
||||
},
|
||||
)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
default: &default
|
||||
host: <%= ENV.fetch('ELASTICSEARCH_HOST') { 'localhost' } %>
|
||||
port: <%= ENV.fetch('ELASTICSEARCH_PORT') { 9200 } %>
|
||||
user: <%= ENV.fetch('ELASTICSEARCH_USER') { 'elastic' } %>
|
||||
password: <%= ENV.fetch('ELASTICSEARCH_PASSWORD') { 'changeme' } %>
|
||||
ssl: false
|
||||
ssl_params:
|
||||
ca_file: null
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
||||
staging:
|
||||
<<: *default
|
||||
|
||||
production:
|
||||
<<: *default
|
Reference in New Issue