Commit e4263545 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added additional configuration.

parent cc88ac9b
Pipeline #40899 passed with stages
in 14 minutes and 17 seconds
...@@ -82,7 +82,7 @@ fs = FSConfig( ...@@ -82,7 +82,7 @@ fs = FSConfig(
elastic = ElasticConfig( elastic = ElasticConfig(
host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'), host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'),
port=int(os.environ.get('NOMAD_ELASTIC_PORT', 9200)), port=int(os.environ.get('NOMAD_ELASTIC_PORT', 9200)),
index_name=os.environ.get('NOMAD_ELASTIC_INDEX_NAME', 'nomad-fair') index_name=os.environ.get('NOMAD_ELASTIC_INDEX_NAME', 'calcs')
) )
repository_db = RepositoryDBConfig( repository_db = RepositoryDBConfig(
host=os.environ.get('NOMAD_COE_REPO_DB_HOST', 'localhost'), host=os.environ.get('NOMAD_COE_REPO_DB_HOST', 'localhost'),
...@@ -94,7 +94,7 @@ repository_db = RepositoryDBConfig( ...@@ -94,7 +94,7 @@ repository_db = RepositoryDBConfig(
mongo = MongoConfig( mongo = MongoConfig(
host=os.environ.get('NOMAD_MONGO_HOST', 'localhost'), host=os.environ.get('NOMAD_MONGO_HOST', 'localhost'),
port=int(os.environ.get('NOMAD_MONGO_PORT', 27017)), port=int(os.environ.get('NOMAD_MONGO_PORT', 27017)),
db_name=os.environ.get('NOMAD_MONGO_DN_NAME', 'nomad-fair') db_name=os.environ.get('NOMAD_MONGO_DN_NAME', 'users')
) )
logstash = LogstashConfig( logstash = LogstashConfig(
enabled=True, enabled=True,
......
...@@ -79,7 +79,7 @@ def setup_elastic(): ...@@ -79,7 +79,7 @@ def setup_elastic():
""" Creates connection to elastic search. """ """ Creates connection to elastic search. """
global elastic_client global elastic_client
elastic_client = connections.create_connection( elastic_client = connections.create_connection(
hosts=[config.elastic.host], port=[config.elastic.port]) hosts=['%s:%d' % (config.elastic.host, config.elastic.port)])
logger.info('setup elastic connection') logger.info('setup elastic connection')
try: try:
...@@ -130,10 +130,10 @@ def setup_repository_db(): ...@@ -130,10 +130,10 @@ def setup_repository_db():
def reset(): def reset():
""" Resets the databases mongo, elastic/calcs, and repository db. Be careful. """ """ Resets the databases mongo, elastic/calcs, and repository db. Be careful. """
logger.info('reset mongodb') logger.info('reset mongodb')
mongo_client.drop_database(config.mongo.users_db) mongo_client.drop_database(config.mongo.db_name)
logger.info('reset elastic search') logger.info('reset elastic search')
elastic_client.indices.delete(index=config.elastic.calc_index) elastic_client.indices.delete(index=config.elastic.index_name)
from nomad.repo import RepoCalc from nomad.repo import RepoCalc
RepoCalc.init() RepoCalc.init()
......
...@@ -202,13 +202,13 @@ class RepoCalc(ElasticDocument): ...@@ -202,13 +202,13 @@ class RepoCalc(ElasticDocument):
@staticmethod @staticmethod
def es_search(body): def es_search(body):
""" Perform an elasticsearch and not elasticsearch_dsl search on the Calc index. """ """ Perform an elasticsearch and not elasticsearch_dsl search on the Calc index. """
return infrastructure.elastic_client.search(index=config.elastic.calc_index, body=body) return infrastructure.elastic_client.search(index=config.elastic.index_name, body=body)
@staticmethod @staticmethod
def upload_exists(upload_hash): def upload_exists(upload_hash):
""" Returns true if there are already calcs from the given upload. """ """ Returns true if there are already calcs from the given upload. """
# TODO this is deprecated and should be varified via repository files # TODO this is deprecated and should be varified via repository files
search = Search(using=infrastructure.elastic_client, index=config.elastic.calc_index) \ search = Search(using=infrastructure.elastic_client, index=config.elastic.index_name) \
.query('match', upload_hash=upload_hash) \ .query('match', upload_hash=upload_hash) \
.execute() .execute()
...@@ -217,7 +217,7 @@ class RepoCalc(ElasticDocument): ...@@ -217,7 +217,7 @@ class RepoCalc(ElasticDocument):
@staticmethod @staticmethod
def upload_calcs(upload_id): def upload_calcs(upload_id):
""" Returns an iterable over all entries for the given upload_id. """ """ Returns an iterable over all entries for the given upload_id. """
return Search(using=infrastructure.elastic_client, index=config.elastic.calc_index) \ return Search(using=infrastructure.elastic_client, index=config.elastic.index_name) \
.query('match', upload_id=upload_id) \ .query('match', upload_id=upload_id) \
.scan() .scan()
......
...@@ -48,18 +48,18 @@ rabbitmq: ...@@ -48,18 +48,18 @@ rabbitmq:
mongo: mongo:
host: enc-preprocessing-nomad.esc host: enc-preprocessing-nomad.esc
port: 27017 port: 37017
elastic: elastic:
host: enc-preprocessing-nomad.esc host: enc-preprocessing-nomad.esc
port: 9200 port: 19200
postgres: postgres:
host: enc-preprocessing-nomad.esc host: enc-preprocessing-nomad.esc
port: 5432 port: 5432
logstash: logstash:
port: 5000 port: 15000
host: enc-preprocessing-nomad.esc host: enc-preprocessing-nomad.esc
## Everything concerning the data that is used by the service ## Everything concerning the data that is used by the service
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment