YARN-6458. Use yarn package manager to lock down dependency versions for new web UI. Contributed by Sreenath Somarajapuram.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3aa81115 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3aa81115 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3aa81115 Branch: refs/heads/YARN-3368_branch2 Commit: 3aa8111594ceeb4e289dee63201ebb32ec9e1e35 Parents: 9e4e218 Author: Sunil G <sun...@apache.org> Authored: Sun Jun 4 22:05:14 2017 +0530 Committer: Varun Saxena <varunsax...@apache.org> Committed: Wed Oct 18 02:06:49 2017 +0530 ---------------------------------------------------------------------- .../hadoop-yarn/hadoop-yarn-ui/README.md | 64 + .../hadoop-yarn/hadoop-yarn-ui/pom.xml | 171 +- .../hadoop-yarn-ui/src/main/webapp/.bowerrc | 5 +- .../src/main/webapp/WEB-INF/wro.xml | 9 + .../src/main/webapp/bower-shrinkwrap.json | 66 + .../src/main/webapp/ember-cli-build.js | 16 +- .../hadoop-yarn-ui/src/main/webapp/package.json | 15 +- .../hadoop-yarn-ui/src/main/webapp/yarn.lock | 4983 ++++++++++++++++++ 8 files changed, 5275 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md new file mode 100644 index 0000000..f67f351 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/README.md @@ -0,0 +1,64 @@ +<!-- + 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. +--> + +# Yarn UI + +The Yarn UI is an Ember based web-app that provides visualization of the applications running on the Apache Hadoop YARN framework. + +## Configurations + +* You can point the UI to custom locations by setting the environment variables in `src/main/webapp/config/configs.env` + +## Development + +All the following commands must be run inside `src/main/webapp`. + +### Prerequisites + +You will need the following things properly installed on your computer. + +* Install [Yarn](https://yarnpkg.com) v0.21.3 +* Install [Bower](http://bower.io/) v1.7.7 +* Install all dependencies by running `yarn install` & `bower install` + +### Running UI + +* `yarn start` +* Visit your app at [http://localhost:4200](http://localhost:4200). + +### Building + +* `yarn run build` (production) +* Files would be stored in "dist/" + +### Adding new dependencies + +**Warning: Do not edit the _package.json_ or _bower.json_ files manually. This could make them out-of-sync with the respective lock or shrinkwrap files.** + +Yarn UI has replaced NPM with Yarn package manager. And hence Yarn would be used to manage dependencies defined in package.json. + +* Please use the Yarn and Bower command-line tools to add new dependencies. And the tool version must be same as those defined in Prerequisites section. +* Once any dependency is added: + * If it's in package.json. Make sure that the respective, and only those changes are reflected in yarn.lock file. + * If it's in bower.json. Make sure that the respective, and only those changes are reflected in bower-shrinkwrap.json file. +* Commands to add using CLI tools: + * Yarn: yarn add [package-name] + * Bower: bower install --save [package-name] + +### Adding new routes (pages), controllers, components etc. + +* Use ember-cli blueprint generator - [Ember CLI](http://ember-cli.com/extending/#generators-and-blueprints) http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml index 5f6eda9..5f546ef 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml @@ -27,15 +27,16 @@ <artifactId>hadoop-yarn-ui</artifactId> <version>2.9.0-SNAPSHOT</version> <name>Apache Hadoop YARN UI</name> - <packaging>${packaging.type}</packaging> + <packaging>${packagingType}</packaging> <properties> - <packaging.type>pom</packaging.type> - <webappTgtDir>${basedir}/target/src/main/webapp</webappTgtDir> - <node.executable>node</node.executable> - <nodeVersion>v0.12.2</nodeVersion> - <npmVersion>2.10.0</npmVersion> - <keep-ui-build-cache>false</keep-ui-build-cache> + <packagingType>pom</packagingType> + + <webappDir>${basedir}/target/webapp</webappDir> + <nodeExecutable>${basedir}/target/webapp/node/node</nodeExecutable> + <packageManagerScript>node/yarn/dist/bin/yarn.js</packageManagerScript> + + <keepUIBuildCache>false</keepUIBuildCache> </properties> <build> @@ -48,7 +49,9 @@ <excludes> <exclude>src/main/webapp/jsconfig.json</exclude> <exclude>src/main/webapp/bower.json</exclude> + <exclude>src/main/webapp/bower-shrinkwrap.json</exclude> <exclude>src/main/webapp/package.json</exclude> + <exclude>src/main/webapp/yarn.lock</exclude> <exclude>src/main/webapp/testem.json</exclude> <exclude>src/main/webapp/public/assets/images/**/*</exclude> <exclude>src/main/webapp/public/assets/images/*</exclude> @@ -58,6 +61,7 @@ <exclude>src/main/webapp/.ember-cli</exclude> <exclude>src/main/webapp/.jshintrc</exclude> <exclude>src/main/webapp/.watchmanconfig</exclude> + <exclude>src/main/webapp/WEB-INF/wro.xml</exclude> </excludes> </configuration> </plugin> @@ -66,14 +70,14 @@ <artifactId>maven-clean-plugin</artifactId> <version>3.0.0</version> <configuration> - <skip>${keep-ui-build-cache}</skip> + <skip>${keepUIBuildCache}</skip> <followSymLinks>false</followSymLinks> <filesets> <fileset> - <directory>${webappTgtDir}/bower_components</directory> + <directory>${webappDir}/bower_components</directory> </fileset> <fileset> - <directory>${webappTgtDir}/node_modules</directory> + <directory>${webappDir}/node_modules</directory> </fileset> </filesets> </configuration> @@ -90,60 +94,82 @@ </activation> <properties> - <packaging.type>war</packaging.type> + <packagingType>war</packagingType> </properties> <build> <plugins> - <!-- prepare source code --> + <!-- Copy files into target for build --> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> + <artifactId>maven-resources-plugin</artifactId> <executions> <execution> - <id>prepare-source-code</id> - <phase>generate-sources</phase> + <id>copy-resources</id> + <!-- here the phase you need --> + <phase>validate</phase> <goals> - <goal>run</goal> + <goal>copy-resources</goal> </goals> <configuration> - <target> - <copy toDir="${basedir}/target/src/main/webapp"> - <fileset dir="${basedir}/src/main/webapp"/> - </copy> - - <copy toDir="${basedir}/target/src/public"> - <fileset dir="${basedir}/public"/> - </copy> - </target> + <outputDirectory>${webappDir}</outputDirectory> + <resources> + <resource> + <directory>${basedir}/src/main/webapp</directory> + <filtering>true</filtering> + <excludes> + <exclude>node_modules/**/*</exclude> + <exclude>bower_components/**/*</exclude> + <exclude>tmp/**/*</exclude> + <exclude>dist/**/*</exclude> + </excludes> + </resource> + </resources> </configuration> </execution> </executions> </plugin> - - <!-- Bower install & grunt build--> <plugin> - <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <!-- Install Node, Yarn, Bower & dependencies --> + <plugin> + <groupId>com.github.eirslett</groupId> + <artifactId>frontend-maven-plugin</artifactId> + <version>1.2</version> + <configuration> + <workingDirectory>${webappDir}</workingDirectory> + </configuration> <executions> + + <!-- Install all dependencies --> <execution> - <phase>generate-sources</phase> - <id>npm install</id> + <phase>generate-resources</phase> + <id>install node and yarn</id> <goals> - <goal>exec</goal> + <goal>install-node-and-yarn</goal> </goals> <configuration> - <workingDirectory>${webappTgtDir}</workingDirectory> - <executable>npm</executable> - <arguments> - <argument>install</argument> - </arguments> + <nodeVersion>v5.12.0</nodeVersion> + <yarnVersion>v0.21.3</yarnVersion> + </configuration> + </execution> + <execution> + <phase>generate-resources</phase> + <id>yarn install</id> + <goals> + <goal>yarn</goal> + </goals> + <configuration> + <arguments>install</arguments> </configuration> </execution> <execution> - <phase>generate-sources</phase> + <phase>generate-resources</phase> <id>bower install</id> + <configuration> + <arguments>install</arguments> + </configuration> <goals> <goal>exec</goal> </goals> @@ -156,33 +182,83 @@ </arguments> </configuration> </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + + <!-- Build --> <execution> <id>ember build</id> - <phase>generate-sources</phase> + <phase>generate-resources</phase> <goals> <goal>exec</goal> </goals> <configuration> - <workingDirectory>${webappTgtDir}</workingDirectory> - <executable>ember</executable> + <workingDirectory>${webappDir}</workingDirectory> + <executable>${nodeExecutable}</executable> <arguments> - <argument>build</argument> - <argument>-prod</argument> - <argument>--output-path</argument> - <argument>${basedir}/target/dist</argument> + <argument>${packageManagerScript}</argument> + <argument>run</argument> + <argument>build:mvn</argument> </arguments> </configuration> </execution> + + </executions> + </plugin> + + <!-- Asset minifier --> + <plugin> + <groupId>ro.isdc.wro4j</groupId> + <artifactId>wro4j-maven-plugin</artifactId> + <version>1.7.9</version> + <executions> + <execution> + <phase>prepare-package</phase> + <goals> + <goal>run</goal> + </goals> + </execution> </executions> + <configuration> + <minimize>true</minimize> + <targetGroups>yarn-ui,vendor</targetGroups> + <destinationFolder>${basedir}/target/minified-resources/assets</destinationFolder> + <contextFolder>${webappDir}/dist/assets</contextFolder> + <wroFile>${webappDir}/WEB-INF/wro.xml</wroFile> + </configuration> </plugin> <!-- Package into war --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + </execution> + </executions> <configuration> - <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml> - <warSourceDirectory>${basedir}/target/dist</warSourceDirectory> + <webXml>${webappDir}/WEB-INF/web.xml</webXml> + <warSourceDirectory>${webappDir}/dist</warSourceDirectory> + <webResources> + <resource> + <filtering>false</filtering> + <directory>${basedir}/target/minified-resources</directory> + </resource> + </webResources> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <skipIfEmpty>true</skipIfEmpty> </configuration> </plugin> @@ -190,4 +266,5 @@ </build> </profile> </profiles> + </project> http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc index 959e169..5b0b07d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.bowerrc @@ -1,4 +1,7 @@ { "directory": "bower_components", - "analytics": false + "analytics": false, + "resolvers": [ + "bower-shrinkwrap-resolver-ext" + ] } http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml new file mode 100644 index 0000000..64c925a --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/WEB-INF/wro.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<groups xmlns="http://www.isdc.ro/wro"> + <group name='vendor'> + <js>/vendor.js</js> + </group> + <group name='yarn-ui'> + <js>/yarn-ui.js</js> + </group> +</groups> http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower-shrinkwrap.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower-shrinkwrap.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower-shrinkwrap.json new file mode 100644 index 0000000..b0f3aa3 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/bower-shrinkwrap.json @@ -0,0 +1,66 @@ +{ + "https://github.com/DataTables/DataTables.git": { + "1.10.15": "1.10.15" + }, + "https://github.com/components/ember-data.git": { + "2.1.0": "d8b4d3092f67afe22d9d374c40d719d557915fa3" + }, + "https://github.com/components/ember.git": { + "2.2.0": "49e042ca89922ed96b27488c2a98add280ae7123" + }, + "https://github.com/components/jqueryui.git": { + "1.11.4": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1" + }, + "https://github.com/dockyard/ember-qunit-notifications.git": { + "0.1.0": "a83277aa7a1c0545c66e6d133caebb9a620e71ad" + }, + "https://github.com/dockyard/qunit-notifications.git": { + "0.1.1": "7a13f6dba5a340e1cb9e0b64c1c711e4d7edaca1" + }, + "https://github.com/ember-cli/ember-cli-shims.git": { + "0.0.6": "dcab43b58d5698690050bb9a46ead5c8663c7da1" + }, + "https://github.com/ember-cli/ember-cli-test-loader.git": { + "0.2.1": "3348d801089279296c38f31ae14d9c4d115ce154" + }, + "https://github.com/ember-cli/ember-load-initializers.git": { + "0.1.7": "7bb21488563bd1bba23e903a812bf5815beddd1a" + }, + "https://github.com/fgnass/spin.js.git": { + "2.3.2": "2.3.2" + }, + "https://github.com/ivaynberg/select2.git": { + "4.0.0": "4.0.0" + }, + "https://github.com/jquery/jquery-dist.git": { + "2.1.4": "7751e69b615c6eca6f783a81e292a55725af6b85" + }, + "https://github.com/jquery/qunit.git": { + "1.19.0": "467e7e34652ad7d5883ce9c568461cf8c5e172a8" + }, + "https://github.com/mbostock-bower/d3-bower.git": { + "3.5.17": "3.5.17" + }, + "https://github.com/moment/moment-timezone.git": { + "0.5.0": "74a2e9378ecf4a31a168f3049f086565c8d66814" + }, + "https://github.com/moment/moment.git": { + "2.10.6": "2.10.6", + "2.12.0": "d3d7488b4d60632854181cb0a9af325d57fb3d51" + }, + "https://github.com/rwjblue/ember-qunit-builds.git": { + "0.4.16": "142c4066a5458bef9dfcb92b70152b9c01d79188" + }, + "https://github.com/sreenaths/more-js.git": { + "0.8.2": "0.8.2" + }, + "https://github.com/sreenaths/snippet-ss.git": { + "1.11.0": "c1abc566f4e001b7f1939b6dbdd911eadc969cf9" + }, + "https://github.com/stefanpenner/loader.js.git": { + "3.3.0": "ac909550c9544325632542bbea97531cc60bc628" + }, + "https://github.com/twbs/bootstrap.git": { + "3.3.6": "81df608a40bf0629a1dc08e584849bb1e43e0b7a" + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js index b75a2e9..4799f92 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/ember-cli-build.js @@ -21,8 +21,22 @@ var Funnel = require("broccoli-funnel"); var EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { + var isProd = EmberApp.env() === 'production'; var app = new EmberApp(defaults, { - hinting: true + storeConfigInMeta: false, + minifyCSS: { + enabled: isProd + }, + minifyJS: { + // Will be minified by wro4j-maven-plugin for performance + enabled: false, + }, + fingerprint: { + enabled: false + }, + sourcemaps: { + enabled: !isProd + } }); app.import("bower_components/datatables/media/css/jquery.dataTables.min.css"); http://git-wip-us.apache.org/repos/asf/hadoop/blob/3aa81115/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json index a5e9a2b..2b454aa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json @@ -8,8 +8,9 @@ "test": "tests" }, "scripts": { - "build": "ember build", - "start": "ember server" + "build": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember build", + "start": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember server", + "build:mvn": "TMPDIR=tmp node/node ./node_modules/ember-cli/bin/ember build -prod" }, "repository": "", "engines": { @@ -18,12 +19,14 @@ "author": "", "license": "Apache", "devDependencies": { + "bower": "1.7.7", + "bower-shrinkwrap-resolver-ext": "0.1.0", "broccoli-asset-rev": "2.4.2", "broccoli-funnel": "1.0.1", "em-table": "0.7.0", "ember-array-contains-helper": "1.0.2", "ember-bootstrap": "0.5.1", - "ember-cli": "1.13.13", + "ember-cli": "1.13.14", "ember-cli-app-version": "1.0.0", "ember-cli-babel": "5.1.6", "ember-cli-content-security-policy": "0.4.0", @@ -44,8 +47,10 @@ "ember-lodash": "0.0.10", "ember-resolver": "2.0.3", "ember-spin-spinner": "0.2.3", - "ember-truth-helpers": "1.2.0", - "select2": "4.0.0" + "ember-truth-helpers": "1.3.0", + "loader.js": "4.2.3", + "select2": "4.0.0", + "testem": "0.9.11" }, "dependencies": { "em-helpers": "^0.8.0", --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org