Return-Path: X-Original-To: apmail-tez-commits-archive@minotaur.apache.org Delivered-To: apmail-tez-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA27310A38 for ; Fri, 6 Mar 2015 21:45:16 +0000 (UTC) Received: (qmail 84613 invoked by uid 500); 6 Mar 2015 21:45:13 -0000 Delivered-To: apmail-tez-commits-archive@tez.apache.org Received: (qmail 84577 invoked by uid 500); 6 Mar 2015 21:45:13 -0000 Mailing-List: contact commits-help@tez.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tez.apache.org Delivered-To: mailing list commits@tez.apache.org Received: (qmail 84057 invoked by uid 99); 6 Mar 2015 21:45:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2015 21:45:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 83336E10B9; Fri, 6 Mar 2015 21:45:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hitesh@apache.org To: commits@tez.apache.org Message-Id: <167af6b110db4d609a6c501f8fc1d958@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: tez git commit: TEZ-2091. Add support for hosting TEZ_UI with nodejs. (Chang Li via hitesh) Date: Fri, 6 Mar 2015 21:45:13 +0000 (UTC) Repository: tez Updated Branches: refs/heads/branch-0.6 ec50a152a -> b68e698fa TEZ-2091. Add support for hosting TEZ_UI with nodejs. (Chang Li via hitesh) (cherry picked from commit 4a19a430ef7e8e57e7f3fcd3d559efc9a3103601) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/b68e698f Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/b68e698f Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/b68e698f Branch: refs/heads/branch-0.6 Commit: b68e698fa4eb2bb377c0a61d1102b0abbec2f3d4 Parents: ec50a15 Author: Hitesh Shah Authored: Fri Mar 6 13:43:29 2015 -0800 Committer: Hitesh Shah Committed: Fri Mar 6 13:44:41 2015 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + tez-ui/README.TXT | 16 ++++++++++++++ tez-ui/pom.xml | 2 ++ tez-ui/tools/server/nodejs_conf.json | 4 ++++ tez-ui/tools/server/nodejs_webserver.js | 32 ++++++++++++++++++++++++++++ tez-ui/tools/server/package.json | 8 +++++++ 6 files changed, 63 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index e34fec8..94ba1a7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,7 @@ Release 0.6.1: Unreleased INCOMPATIBLE CHANGES ALL CHANGES: + TEZ-2091. Add support for hosting TEZ_UI with nodejs. TEZ-2165. Tez UI: DAG shows running status if killed by RM in some cases. TEZ-2158. TEZ UI: Display dag/vertex names, and task/attempt index in breadcrumb. TEZ-2160. Tez UI: App tracking URL should support navigation back. http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/tez-ui/README.TXT ---------------------------------------------------------------------- diff --git a/tez-ui/README.TXT b/tez-ui/README.TXT index d19f951..aa4564c 100644 --- a/tez-ui/README.TXT +++ b/tez-ui/README.TXT @@ -59,6 +59,22 @@ Manually: 3. Restart tomcat and the war will get deployed. The content of the war would be available in $TOMCAT_HOME/webapps/tez-ui-x.x.x-SNAPSHOT. +Using the Nodejs webserver +--------------------------- +This provides an alternative way to host tez_ui. This should be used by +people who would like to host tez_ui by nodejs. + 1. Install nodejs by package manager. Instructions for this are available at + "https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager" + 2. Install server dependencies by running 'npm install' within 'tez-ui/tools/server' + 3. Untar the tez-ui*.war file and copy the resulting directory to the + directory designated to be the document root of the web server. + 4. Specify the document root directory and the port on which you want to run the + webserver in nodejs_conf.json. Currently, the conf file should be present in the + same directory as the nodejs_webserver). + The default values for the document root directory and the port are './public' + and 8080 respectively. + 5. Start the nodejs_webserver.js by 'node nodejs_webserver.js' + Dev setup instructions ---------------------- Install the development dependencies nodejs, npm, grunt and bower. http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/tez-ui/pom.xml ---------------------------------------------------------------------- diff --git a/tez-ui/pom.xml b/tez-ui/pom.xml index 80a191c..1d52be7 100644 --- a/tez-ui/pom.xml +++ b/tez-ui/pom.xml @@ -51,6 +51,8 @@ src/main/webapp/.jshintrc src/main/webapp/bower.json src/main/webapp/package.json + tools/server/nodejs_conf.json + tools/server/package.json http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/tez-ui/tools/server/nodejs_conf.json ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/nodejs_conf.json b/tez-ui/tools/server/nodejs_conf.json new file mode 100644 index 0000000..a84b569 --- /dev/null +++ b/tez-ui/tools/server/nodejs_conf.json @@ -0,0 +1,4 @@ +{ + "UI_Dir" : "./public", + "port" : 8080 +} http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/tez-ui/tools/server/nodejs_webserver.js ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/nodejs_webserver.js b/tez-ui/tools/server/nodejs_webserver.js new file mode 100644 index 0000000..8cd1975 --- /dev/null +++ b/tez-ui/tools/server/nodejs_webserver.js @@ -0,0 +1,32 @@ +/**** + Licensed 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. See accompanying LICENSE file. +****/ + +var express = require('express') +var config = require('jsonconfig') +var app = express() +var path, port; +try { + config.load(['./nodejs_conf.json']) + path = config.UI_Dir || './public'; + port = config.port || 8080; +} catch(err) { + process.stdout.write("err: " + err); + path = './public'; + port = 8080; +} +app.use('/',express.static(path)) +app.listen(port); +process.stdout.write("TEZ-UI server started on port " + port + + "\n" + "Use CTRL+C to shutdown"); + http://git-wip-us.apache.org/repos/asf/tez/blob/b68e698f/tez-ui/tools/server/package.json ---------------------------------------------------------------------- diff --git a/tez-ui/tools/server/package.json b/tez-ui/tools/server/package.json new file mode 100644 index 0000000..91cf0fb --- /dev/null +++ b/tez-ui/tools/server/package.json @@ -0,0 +1,8 @@ +{ + "name": "express_server", + "version": "0.0.1", + "dependencies": { + "express": "4.12.1", + "jsonconfig": "0.3.0" + } +}