Use Apache as web server and create configuration for host and port 65/46665/1
authorThomas Duval <thomas.duval@orange.com>
Fri, 3 Nov 2017 13:42:18 +0000 (14:42 +0100)
committerThomas Duval <thomas.duval@orange.com>
Fri, 3 Nov 2017 13:42:18 +0000 (14:42 +0100)
Change-Id: Ibbf50f069d8013900884c17a86b1105fc1eb7ae7

moonv4/moon_gui/Dockerfile
moonv4/moon_gui/run.sh [new file with mode: 0644]
moonv4/moon_gui/static/app/moon.constants.js

index ef80966..428e103 100644 (file)
@@ -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 (file)
index 0000000..fc3d87a
--- /dev/null
@@ -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
index 872dfd5..9681e3d 100644 (file)
                                }
                        })
                        .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/'
                        });
 })();