From 6fcf514cd0ae7e8ab2a364c9f06503243b6ceb37 Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Mon, 17 Sep 2018 12:18:22 +0100
Subject: [PATCH] Updated clmc service docs to include info for the nginx proxy

---
 docs/clmc-service.md            | 23 +++++++++++++++++++++++
 scripts/clmc-service/nginx.conf |  5 ++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/docs/clmc-service.md b/docs/clmc-service.md
index e1b21a4..f39c92d 100644
--- a/docs/clmc-service.md
+++ b/docs/clmc-service.md
@@ -36,6 +36,29 @@ It offers different API endpoints such as GraphAPI for calculating round trip ti
 configuration data and Alerts API for creating and subscribing to alerts in Kapacitor. All source code, tests and 
 configuration files of the service can be found in the **src/service** folder.
 
+#### Notes
+* Interacting with *Chronograf* - use ***http://<clmc-host>/chronograf***. You will be asked to enter connection details.
+The only input that you need to edit is the *Connection String* - set it to **http://<clmc-host>:8086** and click the
+**Add Source** button.
+
+* Interacting with *Kapacitor* - the Kapacitor HTTP API documentation can be found here: https://docs.influxdata.com/kapacitor/v1.4/working/api/
+Notice that all of the URL paths provided by Kapacitor are already namespaced using base path ***/kapacitor/v1***. Therefore, no other prefix is required
+when interacting with the Kapacitor application running on the clmc container, e.g.  
+***http://<clmc-host>/kapacitor/v1/tasks***  
+as described in the Kapacitor API reference.
+
+* Interacting with *InfluxDB* - the InfluxDB HTTP API documentation can be found here: https://docs.influxdata.com/influxdb/v1.5/tools/api/
+In order to interact with the InfluxDB application running on the clmc container, prefix all URL paths in the documentation 
+with **/influxdb**, e.g.  
+***http://<clmc-host>/influxdb/query***
+
+* Interacting with *neo4j* - use ***http://localhost/neo4j/browser/***. This will open the neo4j browser, which lets you
+interact with the graph using Cypher queries (if necessary).
+
+* Interacting with *clmc-serivce* - the API endpoints listed in the following sections relate to direct interactions with the clmc-service 
+application server (listening on port 9080). If interacting with the clmc container, all of the listed below URIs must be prefixed 
+with **/clmc-service** so that the nginx reverse proxy server (listening on port 80) can forward to requests to the correct application, e.g.  
+***http://<clmc-host>/clmc-service/alerts?sfc={service function chain id}&sfci={service function chain instance id}&policy={policy id}&trigger={trigger id}***.
 
 ## Alerts API Endpoints
 
diff --git a/scripts/clmc-service/nginx.conf b/scripts/clmc-service/nginx.conf
index 3cb407f..813ac0c 100644
--- a/scripts/clmc-service/nginx.conf
+++ b/scripts/clmc-service/nginx.conf
@@ -56,12 +56,15 @@ http {
             proxy_set_header X-Forwarded-Host $server_name;
         }
         location /chronograf {
-            proxy_pass http://127.0.0.1:8888; # No trailing slash - chronograf is configured to include /chronograf in its routes
+            proxy_pass http://127.0.0.1:8888; # No trailing slash - chronograf is configured to include '/chronograf' prefix in its routes
             proxy_redirect off;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X-Forwarded-Host $server_name;
         }
+        location / {
+            return 404;  # return 404 error for every other URL path - this also overrides the nginx default welcome page
+        }
     }
 }
\ No newline at end of file
-- 
GitLab