You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ma...@apache.org on 2017/06/01 21:41:58 UTC

[39/44] metron git commit: METRON-844 Install Metron Management UI with Ambari MPack (merrimanr) closes apache/metron#581

METRON-844 Install Metron Management UI with Ambari MPack (merrimanr) closes apache/metron#581


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/61105c71
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/61105c71
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/61105c71

Branch: refs/heads/Metron_0.4.0
Commit: 61105c71520909674985e90acc0c33a54bcc559e
Parents: 1a0e8f2
Author: merrimanr <me...@gmail.com>
Authored: Wed May 31 08:55:24 2017 -0500
Committer: merrimanr <me...@apache.org>
Committed: Wed May 31 08:55:24 2017 -0500

----------------------------------------------------------------------
 metron-deployment/README.md                     |   1 +
 .../METRON/CURRENT/role_command_order.json      |   1 +
 .../METRON/CURRENT/configuration/metron-env.xml |   6 +
 .../common-services/METRON/CURRENT/metainfo.xml |  50 +++++++
 .../package/scripts/management_ui_commands.py   |  46 ++++++
 .../package/scripts/management_ui_master.py     |  90 ++++++++++++
 .../package/scripts/params/params_linux.py      |   4 +
 .../package/templates/management_ui.yml.j2      |  23 +++
 .../METRON/CURRENT/quicklinks/quicklinks.json   |  15 ++
 .../docker/rpm-docker/SPECS/metron.spec         |  12 +-
 .../roles/ambari_common/tasks/main.yml          |   4 +
 .../roles/ambari_config/vars/single_node_vm.yml |   3 +-
 .../roles/ambari_config/vars/small_cluster.yml  |   3 +-
 metron-interface/metron-config/README.md        | 104 +++++++++-----
 metron-interface/metron-config/assembly.xml     |   2 +-
 .../metron-config/management_ui.yml             |  21 +++
 .../metron-config/scripts/metron-management-ui  | 139 +++++++++++++++++++
 .../metron-config/scripts/package.json          |   3 +-
 .../metron-config/scripts/server.js             |  32 ++---
 .../scripts/start_management_ui.sh              |  24 ----
 20 files changed, 497 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/README.md
----------------------------------------------------------------------
diff --git a/metron-deployment/README.md b/metron-deployment/README.md
index f2f4b43..75af150 100644
--- a/metron-deployment/README.md
+++ b/metron-deployment/README.md
@@ -61,6 +61,7 @@ This will set up
 ### Prerequisites
 - A cluster managed by Ambari 2.4.2+
 - Metron RPMs available on the cluster in the /localrepo directory.  See [RPM](#rpm) for further information.
+- [Node.js](https://nodejs.org/en/download/package-manager/) repository installed on the Management UI host 
 
 ### Building Management Pack
 From `metron-deployment` run

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/addon-services/METRON/CURRENT/role_command_order.json
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/addon-services/METRON/CURRENT/role_command_order.json b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/addon-services/METRON/CURRENT/role_command_order.json
index 829758f..1c9affc 100755
--- a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/addon-services/METRON/CURRENT/role_command_order.json
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/addon-services/METRON/CURRENT/role_command_order.json
@@ -11,6 +11,7 @@
         "METRON_ENRICHMENT_SERVICE_CHECK-SERVICE_CHECK" : ["METRON_ENRICHMENT_MASTER-START"],
         "METRON_INDEXING-START" : ["NAMENODE-START", "ZOOKEEPER_SERVER-START", "KAFKA_BROKER-START", "STORM_REST_API-START","METRON_PARSERS-START"],
         "METRON_REST-START": ["KAFKA_BROKER-START","STORM_REST_API-START","ZOOKEEPER_SERVER-START","NAMENODE-START","METRON_PARSERS-INSTALL","METRON_INDEXING-INSTALL","METRON_ENRICHMENT-INSTALL"],
+        "METRON_MANAGEMENT_UI-START": ["METRON_REST-START"],
         "METRON_SERVICE_CHECK-SERVICE_CHECK" : ["METRON_PARSERS-START","METRON_INDEXING-START"]
     }
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/configuration/metron-env.xml
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/configuration/metron-env.xml b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/configuration/metron-env.xml
index ebc2d73..3e5a405 100644
--- a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/configuration/metron-env.xml
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/configuration/metron-env.xml
@@ -83,6 +83,12 @@
         <display-name>Metron REST port</display-name>
     </property>
     <property>
+        <name>metron_management_ui_port</name>
+        <value>4200</value>
+        <description>Port the Management UI runs on</description>
+        <display-name>Management UI port</display-name>
+    </property>
+    <property>
         <name>metron_jvm_flags</name>
         <description>JVM flags passed to Metron scripts</description>
         <display-name>Metron JVM flags</display-name>

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/metainfo.xml
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/metainfo.xml b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/metainfo.xml
index e0fac4c..35828c4 100644
--- a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/metainfo.xml
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/metainfo.xml
@@ -220,6 +220,50 @@
         </component>
 
         <component>
+          <name>METRON_MANAGEMENT_UI</name>
+          <displayName>Metron Management UI</displayName>
+          <category>MASTER</category>
+          <cardinality>1</cardinality>
+          <versionAdvertised>false</versionAdvertised>
+          <reassignAllowed>false</reassignAllowed>
+          <clientsToUpdateConfigs></clientsToUpdateConfigs>
+          <dependencies>
+            <dependency>
+              <name>HDFS/HDFS_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+              <scope>cluster</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>STORM/SUPERVISOR</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>KAFKA/KAFKA_BROKER</name>
+              <scope>cluster</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/management_ui_master.py</script>
+            <scriptType>PYTHON</scriptType>
+          </commandScript>
+        </component>
+
+        <component>
           <name>METRON_CLIENT</name>
           <displayName>Metron Client</displayName>
           <category>CLIENT</category>
@@ -269,6 +313,12 @@
             <package>
               <name>metron-rest</name>
             </package>
+            <package>
+              <name>nodejs</name>
+            </package>
+            <package>
+              <name>metron-config</name>
+            </package>
           </packages>
         </osSpecific>
         <osSpecific>

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_commands.py
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_commands.py b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_commands.py
new file mode 100644
index 0000000..de67f64
--- /dev/null
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_commands.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Execute, File
+
+# Wrap major operations and functionality in this class
+class ManagementUICommands:
+    __params = None
+
+    def __init__(self, params):
+        if params is None:
+            raise ValueError("params argument is required for initialization")
+        self.__params = params
+
+    def start_management_ui(self):
+        Logger.info('Starting Management UI')
+        Execute("service metron-management-ui start")
+        Logger.info('Done starting Management UI')
+
+    def stop_management_ui(self):
+        Logger.info('Stopping Management UI')
+        Execute("service metron-management-ui stop")
+        Logger.info('Done stopping Management UI')
+
+    def restart_management_ui(self, env):
+        Logger.info('Restarting the Management UI')
+        Execute('service metron-management-ui restart')
+        Logger.info('Done restarting the Management UI')

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_master.py
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_master.py b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_master.py
new file mode 100644
index 0000000..28e6b55
--- /dev/null
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/management_ui_master.py
@@ -0,0 +1,90 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.core.exceptions import ComponentIsNotRunning
+from resource_management.core.exceptions import ExecutionFailed
+from resource_management.core.resources.system import Directory
+from resource_management.core.resources.system import File
+from resource_management.core.source import Template
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.script import Script
+from resource_management.core.resources.system import Execute
+
+from resource_management.core.logger import Logger
+
+from management_ui_commands import ManagementUICommands
+
+
+class ManagementUIMaster(Script):
+
+    def install(self, env):
+        from params import params
+        env.set_params(params)
+        self.install_packages(env)
+        Execute('npm --prefix ' + params.metron_home + '/web/expressjs/ install')
+
+    def configure(self, env, upgrade_type=None, config_dir=None):
+        print 'configure managment_ui'
+        from params import params
+        env.set_params(params)
+
+        File(format("{metron_config_path}/management_ui.yml"),
+             mode=0755,
+             content=Template("management_ui.yml.j2"),
+             owner=params.metron_user,
+             group=params.metron_group
+             )
+
+        Directory('/var/run/metron',
+                  create_parents=False,
+                  mode=0755,
+                  owner=params.metron_user,
+                  group=params.metron_group
+                  )
+
+    def start(self, env, upgrade_type=None):
+        from params import params
+        env.set_params(params)
+        self.configure(env)
+        commands = ManagementUICommands(params)
+        commands.start_management_ui()
+
+    def stop(self, env, upgrade_type=None):
+        from params import params
+        env.set_params(params)
+        commands = ManagementUICommands(params)
+        commands.stop_management_ui()
+
+    def status(self, env):
+        status_cmd = format('service metron-management-ui status')
+        try:
+            Execute(status_cmd)
+        except ExecutionFailed:
+            raise ComponentIsNotRunning()
+
+    def restart(self, env):
+        from params import params
+        env.set_params(params)
+        self.configure(env)
+        commands = ManagementUICommands(params)
+        commands.restart_management_ui(env)
+
+
+if __name__ == "__main__":
+    ManagementUIMaster().execute()

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/params/params_linux.py
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/params/params_linux.py b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/params/params_linux.py
index 7f34703..d473325 100755
--- a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/params/params_linux.py
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/params/params_linux.py
@@ -47,6 +47,7 @@ metron_group = config['configurations']['metron-env']['metron_group']
 metron_log_dir = config['configurations']['metron-env']['metron_log_dir']
 metron_pid_dir = config['configurations']['metron-env']['metron_pid_dir']
 metron_rest_port = config['configurations']['metron-env']['metron_rest_port']
+metron_management_ui_port = config['configurations']['metron-env']['metron_management_ui_port']
 metron_jvm_flags = ''
 metron_spring_profiles_active = config['configurations']['metron-env']['metron_spring_profiles_active']
 metron_jdbc_driver = config['configurations']['metron-env']['metron_jdbc_driver']
@@ -219,3 +220,6 @@ if security_enabled:
     kafka_keytab_path = config['configurations']['kafka-env']['kafka_keytab']
 
     nimbus_seeds = config['configurations']['storm-site']['nimbus.seeds']
+
+# Management UI
+metron_rest_host = default("/clusterHostInfo/metron_rest_hosts", ['localhost'])[0]

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/templates/management_ui.yml.j2
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/templates/management_ui.yml.j2 b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/templates/management_ui.yml.j2
new file mode 100644
index 0000000..e88a9f9
--- /dev/null
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/templates/management_ui.yml.j2
@@ -0,0 +1,23 @@
+{#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+
+port: {{metron_management_ui_port}}
+
+rest:
+  host: {{metron_rest_host}}
+  port: {{metron_rest_port}}

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/quicklinks/quicklinks.json
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/quicklinks/quicklinks.json b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/quicklinks/quicklinks.json
index f9b7091..31fde1f 100755
--- a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/quicklinks/quicklinks.json
+++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/quicklinks/quicklinks.json
@@ -37,6 +37,21 @@
           "regex": "^(\\d+)$",
           "site": "metron-env"
         }
+      },
+      {
+        "name": "metron_management_ui",
+        "label": "Management UI",
+        "requires_user_name": "false",
+        "component_name": "METRON_MANAGEMENT_UI",
+        "url": "%@://%@:%@/",
+        "port": {
+          "http_property": "metron_management_ui_port",
+          "http_default_port": "4200",
+          "https_property": "metron_management_ui_port",
+          "https_default_port": "4200",
+          "regex": "^(\\d+)$",
+          "site": "metron-env"
+        }
       }
     ]
   }

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec
----------------------------------------------------------------------
diff --git a/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec b/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec
index b49e0e6..2706e05 100644
--- a/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec
+++ b/metron-deployment/packaging/docker/rpm-docker/SPECS/metron.spec
@@ -87,6 +87,7 @@ tar -xzf %{SOURCE9} -C %{buildroot}%{metron_home}
 tar -xzf %{SOURCE10} -C %{buildroot}%{metron_home}
 
 install %{buildroot}%{metron_home}/bin/metron-rest %{buildroot}/etc/init.d/
+install %{buildroot}%{metron_home}/bin/metron-management-ui %{buildroot}/etc/init.d/
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -378,7 +379,8 @@ This package installs the Metron Management UI %{metron_home}
 %dir %{metron_home}/web/management-ui/assets/fonts/Roboto
 %dir %{metron_home}/web/management-ui/assets/images
 %dir %{metron_home}/web/management-ui/license
-%{metron_home}/bin/start_management_ui.sh
+%{metron_home}/bin/metron-management-ui
+/etc/init.d/metron-management-ui
 %attr(0755,root,root) %{metron_home}/web/expressjs/server.js
 %attr(0644,root,root) %{metron_home}/web/expressjs/package.json
 %attr(0644,root,root) %{metron_home}/web/management-ui/favicon.ico
@@ -398,9 +400,17 @@ This package installs the Metron Management UI %{metron_home}
 %attr(0644,root,root) %{metron_home}/web/management-ui/assets/images/*
 %attr(0644,root,root) %{metron_home}/web/management-ui/license/*
 
+%post config
+chkconfig --add metron-management-ui
+
+%preun config
+chkconfig --del metron-management-ui
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 %changelog
+* Thu May 15 2017 Apache Metron <de...@metron.apache.org> - 0.4.0
+- Added Management UI
 * Tue May 9 2017 Apache Metron <de...@metron.apache.org> - 0.4.0
 - Add Zeppelin Connection Volume Report Dashboard
 * Thu May 4 2017 Ryan Merriman <me...@gmail.com> - 0.4.0

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/roles/ambari_common/tasks/main.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/ambari_common/tasks/main.yml b/metron-deployment/roles/ambari_common/tasks/main.yml
index ea809d6..011c05f 100644
--- a/metron-deployment/roles/ambari_common/tasks/main.yml
+++ b/metron-deployment/roles/ambari_common/tasks/main.yml
@@ -48,3 +48,7 @@
     dest: "/etc/logrotate.d/metron-ambari"
     mode: 0644
 
+- name: Install Nodejs repository
+  shell: curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
+  args:
+    warn: false

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/roles/ambari_config/vars/single_node_vm.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/ambari_config/vars/single_node_vm.yml b/metron-deployment/roles/ambari_config/vars/single_node_vm.yml
index 3de1af7..7e54db3 100644
--- a/metron-deployment/roles/ambari_config/vars/single_node_vm.yml
+++ b/metron-deployment/roles/ambari_config/vars/single_node_vm.yml
@@ -34,11 +34,12 @@ metron_indexing: [METRON_INDEXING]
 metron_enrichment_master : [METRON_ENRICHMENT_MASTER]
 metron_parsers : [METRON_PARSERS]
 metron_rest: [METRON_REST]
+metron_management_ui: [METRON_MANAGEMENT_UI]
 
 metron_components: >
   {{ hadoop_master | union(zookeeper_master) | union(storm_master) | union(hbase_master) | union(hadoop_slave) | union(zookeeper_slave) |
   union(storm_slave) | union(kafka_broker) | union(hbase_slave) | union(kibana_master) | union(metron_indexing) |
-  union(metron_enrichment_master) | union(metron_parsers) | union(metron_rest) | union(es_master) }}
+  union(metron_enrichment_master) | union(metron_parsers) | union(metron_rest) | union(metron_management_ui) | union(es_master) }}
 
 cluster_name: "metron_cluster"
 blueprint_name: "metron_blueprint"

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-deployment/roles/ambari_config/vars/small_cluster.yml
----------------------------------------------------------------------
diff --git a/metron-deployment/roles/ambari_config/vars/small_cluster.yml b/metron-deployment/roles/ambari_config/vars/small_cluster.yml
index 7803dec..dbcfb60 100644
--- a/metron-deployment/roles/ambari_config/vars/small_cluster.yml
+++ b/metron-deployment/roles/ambari_config/vars/small_cluster.yml
@@ -34,6 +34,7 @@ metron_indexing: [METRON_INDEXING]
 metron_enrichment_master : [METRON_ENRICHMENT_MASTER]
 metron_parsers : [METRON_PARSERS]
 metron_rest: [METRON_REST]
+metron_management_ui: [METRON_MANAGEMENT_UI]
 
 master_1_components: "{{ hadoop_master | union(hadoop_clients) | union(es_slave) }}"
 master_1_host:
@@ -42,7 +43,7 @@ master_2_components: "{{ zookeeper_master | union(storm_master) | union(spark_ma
 master_2_host:
   - "{{groups.ambari_slave[1]}}"
 metron_components: >
-    {{ metron_indexing | union(metron_enrichment_master) | union(metron_parsers) | union(metron_rest) | union(hadoop_slave) | union(storm_slave) |
+    {{ metron_indexing | union(metron_enrichment_master) | union(metron_parsers) | union(metron_rest) | union(metron_management_ui) | union(hadoop_slave) | union(storm_slave) |
     union(kafka_broker) | union(hbase_slave) | union(hadoop_clients) }}
 metron_host:
   - "{{ groups.metron[0] }}"

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/README.md
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/README.md b/metron-interface/metron-config/README.md
index 070668f..241adff 100644
--- a/metron-interface/metron-config/README.md
+++ b/metron-interface/metron-config/README.md
@@ -8,69 +8,97 @@ This module provides a user interface for management functions in Metron.
 * nodejs v6.9+ (nodejs can be installed on quick dev with `curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - && yum install -y nodejs`)
 
 ## Installation
-1. Build Metron:
-    ```
-    mvn clean package -DskipTests
-    ```
-  
-1. Copy `metron/metron-interface/metron-config/target/metron-config-METRON_VERSION-archive.tar.gz` to the desired host.
-
-1. Untar the archive in the target directory.  The directory structure will look like:
-    ```
-    bin
-      start_management_ui.sh
-    web
-      expressjs
+
+### From Source
+
+1. Package the application with Maven:
+```
+cd metron-interface/metron-config
+mvn clean package
+```
+
+1. Untar the archive in the $METRON_HOME directory.  The directory structure will look like:
+```
+bin
+  metron-management-ui
+web
+  expressjs
         package.json
         server.js
-      management-ui
+  management-ui
         web assets (html, css, js, ...)
-    ```
+```
+
+1. Copy the `$METRON_HOME/bin/metron-management-ui` script to `/etc/init.d/metron-management-ui`
+
+1. Install the [Express](https://expressjs.com/) web framework from the `package.json` file in `$METRON_HOME/web/expressjs`:
+```
+npm --prefix $METRON_HOME/web/expressjs/ install
+```
 
-1. For production use, the contents of the `./web/management-ui` directory should be deployed to a web server with paths `/api/v1` and `/logout` mapped to the REST application url.  
+### From Package Manager
 
-1. As an example, a convenience script is included that will install a simple [expressjs](https://github.com/expressjs/express) webserver.
+1. Deploy the RPM at `/metron/metron-deployment/packaging/docker/rpm-docker/target/RPMS/noarch/metron-config-$METRON_VERSION-*.noarch.rpm`
 
-1. Then start the application with the script:
-    ```
-    ./bin/start_management_ui.sh
-    Usage: server.js -p [port] -r [restUrl]
-    Options:
-      -p             Port to run metron management ui                [required]
-      -r, --resturl  Url where metron rest application is available  [required]
-    ```
+1. Install the RPM with:
+```
+rpm -ih metron-config-$METRON_VERSION-*.noarch.rpm
+```
+
+1. Install the [Express](https://expressjs.com/) web framework from the `package.json` file in `$METRON_HOME/web/expressjs`:
+```
+npm --prefix $METRON_HOME/web/expressjs/ install
+```
+
+## Configuration
+
+The Managment UI is configured in the `$METRON_HOME/config/management_ui.yml` file.  Create this file and set the values to match your environment:
+```
+port: port the managment UI will run on
+
+rest:
+  host: REST application host
+  port: REST applciation port
+```
 
 ## Usage
 
-The application will be available at http://host:4200 with credentials `user/password`, assuming the default port is configured and the `dev` profile is included when starting the REST application.  See the [REST application](../metron-rest#security) documentation for more information about security configuration for production.
+After configuration is complete, the Management UI can be managed as a service:
+```
+service metron-management-ui start
+```
+
+The application will be available at http://host:4200 assuming the port is set to `4200`.  Logs can be found at `/var/log/metron/metron-management-ui.log`.
 
 ## Development
 
 The Management UI can also be started in development mode.  This allows changes to web assets to be seen interactively.
 
 1. Install the application with dev dependencies:
-    ```
-    npm install
-    ```
+```
+cd metron-interface/metron-config
+npm install
+```
   
 1. Start the application:
-    ```
-    ./scripts/start_dev.sh
-    ```
+```
+./scripts/start_dev.sh
+```
 
 The application will be available at http://localhost:4200/.  The REST application url defaults to `http://localhost:8080` but can be changed in the `proxy.conf.json` file.
 
 ## Testing
 
 1. Install the application with dev dependencies:
-    ```
-    npm install
-    ```
+```
+cd metron-interface/metron-config
+npm install
+```
 
 1. Unit tests can be run with:
-    ```
-    npm test
-    ```
+```
+npm test
+```
 
 ## License
 

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/assembly.xml
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/assembly.xml b/metron-interface/metron-config/assembly.xml
index 86eedd4..39c00e5 100644
--- a/metron-interface/metron-config/assembly.xml
+++ b/metron-interface/metron-config/assembly.xml
@@ -40,7 +40,7 @@
       <outputDirectory>/bin</outputDirectory>
       <useDefaultExcludes>true</useDefaultExcludes>
       <includes>
-        <include>start_management_ui.sh</include>
+        <include>metron-management-ui</include>
       </includes>
       <fileMode>0755</fileMode>
       <lineEnding>unix</lineEnding>

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/management_ui.yml
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/management_ui.yml b/metron-interface/metron-config/management_ui.yml
new file mode 100644
index 0000000..395628d
--- /dev/null
+++ b/metron-interface/metron-config/management_ui.yml
@@ -0,0 +1,21 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+port: 4200
+
+rest:
+  host: localhost
+  port: 8080

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/scripts/metron-management-ui
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/scripts/metron-management-ui b/metron-interface/metron-config/scripts/metron-management-ui
new file mode 100644
index 0000000..32b4e9e
--- /dev/null
+++ b/metron-interface/metron-config/scripts/metron-management-ui
@@ -0,0 +1,139 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# metron management UI service
+# chkconfig: - 20 80
+# description: Management UI
+# processname: metron-management-ui
+#
+if [ -f /etc/rc.d/init.d/functions ]; then
+    . /etc/rc.d/init.d/functions
+fi
+
+NAME=metron-management-ui
+DESC="Metron Management UI"
+METRON_VERSION=${project.version}
+METRON_HOME=/usr/metron/$METRON_VERSION
+METRON_LOG_DIR="/var/log/metron"
+METRON_PID_DIR="/var/run/metron"
+METRON_USER="metron"
+METRON_GROUP="metron"
+
+PIDFILE="$METRON_PID_DIR/$NAME.pid"
+LOCKFILE=/var/lock/subsys/$NAME
+
+DAEMON="node $METRON_HOME/web/expressjs/server.js -c $METRON_HOME/config/management_ui.yml"
+
+#
+# start the rest application
+#
+start() {
+
+  # if pidfile exists, do not start another
+  if [ -f $PIDFILE ]; then
+      PID=`cat $PIDFILE`
+      printf "OK [$PID]\n"
+      return
+  fi
+
+  if [ ! -d "$METRON_LOG_DIR" ]; then
+      mkdir -p "$METRON_LOG_DIR" && chown "$METRON_USER":"$METRON_GROUP" "$METRON_LOG_DIR"
+  fi
+
+  if [ ! -d "$METRON_PID_DIR" ]; then
+      mkdir -p "$METRON_PID_DIR" && chown "$METRON_USER":"$METRON_GROUP" "$METRON_PID_DIR"
+  fi
+
+  # kick-off the daemon
+  PID=`runuser -s /bin/bash $METRON_USER -c "$DAEMON" >> $METRON_LOG_DIR/$NAME.log 2>&1 & echo $!`
+
+  if [ -z $PID ]; then
+      printf "Fail\n"
+  else
+      echo $PID > $PIDFILE && touch $LOCKFILE
+      printf "Ok [$PID]\n"
+  fi
+}
+
+#
+# stop the rest application
+#
+stop() {
+  if [ -f $PIDFILE ]; then
+      PID=`cat $PIDFILE`
+      killproc -p $PIDFILE metron-rest
+      RETVAL=$?
+      echo
+      [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+      printf "Stopped [$PID]\n"
+  else
+      printf "Not running\n"
+  fi
+}
+
+#
+# status check of the rest application
+#
+management_ui_status() {
+  status -p $PIDFILE metron-managment-ui
+}
+
+case "$1" in
+
+  ##############################################################################
+  # start
+  #
+  start)
+    printf "%-50s \n" "Starting $NAME..."
+    start
+  ;;
+
+  ##############################################################################
+  # status
+  #
+  status)
+    printf "%-50s \n" "Checking $NAME..."
+    management_ui_status
+  ;;
+
+  ##############################################################################
+  # stop
+  #
+  stop)
+    printf "%-50s \n" "Stopping $NAME..."
+    stop
+  ;;
+
+  ##############################################################################
+  # restart
+  #
+  restart)
+    $0 stop
+    $0 start
+  ;;
+
+  ##############################################################################
+  # reload
+  #
+  reload)
+  ;;
+
+  *)
+    echo "Usage: $0 {status|start|stop|restart}"
+    exit 1
+esac

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/scripts/package.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/scripts/package.json b/metron-interface/metron-config/scripts/package.json
index 6c7b23d..aca8ed7 100644
--- a/metron-interface/metron-config/scripts/package.json
+++ b/metron-interface/metron-config/scripts/package.json
@@ -9,7 +9,8 @@
     "http-proxy-middleware": "0.17.4",
     "optimist": "0.6.1",
     "serve-favicon": "2.4.2",
-    "serve-static": "1.12.1"
+    "serve-static": "1.12.1",
+    "yamljs": "0.2.9"
   },
   "devDependencies": {},
   "scripts": {

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/scripts/server.js
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/scripts/server.js b/metron-interface/metron-config/scripts/server.js
old mode 100644
new mode 100755
index 7fb1728..7c8ee9e
--- a/metron-interface/metron-config/scripts/server.js
+++ b/metron-interface/metron-config/scripts/server.js
@@ -22,34 +22,27 @@
 var os          = require('os');
 var app         = require('express')();
 var path        = require('path');
-var compression = require('compression')
+var compression = require('compression');
 var serveStatic = require('serve-static');
 var favicon     = require('serve-favicon');
 var proxy       = require('http-proxy-middleware');
 var argv        = require('optimist')
-                  .demand(['p', 'r'])
-                  .alias('r', 'resturl')
-                  .usage('Usage: server.js -p [port] -r [restUrl]')
-                  .describe('p', 'Port to run metron management ui')
-                  .describe('r', 'Url where metron rest application is available')
+                  .demand(['c'])
+                  .alias('c', 'config_file')
+                  .usage('Usage: server.js -c [config_file]')
+                  .describe('c', 'Path to management_ui.yml')
                   .argv;
+var YAML        = require('yamljs');
 
-var port = argv.p;
 var metronUIAddress = '';
 var ifaces = os.networkInterfaces();
-var restUrl =  argv.r || argv.resturl;
-var conf = {
-  "rest": {
-    "target": restUrl,
-    "secure": false
-  }
-};
+var uiConfig = YAML.load(argv.c);
 
 Object.keys(ifaces).forEach(function (dev) {
   ifaces[dev].forEach(function (details) {
     if (details.family === 'IPv4') {
       metronUIAddress += '\n';
-      metronUIAddress += 'http://' + details.address + ':' + port;
+      metronUIAddress += 'http://' + details.address + ':' + uiConfig.port;
     }
   });
 });
@@ -63,8 +56,9 @@ function setCustomCacheControl (res, path) {
 
 app.use(compression());
 
-app.use('/api/v1', proxy(conf.rest));
-app.use('/logout', proxy(conf.rest));
+var restUrl = 'http://' + uiConfig.rest.host + ':' + uiConfig.rest.port;
+app.use('/api/v1', proxy(restUrl));
+app.use('/logout', proxy(restUrl));
 
 app.use(favicon(path.join(__dirname, '../management-ui/favicon.ico')));
 
@@ -74,9 +68,9 @@ app.use(serveStatic(path.join(__dirname, '../management-ui'), {
 }));
 
 app.get('*', function(req, res){
-  res.sendFile(path.resolve('../management-ui/index.html'));
+  res.sendFile(path.join(__dirname, '../management-ui/index.html'));
 });
 
-app.listen(port, function(){
+app.listen(uiConfig.port, function(){
   console.log("Metron server listening on " + metronUIAddress);
 });

http://git-wip-us.apache.org/repos/asf/metron/blob/61105c71/metron-interface/metron-config/scripts/start_management_ui.sh
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/scripts/start_management_ui.sh b/metron-interface/metron-config/scripts/start_management_ui.sh
deleted file mode 100755
index cfd055b..0000000
--- a/metron-interface/metron-config/scripts/start_management_ui.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-
-METRON_VERSION=${project.version}
-METRON_HOME=/usr/metron/$METRON_VERSION
-
-cd $METRON_HOME/web/expressjs
-npm install
-node $METRON_HOME/web/expressjs/server.js $*