From e4263545a2620b8b9148248d5872b4977eabd7bb Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Thu, 13 Dec 2018 14:51:00 +0100
Subject: [PATCH] Added additional configuration.

---
 nomad/config.py            | 4 ++--
 nomad/infrastructure.py    | 6 +++---
 nomad/repo.py              | 6 +++---
 ops/helm/nomad/values.yaml | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/nomad/config.py b/nomad/config.py
index 2b871c1044..05a9ff7273 100644
--- a/nomad/config.py
+++ b/nomad/config.py
@@ -82,7 +82,7 @@ fs = FSConfig(
 elastic = ElasticConfig(
     host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'),
     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(
     host=os.environ.get('NOMAD_COE_REPO_DB_HOST', 'localhost'),
@@ -94,7 +94,7 @@ repository_db = RepositoryDBConfig(
 mongo = MongoConfig(
     host=os.environ.get('NOMAD_MONGO_HOST', 'localhost'),
     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(
     enabled=True,
diff --git a/nomad/infrastructure.py b/nomad/infrastructure.py
index a91c3a4375..c4ad7b849d 100644
--- a/nomad/infrastructure.py
+++ b/nomad/infrastructure.py
@@ -79,7 +79,7 @@ def setup_elastic():
     """ Creates connection to elastic search. """
     global elastic_client
     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')
 
     try:
@@ -130,10 +130,10 @@ def setup_repository_db():
 def reset():
     """ Resets the databases mongo, elastic/calcs, and repository db. Be careful. """
     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')
-    elastic_client.indices.delete(index=config.elastic.calc_index)
+    elastic_client.indices.delete(index=config.elastic.index_name)
     from nomad.repo import RepoCalc
     RepoCalc.init()
 
diff --git a/nomad/repo.py b/nomad/repo.py
index 7d88e9455c..50737e7912 100644
--- a/nomad/repo.py
+++ b/nomad/repo.py
@@ -202,13 +202,13 @@ class RepoCalc(ElasticDocument):
     @staticmethod
     def es_search(body):
         """ 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
     def upload_exists(upload_hash):
         """ Returns true if there are already calcs from the given upload. """
         # 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) \
             .execute()
 
@@ -217,7 +217,7 @@ class RepoCalc(ElasticDocument):
     @staticmethod
     def upload_calcs(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) \
             .scan()
 
diff --git a/ops/helm/nomad/values.yaml b/ops/helm/nomad/values.yaml
index 9da020d7f9..04af83ea77 100644
--- a/ops/helm/nomad/values.yaml
+++ b/ops/helm/nomad/values.yaml
@@ -48,18 +48,18 @@ rabbitmq:
 
 mongo:
   host: enc-preprocessing-nomad.esc
-  port: 27017
+  port: 37017
 
 elastic:
   host: enc-preprocessing-nomad.esc
-  port: 9200
+  port: 19200
 
 postgres:
   host: enc-preprocessing-nomad.esc
   port: 5432
 
 logstash:
-  port: 5000
+  port: 15000
   host: enc-preprocessing-nomad.esc
 
 ## Everything concerning the data that is used by the service
-- 
GitLab