From 41b578a2b3d27e819e2d6e1ab9fd6e894918d5f2 Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Tue, 18 Sep 2018 17:07:28 +0200
Subject: [PATCH] Renamed everything from nomadxt to nomad.

---
 backend.Dockerfile                        |  2 +-
 docs/setup.md                             |  8 ++--
 frontend.Dockerfile                       |  2 +-
 gui/.env.development                      |  4 +-
 gui/.env.production                       |  8 ++--
 gui/package.json                          |  2 +-
 gui/src/components/Development.js         |  2 +-
 infrastructure/elk/README.md              |  4 +-
 infrastructure/elk/kibana.yml             |  2 +-
 infrastructure/elk/run_elk.sh             |  4 +-
 infrastructure/nomadxt/.env_processing    |  2 +-
 infrastructure/nomadxt/docker-compose.yml | 50 +++++++++++------------
 infrastructure/nomadxt/gui.conf           |  4 +-
 infrastructure/nomadxt/nginx.conf         |  8 ++--
 infrastructure/utils.http                 |  4 +-
 nomad/api.py                              | 16 ++++----
 nomad/client.py                           |  2 +-
 nomad/config.py                           |  2 +-
 tests/misc.http                           |  4 +-
 19 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/backend.Dockerfile b/backend.Dockerfile
index 67f310d0f9..cb9e5445c3 100644
--- a/backend.Dockerfile
+++ b/backend.Dockerfile
@@ -20,7 +20,7 @@
 # The dockerfile is multistages to getaway with building on a larger base image.
 
 # using the base image with most requirements already installed
-FROM nomadxt_requirements:latest as requirements
+FROM nomad_requirements:latest as requirements
 # we use slim for the final image
 FROM python:3.6-slim as final
 
diff --git a/docs/setup.md b/docs/setup.md
index abd8d00ece..f16ed43da0 100644
--- a/docs/setup.md
+++ b/docs/setup.md
@@ -109,9 +109,9 @@ reinstall them all the time, we need to build new images.
 
 The fontend image is only for building and serving the gui.
 
-Build the requirements image tagged `nomadxt_requirements`:
+Build the requirements image tagged `nomad_requirements`:
 ```
-docker build -t nomadxt_requirements -f requirements.Dockerfile .
+docker build -t nomad_requirements -f requirements.Dockerfile .
 ```
 
 The other images are build via *docker-compose* and don't have to be created manually.
@@ -121,7 +121,7 @@ The other images are build via *docker-compose* and don't have to be created man
 Now we can build the *docker-compose* that contains all external services (rabbitmq,
 mongo, elastic, minio, elk) and nomad services (worker, handler, api, gui).
 ```
-cd ./infrastructure/nomadxt
+cd ./infrastructure/nomad
 docker-compose build
 ```
 
@@ -167,7 +167,7 @@ docker-compose up api gui proxy
 Usually these services only used by the nomad containers, but sometimes you also
 need to checkseomthing or do some manual steps.
 
-The file `infrastructure/nomadxt/.env` contains variables that control the ports
+The file `infrastructure/nomad/.env` contains variables that control the ports
 used to bind internal docker ports to your host machine. These are the ports you
 have to use to connect to the respective services.
 
diff --git a/frontend.Dockerfile b/frontend.Dockerfile
index 32c259b0e0..396189c5db 100644
--- a/frontend.Dockerfile
+++ b/frontend.Dockerfile
@@ -13,5 +13,5 @@ RUN yarn build
 
 # production environment
 FROM nginx:1.13.9-alpine
-COPY --from=builder /nomad/app/build /app/nomadxt
+COPY --from=builder /nomad/app/build /app/nomad
 CMD ["nginx", "-g", "daemon off;"]
diff --git a/gui/.env.development b/gui/.env.development
index 6b6fea039f..f636c30c63 100644
--- a/gui/.env.development
+++ b/gui/.env.development
@@ -1,5 +1,5 @@
-REACT_APP_API_BASE = 'http://localhost:8000/nomadxt/api'
+REACT_APP_API_BASE = 'http://localhost:8000/nomad/api'
 REACT_APP_OBJECT_BASE = 'http://localhost:9007'
-REACT_APP_APP_BASE = '/nomadxt'
+REACT_APP_APP_BASE = '/nomad'
 REACT_APP_APP_STATIC_BASE = ''
 REACT_APP_DEBUG = 'true'
\ No newline at end of file
diff --git a/gui/.env.production b/gui/.env.production
index ae3eb4a179..7755d9dcad 100644
--- a/gui/.env.production
+++ b/gui/.env.production
@@ -1,5 +1,5 @@
-REACT_APP_API_BASE = '/nomadxt/api'
-REACT_APP_OBJECT_BASE = '/nomadxt/objects'
-REACT_APP_APP_BASE = '/nomadxt'
-REACT_APP_APP_STATIC_BASE = '/nomadxt'
+REACT_APP_API_BASE = '/nomad/api'
+REACT_APP_OBJECT_BASE = '/nomad/objects'
+REACT_APP_APP_BASE = '/nomad'
+REACT_APP_APP_STATIC_BASE = '/nomad'
 REACT_APP_DEBUG = 'true'
\ No newline at end of file
diff --git a/gui/package.json b/gui/package.json
index a2e8de99d6..8ce96ad07c 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -40,5 +40,5 @@
     "eslint-plugin-standard": "^3.1.0",
     "serve": "^10.0.0"
   },
-  "homepage": "http://mywebsite.com/nomadxt"
+  "homepage": "http://mywebsite.com/nomad"
 }
diff --git a/gui/src/components/Development.js b/gui/src/components/Development.js
index 6b4bfe71d4..f1fadf5c3e 100644
--- a/gui/src/components/Development.js
+++ b/gui/src/components/Development.js
@@ -30,7 +30,7 @@ class Development extends React.Component {
           This system pushes logs, events, monitoring data,
           and other application metrics to a central database where it
           can be analysed visually.
-          \n\n[Link to Kiaba](/nomadxt/kibana/)
+          \n\n[Link to Kiaba](/nomad/kibana/)
         `}</Markdown>
       </div>
     )
diff --git a/infrastructure/elk/README.md b/infrastructure/elk/README.md
index 5522c98425..5ff052bf2d 100644
--- a/infrastructure/elk/README.md
+++ b/infrastructure/elk/README.md
@@ -8,7 +8,7 @@ This image is based on the populer elk-stack docker image:
 - disabled ssl for beats communication to logstash server
 - added tcp input
 - simplified elastic search output (don't now how to set metric and other vars yet :-()
-- added kibana.yml::server.basePath="/nomadxt/kibana"
+- added kibana.yml::server.basePath="/nomad/kibana"
 
 
 ## Usage
@@ -17,7 +17,7 @@ You can run this image outside the usual docker-compose.
 To use this image with reverse proxy in nginx, use:
 
 ```
-location ~ ^/nomadxt/kibana/(.*)$ {
+location ~ ^/nomad/kibana/(.*)$ {
     proxy_pass http://130.183.207.116:15601/$1;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
diff --git a/infrastructure/elk/kibana.yml b/infrastructure/elk/kibana.yml
index bfc60a0af6..957b569219 100644
--- a/infrastructure/elk/kibana.yml
+++ b/infrastructure/elk/kibana.yml
@@ -11,7 +11,7 @@ server.host: "0.0.0.0"
 # Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
 # the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
 # to Kibana. This setting cannot end in a slash.
-server.basePath: "/nomadxt/kibana"
+server.basePath: "/nomad/kibana"
 
 # The maximum payload size in bytes for incoming server requests.
 #server.maxPayloadBytes: 1048576
diff --git a/infrastructure/elk/run_elk.sh b/infrastructure/elk/run_elk.sh
index 56ca95e54a..6484dbb165 100644
--- a/infrastructure/elk/run_elk.sh
+++ b/infrastructure/elk/run_elk.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
-docker build -t nomadxt_elk .
-docker run -v nomadxt_elk:/var/lib/elasticsearch -p 15601:5601 -p 15000:5000 -p 15044:5044 --restart=always nomadxt_elk
\ No newline at end of file
+docker build -t nomad_elk .
+docker run -v nomad_elk:/var/lib/elasticsearch -p 15601:5601 -p 15000:5000 -p 15044:5044 --restart=always nomad_elk
\ No newline at end of file
diff --git a/infrastructure/nomadxt/.env_processing b/infrastructure/nomadxt/.env_processing
index c7a9f86ed9..54aba99d3a 100644
--- a/infrastructure/nomadxt/.env_processing
+++ b/infrastructure/nomadxt/.env_processing
@@ -9,6 +9,6 @@ API_HOST_PORT=18000
 GUI_HOST_PORT=18080
 APP_HOST_PORT=0.0.0.0:10080
 
-VOLUME_BINDS=/scratch/nomadxt
+VOLUME_BINDS=/scratch/nomad_FAIR
 EXTERNAL_HOST=enc-staging-nomad.esc.rzg.mpg.de
 EXTERNAL_PORT=80
diff --git a/infrastructure/nomadxt/docker-compose.yml b/infrastructure/nomadxt/docker-compose.yml
index b308ca3384..f2b9d940c8 100644
--- a/infrastructure/nomadxt/docker-compose.yml
+++ b/infrastructure/nomadxt/docker-compose.yml
@@ -20,7 +20,7 @@ services:
         restart: always
         image: minio/minio:RELEASE.2018-06-08T03-49-38Z
         # image: minio/minio
-        container_name: nomadxt_minio
+        container_name: nomad_minio
         ports:
             - ${MINIO_HOST_PORT}:9000
         volumes:
@@ -48,7 +48,7 @@ services:
     rabbitmq:
         restart: always
         image: rabbitmq
-        container_name: nomadxt_rabbitmq
+        container_name: nomad_rabbitmq
         environment:
             - RABBITMQ_ERLANG_COOKIE=SWQOKODSQALRPCLNMEQG
             - RABBITMQ_DEFAULT_USER=rabbitmq
@@ -57,26 +57,26 @@ services:
         ports:
             - ${RABBITMQ_HOST_PORT}:5672
         volumes:
-            - nomadxt_rabbitmq:/var/lib/rabbitmq
+            - nomad_rabbitmq:/var/lib/rabbitmq
 
     # the search engine
     elastic:
         image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
-        container_name: nomadxt_elastic
+        container_name: nomad_elastic
         volumes:
-            - nomadxt_elastic:/usr/share/elasticsearch/data
+            - nomad_elastic:/usr/share/elasticsearch/data
         ports:
             - ${ELASTIC_HOST_PORT}:9200
 
     # the user data db
     mongo:
         image: mongo:latest
-        container_name: nomadxt_mongo
+        container_name: nomad_mongo
         environment:
             - MONGO_DATA_DIR=/data/db
             - MONGO_LOG_DIR=/dev/null
         volumes:
-            - nomadxt_mongo:/data/db
+            - nomad_mongo:/data/db
         ports:
             - ${MONGO_HOST_PORT}:27017
         command: mongod --smallfiles --logpath=/dev/null # --quiet
@@ -85,12 +85,12 @@ services:
     elk:
         restart: always
         build: ../elk/
-        container_name: nomadxt_elk
+        container_name: nomad_elk
         expose:
             - 5000 # logstash beats
             - 5044 # logstash tcp
         volumes:
-            - nomadxt_elk:/var/lib/elasticsearch
+            - nomad_elk:/var/lib/elasticsearch
         ports:
             - ${KIBANA_HOST_PORT}:5601  # kibana web
 
@@ -100,7 +100,7 @@ services:
         build:
             context: ../../
             dockerfile: backend.Dockerfile
-        container_name: nomadxt_worker
+        container_name: nomad_worker
         environment:
             - NOMAD_MINIO_PORT=9000
             - NOMAD_MINIO_HOST=minio
@@ -108,7 +108,7 @@ services:
             - NOMAD_LOGSTASH_HOST=elk
             - NOMAD_ELASTIC_HOST=elastic
             - NOMAD_MONGO_HOST=mongo
-            - NOMAD_SERVICE=nomadxt_worker
+            - NOMAD_SERVICE=nomad_worker
         links:
             - minio
             - rabbitmq
@@ -125,7 +125,7 @@ services:
         build:
             context: ../../
             dockerfile: backend.Dockerfile
-        container_name: nomadxt_handler
+        container_name: nomad_handler
         environment:
             - NOMAD_MINIO_PORT=9000
             - NOMAD_MINIO_HOST=minio
@@ -133,7 +133,7 @@ services:
             - NOMAD_LOGSTASH_HOST=elk
             - NOMAD_MONGO_HOST=mongo
             - NOMAD_ELASTIC_HOST=elastic
-            - NOMAD_SERVICE=nomadxt_handler
+            - NOMAD_SERVICE=nomad_handler
         links:
             - minio
             - rabbitmq
@@ -148,7 +148,7 @@ services:
         build:
             context: ../../
             dockerfile: backend.Dockerfile
-        container_name: nomadxt_api
+        container_name: nomad_api
         environment:
             - NOMAD_MINIO_PORT=9000
             - NOMAD_MINIO_HOST=minio
@@ -156,11 +156,11 @@ services:
             - NOMAD_LOGSTASH_HOST=elk
             - NOMAD_ELASTIC_HOST=elastic
             - NOMAD_MONGO_HOST=mongo
-            - NOMAD_API_BASE_PATH=/nomadxt/api
+            - NOMAD_API_BASE_PATH=/nomad/api
             - NOMAD_OBJECTS_HOST=${EXTERNAL_HOST}
             - NOMAD_OBJECTS_PORT=${EXTERNAL_PORT}
-            - NOMAD_OBJECTS_BASE_PATH=/nomadxt/objects
-            - NOMAD_SERVICE=nomadxt_api
+            - NOMAD_OBJECTS_BASE_PATH=/nomad/objects
+            - NOMAD_SERVICE=nomad_api
         links:
             - minio
             - rabbitmq
@@ -176,7 +176,7 @@ services:
         build:
             context: ../../
             dockerfile: frontend.Dockerfile
-        container_name: nomadxt_gui
+        container_name: nomad_gui
         ports:
             - ${GUI_HOST_PORT}:8080
         volumes:
@@ -187,7 +187,7 @@ services:
     proxy:
         restart: always
         image: nginx:1.13.9-alpine
-        container_name: nomadxt_proxy
+        container_name: nomad_proxy
         links:
             - elk
             - gui
@@ -200,11 +200,11 @@ services:
         command: nginx -g 'daemon off;'
 
 volumes:
-    nomadxt_minio:
-    nomadxt_mongo:
-    nomadxt_elastic:
-    nomadxt_redis:
-    nomadxt_rabbitmq:
-    nomadxt_elk:
+    nomad_minio:
+    nomad_mongo:
+    nomad_elastic:
+    nomad_redis:
+    nomad_rabbitmq:
+    nomad_elk:
 
 
diff --git a/infrastructure/nomadxt/gui.conf b/infrastructure/nomadxt/gui.conf
index 819d453d71..51064407ee 100644
--- a/infrastructure/nomadxt/gui.conf
+++ b/infrastructure/nomadxt/gui.conf
@@ -2,8 +2,8 @@ server {
    listen        8080;
    server_name   www.example.com;
 
-   location /nomadxt  {
+   location /nomad  {
        root      /app/;
-       try_files $uri /nomadxt/index.html;  # fall back to index.html to support routing
+       try_files $uri /nomad/index.html;  # fall back to index.html to support routing
    }
 }
diff --git a/infrastructure/nomadxt/nginx.conf b/infrastructure/nomadxt/nginx.conf
index 86defed4df..edfc38fbc7 100644
--- a/infrastructure/nomadxt/nginx.conf
+++ b/infrastructure/nomadxt/nginx.conf
@@ -2,19 +2,19 @@ server {
    listen        80;
    server_name   www.example.com;
 
-   location /nomadxt  {
+   location /nomad  {
        proxy_pass http://gui:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
 
-   location /nomadxt/api {
+   location /nomad/api {
        proxy_set_header Host $host;
        proxy_pass_request_headers on;
        proxy_pass      http://api:8000;
    }
 
-   location ~ ^/nomadxt/objects/(.*)$ {
+   location ~ ^/nomad/objects/(.*)$ {
        client_max_body_size 20g;
        resolver         127.0.0.11 ipv6=off;  # docker embedded DNS
        proxy_set_header Host $host;
@@ -22,7 +22,7 @@ server {
        proxy_set_header X-Real-IP $remote_addr;
    }
 
-    location ~ ^/nomadxt/kibana/(.*)$ {
+    location ~ ^/nomad/kibana/(.*)$ {
         resolver         127.0.0.11 ipv6=off;  # docker embedded DNS
         proxy_pass http://elk:5601/$1$is_args$args;  # fix: https://github.com/elastic/kibana/issues/13533
         proxy_set_header Host $host;
diff --git a/infrastructure/utils.http b/infrastructure/utils.http
index 1fc1c6a807..09d4db0399 100644
--- a/infrastructure/utils.http
+++ b/infrastructure/utils.http
@@ -43,9 +43,9 @@ content-type: application/json
 }
 
 ###
-POST http://localhost:8000/nomadxt/api/admin/repair_uploads HTTP/1.1
+POST http://localhost:8000/nomad/api/admin/repair_uploads HTTP/1.1
 
 ###
 
-GET http://enc-staging-nomad.esc.rzg.mpg.de//nomadxt/api/uploads HTTP/1.1
+GET http://enc-staging-nomad.esc.rzg.mpg.de//nomad/api/uploads HTTP/1.1
 Authorization: Basic bWVAZ21haWwuY29tOm5vbWFk
diff --git a/nomad/api.py b/nomad/api.py
index e7d96d1d0f..782c0a5a7f 100644
--- a/nomad/api.py
+++ b/nomad/api.py
@@ -87,7 +87,7 @@ class UploadsRes(Resource):
 
         .. sourcecode:: http
 
-            GET /nomadxt/api/uploads HTTP/1.1
+            GET /nomad/api/uploads HTTP/1.1
             Accept: application/json
 
         **Example response**:
@@ -134,7 +134,7 @@ class UploadsRes(Resource):
 
         .. sourcecode:: http
 
-            POST /nomadxt/api/uploads HTTP/1.1
+            POST /nomad/api/uploads HTTP/1.1
             Accept: application/json
             Content-Type: application/json
 
@@ -206,7 +206,7 @@ class UploadRes(Resource):
 
         .. sourcecode:: http
 
-            GET /nomadxt/api/uploads/5b89469e0d80d40008077dbc HTTP/1.1
+            GET /nomad/api/uploads/5b89469e0d80d40008077dbc HTTP/1.1
             Accept: application/json
 
         **Example response**:
@@ -310,7 +310,7 @@ class UploadRes(Resource):
 
         .. sourcecode:: http
 
-            POST /nomadxt/api/uploads HTTP/1.1
+            POST /nomad/api/uploads HTTP/1.1
             Accept: application/json
             Content-Type: application/json
 
@@ -357,7 +357,7 @@ class UploadRes(Resource):
 
         .. sourcecode:: http
 
-            DELETE /nomadxt/api/uploads/5b89469e0d80d40008077dbc HTTP/1.1
+            DELETE /nomad/api/uploads/5b89469e0d80d40008077dbc HTTP/1.1
             Accept: application/json
 
         :param string upload_id: the id for the upload
@@ -396,7 +396,7 @@ class RepoCalcRes(Resource):
 
         .. sourcecode:: http
 
-            GET /nomadxt/api/repo/W36aqCzAKxOCfIiMFsBJh3nHPb4a/7ddvtfRfZAvc3Crr7jOJ8UH0T34I HTTP/1.1
+            GET /nomad/api/repo/W36aqCzAKxOCfIiMFsBJh3nHPb4a/7ddvtfRfZAvc3Crr7jOJ8UH0T34I HTTP/1.1
             Accept: application/json
 
         **Example response**:
@@ -457,7 +457,7 @@ class RepoCalcsRes(Resource):
 
         .. sourcecode:: http
 
-            GET /nomadxt/api/repo?page=1&per_page=25 HTTP/1.1
+            GET /nomad/api/repo?page=1&per_page=25 HTTP/1.1
             Accept: application/json
 
         **Example response**:
@@ -558,7 +558,7 @@ def get_calc(upload_hash, calc_hash):
 
     .. sourcecode:: http
 
-        GET /nomadxt/api/archive/W36aqCzAKxOCfIiMFsBJh3nHPb4a/7ddvtfRfZAvc3Crr7jOJ8UH0T34I HTTP/1.1
+        GET /nomad/api/archive/W36aqCzAKxOCfIiMFsBJh3nHPb4a/7ddvtfRfZAvc3Crr7jOJ8UH0T34I HTTP/1.1
         Accept: application/json
 
     :param string upload_hash: the hash of the upload (from uploaded file contents)
diff --git a/nomad/client.py b/nomad/client.py
index 4888b8701e..9da2182003 100644
--- a/nomad/client.py
+++ b/nomad/client.py
@@ -24,7 +24,7 @@ import sys
 import requests
 from requests.auth import HTTPBasicAuth
 
-api_base = 'http://localhost/nomadxt/api'
+api_base = 'http://localhost/nomad/api'
 
 
 def upload_file(file_path, name=None, user='other@gmail.com', pw='nomad'):
diff --git a/nomad/config.py b/nomad/config.py
index 469c6e9846..ae864cb701 100644
--- a/nomad/config.py
+++ b/nomad/config.py
@@ -91,7 +91,7 @@ logstash = LogstashConfig(
     level=int(os.environ.get('NOMAD_LOGSTASH_LEVEL', logging.DEBUG))
 )
 services = NomadServicesConfig(
-    api_base_path=os.environ.get('NOMAD_API_BASE_PATH', '/nomadxt/api'),
+    api_base_path=os.environ.get('NOMAD_API_BASE_PATH', '/nomad/api'),
     objects_host=os.environ.get('NOMAD_OBJECTS_HOST', 'localhost'),
     objects_port=int(os.environ.get('NOMAD_OBJECTS_PORT', minio.port)),
     objects_base_path=os.environ.get('NOMAD_OBJECTS_BASE_PATH', ''),
diff --git a/tests/misc.http b/tests/misc.http
index e5b29435db..7b4546f45b 100644
--- a/tests/misc.http
+++ b/tests/misc.http
@@ -1,8 +1,8 @@
-GET http://localhost/nomadxt/api/uploads  HTTP/1.1
+GET http://localhost/nomad/api/uploads  HTTP/1.1
 
 ###
 
-POST http://localhost/nomadxt/api/uploads  HTTP/1.1
+POST http://localhost/nomad/api/uploads  HTTP/1.1
 content-type: application/json
 
 {
-- 
GitLab