Skip to content

Commit

Permalink
Add django-elasticsearch-metrics and temporary ES6 container
Browse files Browse the repository at this point in the history
Support both ES2 and ES6
  • Loading branch information
sloria committed Oct 18, 2018
1 parent cebb58f commit 9682181
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .docker-compose.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DOMAIN=http://localhost:5000/
INTERNAL_DOMAIN=http://192.168.168.167:5000/
API_DOMAIN=http://localhost:8000/
ELASTIC_URI=192.168.168.167:9200
ELASTICSEARCH_HOST=192.168.168.167:9201
OSF_DB_HOST=192.168.168.167
DB_HOST=192.168.168.167
WATERBUTLER_URL=http://localhost:7777
Expand Down
6 changes: 6 additions & 0 deletions api/base/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
'guardian',
'storages',
'waffle',
'elasticsearch_metrics',

# OSF
'osf',
Expand Down Expand Up @@ -290,3 +291,8 @@

# salt used for generating hashids
HASHIDS_SALT = 'pinkhimalayan'

# django-elasticsearch-metrics
ELASTICSEARCH_DSL = {
'default': {'hosts': os.environ.get('ELASTICSEARCH_HOST', 'localhost:9201')}
}
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ volumes:
external: false
elasticsearch_data_vol:
external: false
elasticsearch6_data_vol:
external: false
rabbitmq_vol:
external: false
ember_osf_web_dist_vol:
Expand Down Expand Up @@ -56,6 +58,15 @@ services:
- elasticsearch_data_vol:/usr/share/elasticsearch/data
stdin_open: true

# Temporary: Remove when we've upgraded to ES6
elasticsearch6:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
ports:
- 9201:9200
volumes:
- elasticsearch6_data_vol:/usr/share/elasticsearch/data
stdin_open: true

postgres:
image: postgres:9.6
command:
Expand Down
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ bleach==2.1.3
html5lib==0.999999999
blinker==1.4
furl==0.4.92
elasticsearch==2.4.0 # pyup: >=2.4,<3.0 # Major version must be same as ES version
elasticsearch==6.3.1
elasticsearch2==2.5.0 # pyup: >=2.4,<3.0 # Major version must be same as ES version
google-api-python-client==1.6.4
Babel==2.5.1
citeproc-py==0.4.0
Expand Down Expand Up @@ -106,3 +107,6 @@ enum34==1.1.6

# identifiers
datacite==1.0.1

# Metrics
django-elasticsearch-metrics==3.2.0
2 changes: 1 addition & 1 deletion website/search/elastic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.core.paginator import Paginator
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from elasticsearch import (ConnectionError, Elasticsearch, NotFoundError,
from elasticsearch2 import (ConnectionError, Elasticsearch, NotFoundError,
RequestError, TransportError, helpers)
from framework.celery_tasks import app as celery_app
from framework.database import paginated
Expand Down
2 changes: 1 addition & 1 deletion website/search_migration/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging

from django.db import connection
from elasticsearch import helpers
from elasticsearch2 import helpers

import website.search.search as search
from website.search.elastic_search import client
Expand Down

0 comments on commit 9682181

Please sign in to comment.