aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2017-11-03 14:42:18 +0100
committerThomas Duval <thomas.duval@orange.com>2017-11-03 14:42:18 +0100
commit0938caa3ba49fa2b54a42f2123643f37de28f1b3 (patch)
tree34e69af912003d84e450f9cd31bef06e7b4136b2 /moonv4
parentdaaba34fa2ed4426bc0fde359e54a5e1b872208c (diff)
Use Apache as web server and create configuration for host and port
Change-Id: Ibbf50f069d8013900884c17a86b1105fc1eb7ae7
Diffstat (limited to 'moonv4')
-rw-r--r--moonv4/moon_gui/Dockerfile13
-rw-r--r--moonv4/moon_gui/run.sh17
-rw-r--r--moonv4/moon_gui/static/app/moon.constants.js24
3 files changed, 39 insertions, 15 deletions
diff --git a/moonv4/moon_gui/Dockerfile b/moonv4/moon_gui/Dockerfile
index ef809668..428e1037 100644
--- a/moonv4/moon_gui/Dockerfile
+++ b/moonv4/moon_gui/Dockerfile
@@ -1,11 +1,18 @@
FROM ubuntu:latest
-RUN apt update && apt install nodejs nodejs-legacy npm -y
+RUN apt update && apt install git nodejs nodejs-legacy npm apache2 -y
RUN npm install --global gulp-cli
+ENV MANAGER_HOST="127.0.0.1"
+ENV MANAGER_PORT=8080
+ENV KEYSTONE_HOST="127.0.0.1"
+ENV KEYSTONE_PORT=5000
+
ADD . /root
WORKDIR /root/
+
RUN npm install
-RUN gulp delivery
-CMD ["gulp", "webServerDelivery"] \ No newline at end of file
+#CMD ["gulp"]
+#CMD ["gulp", "webServerDelivery"]
+CMD ["sh", "/root/run.sh"] \ No newline at end of file
diff --git a/moonv4/moon_gui/run.sh b/moonv4/moon_gui/run.sh
new file mode 100644
index 00000000..fc3d87a0
--- /dev/null
+++ b/moonv4/moon_gui/run.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+service apache2 start
+
+sed "s/{{MANAGER_HOST}}/$MANAGER_HOST/g" -i /root/static/app/moon.constants.js
+sed "s/{{MANAGER_PORT}}/$MANAGER_PORT/g" -i /root/static/app/moon.constants.js
+sed "s/{{KEYSTONE_HOST}}/$KEYSTONE_HOST/g" -i /root/static/app/moon.constants.js
+sed "s/{{KEYSTONE_PORT}}/$KEYSTONE_PORT/g" -i /root/static/app/moon.constants.js
+
+echo "--------------------------"
+grep varuna /root/static/app/moon.constants.js
+echo "--------------------------"
+
+gulp delivery
+cp -rv /root/delivery/* /var/www/html
+
+tail -f /var/log/apache2/error.log
diff --git a/moonv4/moon_gui/static/app/moon.constants.js b/moonv4/moon_gui/static/app/moon.constants.js
index 872dfd5a..9681e3dc 100644
--- a/moonv4/moon_gui/static/app/moon.constants.js
+++ b/moonv4/moon_gui/static/app/moon.constants.js
@@ -59,21 +59,21 @@
}
})
.constant('REST_URI', {
- PDP : 'http://interface:8081/pdp/',
- MODELS : 'http://interface:8081/models/',
- METARULES: 'http://interface:8081/meta_rules/',
- RULES: 'http://interface:8081/rules/',
- POLICIES: 'http://interface:8081/policies/',
+ PDP : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/pdp/',
+ MODELS : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/models/',
+ METARULES: 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/meta_rules/',
+ RULES: 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/rules/',
+ POLICIES: 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/policies/',
METADATA: {
- subject : 'http://interface:8081/subject_categories/',
- object : 'http://interface:8081/object_categories/',
- action : 'http://interface:8081/action_categories/'
+ subject : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/subject_categories/',
+ object : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/object_categories/',
+ action : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/action_categories/'
},
PERIMETERS :{
- subject : 'http://interface:8081/subjects/',
- object : 'http://interface:8081/objects/',
- action : 'http://interface:8081/actions/'
+ subject : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/subjects/',
+ object : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/objects/',
+ action : 'http://{{MANAGER_HOST}}:{{MANAGER_PORT}}/actions/'
},
- KEYSTONE : 'http://keystone:5000/v3/'
+ KEYSTONE : 'http://{{KEYSTONE_HOST}}:{{KEYSTONE_PORT}}/v3/'
});
})();