mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
Merge pull request #43 from CodeforLeipzig/update-elasticsearch
Update elasticsearch
This commit is contained in:
commit
4f455c0584
8 changed files with 130 additions and 84 deletions
17
Dockerfile
17
Dockerfile
|
@ -1,8 +1,19 @@
|
||||||
FROM ruby:2.5.7
|
FROM ruby:2.5.7
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - && apt-get update && \
|
RUN gem install bundler
|
||||||
|
|
||||||
|
# Add google package repository for google chrome
|
||||||
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
||||||
|
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs npm \
|
apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs npm \
|
||||||
libxml2-dev libxslt1-dev pkg-config \
|
libxml2-dev libxslt1-dev pkg-config google-chrome-stable
|
||||||
libqtwebkit4 libqtwebkit-dev libqt4-dev xvfb
|
|
||||||
|
|
||||||
|
ENV DOCKERIZE_VERSION v0.6.1
|
||||||
|
RUN curl -sSLO https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||||
|
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
||||||
|
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||||
|
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
|
|
||||||
|
|
6
Gemfile
6
Gemfile
|
@ -31,8 +31,8 @@ gem 'omniauth'
|
||||||
gem 'omniauth-browserid'
|
gem 'omniauth-browserid'
|
||||||
|
|
||||||
gem 'elasticsearch', '~> 6'
|
gem 'elasticsearch', '~> 6'
|
||||||
gem 'elasticsearch-model'
|
gem 'elasticsearch-model', '~> 6'
|
||||||
gem 'elasticsearch-rails'
|
gem 'elasticsearch-rails', '~> 6'
|
||||||
gem 'elasticsearch-dsl'
|
gem 'elasticsearch-dsl'
|
||||||
|
|
||||||
gem 'leaflet-rails'
|
gem 'leaflet-rails'
|
||||||
|
@ -68,7 +68,7 @@ group :test do
|
||||||
gem 'simplecov', require: false
|
gem 'simplecov', require: false
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
gem 'coveralls', require: false
|
gem 'coveralls', require: false
|
||||||
gem 'capybara-webkit'
|
gem 'apparition'
|
||||||
gem 'rails-controller-testing'
|
gem 'rails-controller-testing'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
45
Gemfile.lock
45
Gemfile.lock
|
@ -38,21 +38,22 @@ GEM
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
addressable (2.5.2)
|
addressable (2.7.0)
|
||||||
public_suffix (>= 2.0.2, < 4.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
|
apparition (0.4.0)
|
||||||
|
capybara (~> 3.13, < 4)
|
||||||
|
websocket-driver (>= 0.6.5)
|
||||||
arel (8.0.0)
|
arel (8.0.0)
|
||||||
awesome_print (1.8.0)
|
awesome_print (1.8.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
capybara (3.0.2)
|
capybara (3.30.0)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
rack (>= 1.6.0)
|
rack (>= 1.6.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
xpath (~> 3.0)
|
regexp_parser (~> 1.5)
|
||||||
capybara-webkit (1.15.0)
|
xpath (~> 3.2)
|
||||||
capybara (>= 2.3, < 4.0)
|
|
||||||
json
|
|
||||||
coderay (1.1.2)
|
coderay (1.1.2)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
|
@ -78,11 +79,11 @@ GEM
|
||||||
elasticsearch-api (6.0.2)
|
elasticsearch-api (6.0.2)
|
||||||
multi_json
|
multi_json
|
||||||
elasticsearch-dsl (0.1.5)
|
elasticsearch-dsl (0.1.5)
|
||||||
elasticsearch-model (5.0.0)
|
elasticsearch-model (6.1.0)
|
||||||
activesupport (> 3)
|
activesupport (> 3)
|
||||||
elasticsearch (> 1)
|
elasticsearch (> 1)
|
||||||
hashie
|
hashie
|
||||||
elasticsearch-rails (5.0.2)
|
elasticsearch-rails (6.1.0)
|
||||||
elasticsearch-transport (6.0.2)
|
elasticsearch-transport (6.0.2)
|
||||||
faraday
|
faraday
|
||||||
multi_json
|
multi_json
|
||||||
|
@ -138,14 +139,14 @@ GEM
|
||||||
mime-types (3.1)
|
mime-types (3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
mini_mime (1.0.0)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.3.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
multi_json (1.13.1)
|
multi_json (1.13.1)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
nio4r (2.3.0)
|
nio4r (2.3.0)
|
||||||
nokogiri (1.8.2)
|
nokogiri (1.10.7)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
omniauth (1.8.1)
|
omniauth (1.8.1)
|
||||||
hashie (>= 3.4.6, < 3.6.0)
|
hashie (>= 3.4.6, < 3.6.0)
|
||||||
rack (>= 1.6.2, < 3)
|
rack (>= 1.6.2, < 3)
|
||||||
|
@ -158,10 +159,10 @@ GEM
|
||||||
method_source (~> 0.9.0)
|
method_source (~> 0.9.0)
|
||||||
pry-rails (0.3.6)
|
pry-rails (0.3.6)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
public_suffix (3.0.2)
|
public_suffix (4.0.3)
|
||||||
puma (3.11.4)
|
puma (3.11.4)
|
||||||
rack (2.0.4)
|
rack (2.1.1)
|
||||||
rack-test (1.0.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (5.1.6)
|
rails (5.1.6)
|
||||||
actioncable (= 5.1.6)
|
actioncable (= 5.1.6)
|
||||||
|
@ -195,6 +196,7 @@ GEM
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rake (12.3.1)
|
rake (12.3.1)
|
||||||
rdoc (4.3.0)
|
rdoc (4.3.0)
|
||||||
|
regexp_parser (1.6.0)
|
||||||
rest-client (1.6.7)
|
rest-client (1.6.7)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
rspec-core (3.7.1)
|
rspec-core (3.7.1)
|
||||||
|
@ -270,23 +272,23 @@ GEM
|
||||||
websocket-driver (0.6.5)
|
websocket-driver (0.6.5)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.3)
|
websocket-extensions (0.1.3)
|
||||||
xpath (3.0.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
apparition
|
||||||
awesome_print
|
awesome_print
|
||||||
capybara
|
capybara
|
||||||
capybara-webkit
|
|
||||||
coffee-rails
|
coffee-rails
|
||||||
coveralls
|
coveralls
|
||||||
database_cleaner
|
database_cleaner
|
||||||
elasticsearch (~> 6)
|
elasticsearch (~> 6)
|
||||||
elasticsearch-dsl
|
elasticsearch-dsl
|
||||||
elasticsearch-model
|
elasticsearch-model (~> 6)
|
||||||
elasticsearch-rails
|
elasticsearch-rails (~> 6)
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
faker
|
faker
|
||||||
foundation-rails (~> 5.5)
|
foundation-rails (~> 5.5)
|
||||||
|
@ -316,3 +318,6 @@ DEPENDENCIES
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
uglifier
|
uglifier
|
||||||
validate_url
|
validate_url
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.1.4
|
||||||
|
|
|
@ -21,43 +21,47 @@ class Paper < ActiveRecord::Base
|
||||||
|
|
||||||
index_name ['srm', Rails.env, self.base_class.to_s.pluralize.underscore].join('_')
|
index_name ['srm', Rails.env, self.base_class.to_s.pluralize.underscore].join('_')
|
||||||
|
|
||||||
settings index: {
|
settings index: {
|
||||||
number_of_shards: 1,
|
number_of_shards: 1,
|
||||||
analysis: {
|
analysis: {
|
||||||
filter: {
|
filter: {
|
||||||
german_stop: {
|
german_stop: {
|
||||||
type: "stop",
|
type: "stop",
|
||||||
stopwords: "_german_"
|
stopwords: "_german_"
|
||||||
},
|
},
|
||||||
german_stemmer: {
|
german_stemmer: {
|
||||||
type: "stemmer",
|
type: "stemmer",
|
||||||
language: "light_german"
|
language: "light_german"
|
||||||
},
|
},
|
||||||
decomp: {
|
german_decompounder: {
|
||||||
type: "decompound"
|
type: "hyphenation_decompounder",
|
||||||
}
|
word_list_path: "analysis/dictionary-de.txt",
|
||||||
},
|
hyphenation_patterns_path: "analysis/de_DR.xml",
|
||||||
analyzer: {
|
only_longest_match: true,
|
||||||
german: {
|
min_subword_size: 4
|
||||||
tokenizer: "standard",
|
},
|
||||||
filter: [
|
},
|
||||||
"lowercase",
|
analyzer: {
|
||||||
"german_stop",
|
german: {
|
||||||
"german_normalization",
|
tokenizer: "standard",
|
||||||
"german_stemmer",
|
filter: [
|
||||||
"decomp"
|
"lowercase",
|
||||||
]
|
"german_stop",
|
||||||
}
|
"german_decompounder",
|
||||||
|
"german_normalization",
|
||||||
|
"german_stemmer"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} do mappings dynamic: false do
|
} do mappings dynamic: false do
|
||||||
indexes :name, type: :string, analyzer: "german"
|
indexes :name, type: :text, analyzer: "german"
|
||||||
indexes :content, type: :string, analyzer: "german"
|
indexes :content, type: :text, analyzer: "german"
|
||||||
indexes :resolution, type: :string, analyzer: "german"
|
indexes :resolution, type: :text, analyzer: "german"
|
||||||
indexes :reference, type: :string, index: :not_analyzed
|
indexes :reference, type: :keyword, index: true
|
||||||
indexes :paper_type, type: :string, index: :not_analyzed
|
indexes :paper_type, type: :keyword, index: true
|
||||||
indexes :published_at, type: :date, index: :not_analyzed
|
indexes :published_at, type: :date, index: true
|
||||||
indexes :originator, type: :string, index: :not_analyzed
|
indexes :originator, type: :keyword, index: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
xvfb-run bundle exec rspec
|
dockerize -wait $ELASTICSEARCH_URL -timeout 30s bundle exec rspec
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
web:
|
version: "3.7"
|
||||||
build: .
|
volumes:
|
||||||
volumes:
|
elasticsearch:
|
||||||
- .:/app
|
services:
|
||||||
ports:
|
web:
|
||||||
- "3000:3000"
|
build: .
|
||||||
links:
|
volumes:
|
||||||
- elasticsearch
|
- .:/app
|
||||||
environment:
|
ports:
|
||||||
ELASTICSEARCH_URL: 'http://elasticsearch:9200'
|
- "3000:3000"
|
||||||
elasticsearch:
|
links:
|
||||||
image: elasticsearch:5.4.3
|
- elasticsearch
|
||||||
command:
|
environment:
|
||||||
- sh
|
ELASTICSEARCH_URL: 'http://elasticsearch:9200'
|
||||||
- -c
|
elasticsearch:
|
||||||
- "./bin/elasticsearch-plugin install http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-analysis-decompound/5.4.3.0/elasticsearch-analysis-decompound-5.4.3.0-plugin.zip;
|
build: ./docker/elasticsearch
|
||||||
./bin/elasticsearch-plugin install https://github.com/royrusso/elasticsearch-HQ/zipball/master;
|
environment:
|
||||||
/docker-entrypoint.sh elasticsearch"
|
- discovery.type=single-node
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/apps
|
- elasticsearch:/usr/share/elasticsearch/data
|
||||||
|
elastichq:
|
||||||
|
image: elastichq/elasticsearch-hq
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
links:
|
||||||
|
- elasticsearch
|
||||||
|
|
8
docker/elasticsearch/Dockerfile
Normal file
8
docker/elasticsearch/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
FROM elasticsearch:6.8.6
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
mkdir -p /usr/share/elasticsearch/config/analysis && \
|
||||||
|
pushd /usr/share/elasticsearch/config/analysis && \
|
||||||
|
curl -sSLO https://github.com/uschindler/german-decompounder/raw/master/de_DR.xml && \
|
||||||
|
curl -sSLO https://github.com/uschindler/german-decompounder/raw/master/dictionary-de.txt && \
|
||||||
|
popd
|
|
@ -1 +1,13 @@
|
||||||
Capybara.javascript_driver = :webkit
|
require 'capybara/apparition'
|
||||||
|
Capybara.register_driver :apparition do |app|
|
||||||
|
Capybara::Apparition::Driver.new(
|
||||||
|
app,
|
||||||
|
headless: true,
|
||||||
|
browser_options: [ :no_sandbox, disable_features: 'VizDisplayCompositor']
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
Capybara.javascript_driver = :apparition
|
||||||
|
|
||||||
|
# https://github.com/teamcapybara/capybara#setup
|
||||||
|
Capybara.server = :puma, { Silent: true }
|
||||||
|
|
Loading…
Reference in a new issue