You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by el...@apache.org on 2015/12/31 02:19:49 UTC
[1/5] incubator-slider git commit: SLIDER-809 First implementation of
an Apache Tomcat app-package
Repository: incubator-slider
Updated Branches:
refs/heads/develop d26e84520 -> 268cdbf15
SLIDER-809 First implementation of an Apache Tomcat app-package
Uses Apache Tomcat 8.0.30
* Includes basic documentation
* Supports basic tomcat-users.xml configuration
* Implements extra resource localization support into containers
* Include a basic IT
* Exports server address to registry
* Update rat-check for new additions
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/dd121b18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/dd121b18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/dd121b18
Branch: refs/heads/develop
Commit: dd121b18c26c7272887ca1e09659adac85916828
Parents: d26e845
Author: Josh Elser <el...@apache.org>
Authored: Mon Mar 16 00:31:27 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed Dec 30 16:20:52 2015 -0500
----------------------------------------------------------------------
app-packages/pom.xml | 2 +
app-packages/tomcat/LICENSE.txt | 206 ++++++++++++++++
app-packages/tomcat/NOTICE.txt | 45 ++++
app-packages/tomcat/README.md | 64 +++++
app-packages/tomcat/appConfig-default.json | 23 ++
app-packages/tomcat/metainfo.xml | 84 +++++++
app-packages/tomcat/package/scripts/params.py | 36 +++
app-packages/tomcat/package/scripts/tomcat.py | 80 ++++++
.../tomcat/package/templates/server.xml.j2 | 142 +++++++++++
.../package/templates/tomcat-users.xml.j2 | 35 +++
app-packages/tomcat/pom.xml | 241 +++++++++++++++++++
app-packages/tomcat/resources-default.json | 16 ++
app-packages/tomcat/src/assembly/tomcat.xml | 78 ++++++
.../tomcat/TomcatAgentCommandTestBase.groovy | 40 +++
.../slider/funtest/tomcat/TomcatBasicIT.groovy | 214 ++++++++++++++++
.../tomcat/StubToForceGroovyTestsToCompile.java | 22 ++
.../src/test/resources/appConfig-default.json | 23 ++
.../tomcat/src/test/resources/resources.json | 16 ++
.../tomcat/src/test/resources/slider-test.war | Bin 0 -> 3694967 bytes
.../slider/providers/agent/AgentKeys.java | 3 +
.../providers/agent/AgentProviderService.java | 20 ++
21 files changed, 1390 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/pom.xml b/app-packages/pom.xml
index 3162baf..a286d0c 100644
--- a/app-packages/pom.xml
+++ b/app-packages/pom.xml
@@ -53,6 +53,7 @@
<module>accumulo</module>
<module>hbase</module>
<module>storm</module>
+ <module>tomcat</module>
</modules>
</profile>
@@ -85,6 +86,7 @@
<module>storm</module>
<module>hbase-win</module>
<module>storm-win</module>
+ <module>tomcat</module>
</modules>
</profile>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/LICENSE.txt
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/LICENSE.txt b/app-packages/tomcat/LICENSE.txt
new file mode 100644
index 0000000..2491100
--- /dev/null
+++ b/app-packages/tomcat/LICENSE.txt
@@ -0,0 +1,206 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+The binary distribution of the Apache Slider App Package for Apache Tomcat
+bundles a binary distribution of Apache Tomcat 8.0.20.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/NOTICE.txt
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/NOTICE.txt b/app-packages/tomcat/NOTICE.txt
new file mode 100644
index 0000000..4285cd7
--- /dev/null
+++ b/app-packages/tomcat/NOTICE.txt
@@ -0,0 +1,45 @@
+Apache Slider (incubating) -- Apache Tomcat App Package
+Copyright 2001-2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+The Windows Installer is built with the Nullsoft
+Scriptable Install System (NSIS), which is
+open source software. The original software and
+related information is available at
+http://nsis.sourceforge.net.
+
+Java compilation software for JSP pages is provided by Eclipse,
+which is open source software. The original software and
+related information is available at
+http://www.eclipse.org.
+
+For the bayeux implementation
+The org.apache.cometd.bayeux API is derivative work originating at the Dojo Foundation
+* Copyright 2007-2008 Guy Molinari
+* Copyright 2007-2008 Filip Hanik
+* Copyright 2007 Dojo Foundation
+* Copyright 2007 Mort Bay Consulting Pty. Ltd.
+
+The original XML Schemas for Java EE Deployment Descriptors:
+ - javaee_5.xsd
+ - javaee_web_services_1_2.xsd
+ - javaee_web_services_client_1_2.xsd
+ - javaee_6.xsd
+ - javaee_web_services_1_3.xsd
+ - javaee_web_services_client_1_3.xsd
+ - jsp_2_2.xsd
+ - web-app_3_0.xsd
+ - web-common_3_0.xsd
+ - web-fragment_3_0.xsd
+ - javaee_7.xsd
+ - javaee_web_services_1_4.xsd
+ - javaee_web_services_client_1_4.xsd
+ - jsp_2_3.xsd
+ - web-app_3_1.xsd
+ - web-common_3_1.xsd
+ - web-fragment_3_1.xsd
+
+may be obtained from:
+http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/README.md
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/README.md b/app-packages/tomcat/README.md
new file mode 100644
index 0000000..ff77c80
--- /dev/null
+++ b/app-packages/tomcat/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.
+-->
+
+# Apache Tomcat
+
+Basic instructions on using the Apache Tomcat app-package.
+
+## Build
+
+Check out the appropriate branch of slider, and build the project, providing the
+necessary profile activation for the Tomcat app package. You probably also
+want to skip tests. This will place zip file in `app-packages/tomcat/target`
+that will be used later.
+
+`mvn clean package -DskipTests -Ptomcat-app-package`
+
+## Installation
+
+The Tomcat application package is distributed as a zip archive.
+Use the `slider install` command to install it into HDFS for use.
+You must also provide an identifying name (such as "tomcat").
+
+`slider package --install --name tomcat --package path/to/slider-tomcat-app-package-0.91.0-incubating-SNAPSHOT.zip`
+
+## Configuration
+
+Copy appConfig-default.json and resources-default.json. By default, these files
+will create one instance of Tomcat using a dynamic port provided by Slider.
+
+In the copied appConfig.json, make sure you set `application.def` and
+`java_home` to the correct values. Feel free to adjust the memory usage as well.
+
+
+## Create a Slider cluster
+
+Use the appConfig.json and resources.json file to create a Slider cluster now.
+The name of the cluster is user defined and must be unique: this example uses "tomcat1"
+
+`slider create tomcat1 --template path/to/appConfig.json --resources path/to/resources.json`
+
+## Verify
+
+Check the Slider Application Master page on the Hadoop YARN status page. You should see
+the application running and without failures. The address of the Tomcat servers will be listed
+as exports on the AppMaster's web UI.
+
+# Slider Automated Testing
+
+The provided slider-test.war is built using https://github.com/joshelser/simple-rest-war. Modifications
+of that WAR file can be made using that codebase and including the binary test resource here.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/appConfig-default.json
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/appConfig-default.json b/app-packages/tomcat/appConfig-default.json
new file mode 100644
index 0000000..84183ca
--- /dev/null
+++ b/app-packages/tomcat/appConfig-default.json
@@ -0,0 +1,23 @@
+{
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": {
+ },
+ "global": {
+ "application.def": ".slider/package/TOMCAT/slider-tomcat-app-package-0.91.0-incubating-SNAPSHOT.zip",
+ "java_home": "${app.java.home}",
+ "application.resources": "hdfs://localhost:8020/tmp/slider-test.war",
+
+ "site.global.xmx_val": "1g",
+ "site.global.xms_val": "128m",
+ "site.global.memory_val": "200M",
+ "site.server-xml.http.port":"${TOMCAT.ALLOCATED_PORT}{PER_CONTAINER}",
+ "site.server-xml.connection.timeout":"20000",
+ "site.tomcat-users-xml.ui_user": "tomcat",
+ "site.tomcat-users-xml.ui_password": "password"
+ },
+ "components": {
+ "slider-appmaster": {
+ "jvm.heapsize": "128M"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/metainfo.xml b/app-packages/tomcat/metainfo.xml
new file mode 100644
index 0000000..714bfa4
--- /dev/null
+++ b/app-packages/tomcat/metainfo.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<metainfo>
+ <schemaVersion>2.0</schemaVersion>
+ <application>
+ <name>TOMCAT</name>
+ <comment>Apache Tomcat</comment>
+ <version>0.0.1</version>
+ <exportedConfigs>None</exportedConfigs>
+ <exportGroups>
+ <exportGroup>
+ <name>Servers</name>
+ <exports>
+ <export>
+ <name>tomcat.http_port</name>
+ <value>${TOMCAT_HOST}:${site.server-xml.http.port}</value>
+ </export>
+ </exports>
+ </exportGroup>
+ </exportGroups>
+ <components>
+ <component>
+ <name>TOMCAT</name>
+ <category>MASTER</category>
+ <compExports>Servers-host_port</compExports>
+ <commandScript>
+ <script>scripts/tomcat.py</script>
+ <scriptType>PYTHON</scriptType>
+ </commandScript>
+ </component>
+ </components>
+ <osSpecifics>
+ <osSpecific>
+ <osType>any</osType>
+ <packages>
+ <package>
+ <type>tarball</type>
+ <name>files/tomcat-8.0.30.tar.gz</name>
+ </package>
+ </packages>
+ </osSpecific>
+ </osSpecifics>
+
+ <exportGroups>
+ <exportGroup>
+ <name>QuickLinks</name>
+ <exports>
+ <export>
+ <name>HTTP</name>
+ <value>http://${TOMCAT_HOST}:${site.global.listen_port}</value>
+ </export>
+ </exports>
+ </exportGroup>
+ </exportGroups>
+
+ <configFiles>
+ <configFile>
+ <type>env</type>
+ <fileName>server.xml</fileName>
+ <dictionaryName>server-xml</dictionaryName>
+ </configFile>
+ <configFile>
+ <type>env</type>
+ <fileName>tomcat-users.xml</fileName>
+ <dictionaryName>tomcat-users-xml</dictionaryName>
+ </configFile>
+ </configFiles>
+ </application>
+</metainfo>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/package/scripts/params.py b/app-packages/tomcat/package/scripts/params.py
new file mode 100644
index 0000000..042933b
--- /dev/null
+++ b/app-packages/tomcat/package/scripts/params.py
@@ -0,0 +1,36 @@
+#!/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 import *
+
+TOMCAT_DIRECTORY_NAME = 'apache-tomcat-8.0.30'
+
+# server configurations
+config = Script.get_config()
+
+app_root = config['configurations']['global']['app_root']
+conf_dir = format("{app_root}/{TOMCAT_DIRECTORY_NAME}/conf")
+java64_home = config['hostLevelParams']['java_home']
+pid_file = config['configurations']['global']['pid_file']
+
+http_port = config['configurations']['server-xml']['http.port']
+connection_timeout = config['configurations']['server-xml']['connection.timeout']
+ui_user = config['configurations']['tomcat-users-xml']['ui_user']
+ui_password = config['configurations']['tomcat-users-xml']['ui_password']
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/package/scripts/tomcat.py
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/package/scripts/tomcat.py b/app-packages/tomcat/package/scripts/tomcat.py
new file mode 100644
index 0000000..024542e
--- /dev/null
+++ b/app-packages/tomcat/package/scripts/tomcat.py
@@ -0,0 +1,80 @@
+#!/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.
+
+"""
+
+import os, shutil, sys
+from resource_management import *
+
+class Tomcat(Script):
+ def install(self, env):
+ self.install_packages(env)
+ pass
+
+ def configure(self, env):
+ import params
+ env.set_params(params)
+ File(format("{conf_dir}/server.xml"), content=Template("server.xml.j2"))
+ File(format("{conf_dir}/tomcat-users.xml"), content=Template("tomcat-users.xml.j2"))
+ resources = format('{app_root}/../resources')
+ webapps_dir = format("{app_root}/{TOMCAT_DIRECTORY_NAME}/webapps/")
+ for resource in os.listdir(resources):
+ full_resource_path = os.path.join(resources, resource)
+ if os.path.isfile(full_resource_path) and resource.endswith('.war'):
+ Logger.info("Copying %s to %s" % (full_resource_path, webapps_dir))
+ shutil.copy(full_resource_path, webapps_dir)
+ else:
+ Logger.info("Ignoring localized file that doesn't end in '.war': %s" % full_resource_path)
+
+ def start(self, env):
+ import params
+ # implicit that the params/env are properly configured
+ self.configure(env)
+ tomcat_pid = format('{app_root}/catalina.pid')
+ process_cmd = format('env JAVA_HOME={java64_home} CATALINA_PID=' + tomcat_pid + ' {app_root}/{TOMCAT_DIRECTORY_NAME}/bin/catalina.sh start')
+
+ Execute(process_cmd,
+ logoutput=False,
+ wait_for_finish=True,
+ pid_file=tomcat_pid,
+ poll_after = 15
+ )
+
+ def stop(self, env):
+ import params
+ # Don't need to re-call configure()
+ env.set_params(params)
+ tomcat_pid = format('{app_root}/catalina.pid')
+ process_cmd = format('env JAVA_HOME={java64_home} CATALINA_PID=' + tomcat_pid + ' {app_root}/{TOMCAT_DIRECTORY_NAME}/bin/catalina.sh stop')
+
+ Execute(process_cmd,
+ logoutput=True,
+ wait_for_finish=True,
+ pid_file=tomcat_pid,
+ poll_after = 15
+ )
+
+ def status(self, env):
+ import params
+ # Don't need to re-call configure()
+ env.set_params(params)
+ tomcat_pid = format('{app_root}/catalina.pid')
+ check_process_status(tomcat_pid)
+
+if __name__ == "__main__":
+ Tomcat().execute()
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/package/templates/server.xml.j2
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/package/templates/server.xml.j2 b/app-packages/tomcat/package/templates/server.xml.j2
new file mode 100644
index 0000000..54f50d5
--- /dev/null
+++ b/app-packages/tomcat/package/templates/server.xml.j2
@@ -0,0 +1,142 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ 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.
+-->
+<!-- Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" at this level.
+ Documentation at /docs/config/server.html
+ -->
+<!-- Disable the shutdown port -->
+<Server port="-1" shutdown="SHUTDOWN">
+ <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
+ <!-- Security listener. Documentation at /docs/config/listeners.html
+ <Listener className="org.apache.catalina.security.SecurityListener" />
+ -->
+ <!--APR library loader. Documentation at /docs/apr.html -->
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+ <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+ <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+ <!-- Global JNDI resources
+ Documentation at /docs/jndi-resources-howto.html
+ -->
+ <GlobalNamingResources>
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users
+ -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" Note: A "Service" is not itself a "Container",
+ so you may not define subcomponents such as "Valves" at this level.
+ Documentation at /docs/config/service.html
+ -->
+ <Service name="Catalina">
+
+ <!--The connectors can use a shared executor, you can define one or more named thread pools-->
+ <!--
+ <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+ maxThreads="150" minSpareThreads="4"/>
+ -->
+
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Documentation at :
+ Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+ Java AJP Connector: /docs/config/ajp.html
+ APR (HTTP/AJP) Connector: /docs/apr.html
+ Define a non-SSL HTTP/1.1 Connector on port 8080
+ -->
+ <Connector port="{{http_port}}" protocol="HTTP/1.1"
+ connectionTimeout="{{connection_timeout}}" />
+ <!-- A "Connector" using the shared thread pool-->
+ <!--
+ <Connector executor="tomcatThreadPool"
+ port="8080" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8443" />
+ -->
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443
+ This connector uses the NIO implementation that requires the JSSE
+ style configuration. When using the APR/native implementation, the
+ OpenSSL style configuration is required as described in the APR/native
+ documentation -->
+ <!--
+ <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
+ maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port 8009 -->
+ <!--Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /-->
+
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host).
+ Documentation at /docs/config/engine.html -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
+ -->
+ <Engine name="Catalina" defaultHost="localhost">
+
+ <!--For clustering, please take a look at documentation at:
+ /docs/cluster-howto.html (simple how to)
+ /docs/config/cluster.html (reference documentation) -->
+ <!--
+ <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+ -->
+
+ <!-- Use the LockOutRealm to prevent attempts to guess user passwords
+ via a brute-force attack -->
+ <Realm className="org.apache.catalina.realm.LockOutRealm">
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase"/>
+ </Realm>
+
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true">
+
+ <!-- SingleSignOn valve, share authentication between web applications
+ Documentation at: /docs/config/valve.html -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+ -->
+
+ <!-- Access log processes all example.
+ Documentation at: /docs/config/valve.html
+ Note: The pattern used is equivalent to using pattern="common" -->
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ prefix="localhost_access_log" suffix=".txt"
+ pattern="%h %l %u %t "%r" %s %b" />
+
+ </Host>
+ </Engine>
+ </Service>
+</Server>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/package/templates/tomcat-users.xml.j2
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/package/templates/tomcat-users.xml.j2 b/app-packages/tomcat/package/templates/tomcat-users.xml.j2
new file mode 100644
index 0000000..1078a08
--- /dev/null
+++ b/app-packages/tomcat/package/templates/tomcat-users.xml.j2
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ 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.
+-->
+<tomcat-users xmlns="http://tomcat.apache.org/xml"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
+ version="1.0">
+<!--
+ NOTE: By default, no user is included in the "manager-gui" role required
+ to operate the "/manager/html" web application. If you wish to use this app,
+ you must define such a user - the username and password are arbitrary.
+-->
+<!--
+ NOTE: The sample user and role entries below are wrapped in a comment
+ and thus are ignored when reading this file. Do not forget to remove
+ <!.. ..> that surrounds them.
+-->
+
+ <role rolename="manager-gui"/>
+ <user username="{{ui_user}}" password="{{ui_password}}" roles="manager-gui"/>
+</tomcat-users>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/pom.xml b/app-packages/tomcat/pom.xml
new file mode 100644
index 0000000..4d3a718
--- /dev/null
+++ b/app-packages/tomcat/pom.xml
@@ -0,0 +1,241 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <!--
+ 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.
+-->
+ <parent>
+ <groupId>org.apache.slider.packages</groupId>
+ <artifactId>slider-app-packages</artifactId>
+ <version>0.91.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>slider-tomcat-app-package</artifactId>
+ <packaging>jar</packaging>
+ <name>Slider Tomcat App Package</name>
+ <description>Slider Tomcat App Package</description>
+
+ <properties>
+ <work.dir>package-tmp</work.dir>
+ <app.package.name>${project.artifactId}-${pkg.version}</app.package.name>
+ <pkg.src>${project.build.directory}/${work.dir}</pkg.src>
+ <pkg.version>${project.version}</pkg.version>
+ <pkg.name>tomcat-${tomcat.version}.tar.gz</pkg.name>
+ <!-- the following properties are used for testing -->
+ <slider.bin.dir>../../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir>
+ <test.app.pkg.dir>${project.build.directory}</test.app.pkg.dir>
+ <test-classes.dir>${project.build.directory}/test-classes</test-classes.dir>
+ <test.app.resources.dir>${project.build.directory}/test-config</test.app.resources.dir>
+ <test.client.install.dir>${project.build.directory}/${work.dir}</test.client.install.dir>
+ <!-- these properties are used in the default and the test appConfigs -->
+ <hadoop.dir>/usr/lib/hadoop</hadoop.dir>
+ <hdfs.dir>/usr/lib/hadoop-hdfs</hdfs.dir>
+ <yarn.dir>/usr/lib/hadoop-yarn</yarn.dir>
+ <mapred.dir>/usr/lib/hadoop-mapred</mapred.dir>
+ <zk.dir>/usr/lib/zookeeper</zk.dir>
+ <app.java.home>${java.home}</app.java.home>
+ <app.user>yarn</app.user>
+ <app.user.group>hadoop</app.user.group>
+
+ <tomcat.version>8.0.30</tomcat.version>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>hdp</id>
+ <properties>
+ <hadoop.dir>/usr/hdp/current/hadoop-client</hadoop.dir>
+ <hdfs.dir>/usr/hdp/current/hadoop-hdfs-client</hdfs.dir>
+ <yarn.dir>/usr/hdp/current/hadoop-yarn-client</yarn.dir>
+ <mapred.dir>/usr/hdp/current/hadoop-mapreduce-client</mapred.dir>
+ <zk.dir>/usr/hdp/current/zookeeper-client</zk.dir>
+ <slider.dir>/usr/hdp/current/slider-client</slider.dir>
+ </properties>
+ </profile>
+ <profile>
+ <id>tomcat-app-package</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven-assembly-plugin.version}</version>
+ <configuration>
+ <descriptor>src/assembly/tomcat.xml</descriptor>
+ <appendAssemblyId>false</appendAssemblyId>
+ <finalName>${app.package.name}</finalName>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build-app-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>tomcat-funtest</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>run-integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <systemPropertyVariables>
+ <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
+ <java.awt.headless>true</java.awt.headless>
+ <!-- this property must be supplied-->
+ <slider.conf.dir>${slider.conf.dir}</slider.conf.dir>
+ <slider.bin.dir>${slider.bin.dir}</slider.bin.dir>
+ <test.app.pkg.dir>${test.app.pkg.dir}</test.app.pkg.dir>
+ <test.app.pkg.file>${app.package.name}.zip</test.app.pkg.file>
+ <test.app.pkg.name>TOMCAT</test.app.pkg.name>
+ <test-classes.dir>${test-classes.dir}</test-classes.dir>
+ <test.app.resources.dir>${test.app.resources.dir}</test.app.resources.dir>
+ <test.client.install.dir>${test.client.install.dir}</test.client.install.dir>
+ <test.client.home.dir>${test.client.install.dir}/tomcat-${tomcat.version}</test.client.home.dir>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>rat</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>${apache-rat-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>check-licenses</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <excludes>
+ <exclude>**/*.json</exclude>
+ <exclude>src/test/resources/slider-test.war</exclude>
+ <exclude>**/*.iml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <!-- resources are filtered for dynamic updates. This gets build info in-->
+ <resources>
+ <resource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ <targetPath>${test.app.resources.dir}</targetPath>
+ </resource>
+ <resource>
+ <directory>.</directory>
+ <filtering>true</filtering>
+ <targetPath>${test.app.resources.dir}</targetPath>
+ <includes>
+ <include>appConfig-default.json</include>
+ <include>resources-default.json</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>${groovy-eclipse-compiler.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>${groovy-eclipse-batch.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat</artifactId>
+ <version>${tomcat.version}</version>
+ <type>tar.gz</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.slider</groupId>
+ <artifactId>slider-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.slider</groupId>
+ <artifactId>slider-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.slider</groupId>
+ <artifactId>slider-funtest</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/resources-default.json
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/resources-default.json b/app-packages/tomcat/resources-default.json
new file mode 100644
index 0000000..fde881c
--- /dev/null
+++ b/app-packages/tomcat/resources-default.json
@@ -0,0 +1,16 @@
+{
+ "schema" : "http://example.org/specification/v2.0.0",
+ "metadata" : {
+ },
+ "global" : {
+ },
+ "components": {
+ "slider-appmaster": {
+ },
+ "TOMCAT": {
+ "yarn.role.priority": "1",
+ "yarn.component.instances": "1",
+ "yarn.memory": "512"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/assembly/tomcat.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/assembly/tomcat.xml b/app-packages/tomcat/src/assembly/tomcat.xml
new file mode 100644
index 0000000..e3f0e72
--- /dev/null
+++ b/app-packages/tomcat/src/assembly/tomcat.xml
@@ -0,0 +1,78 @@
+<!--
+ ~ 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.
+ -->
+
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>tomcat_v${tomcat.version}</id>
+ <formats>
+ <format>zip</format>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <files>
+ <file>
+ <source>appConfig-default.json</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ </file>
+ <file>
+ <source>metainfo.xml</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ </file>
+ <file>
+ <source>resources-default.json</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ </file>
+ </files>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>package/files</outputDirectory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0644</fileMode>
+ <includes>
+ <include>org.apache.tomcat:tomcat:tar.gz</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>pom.xml</exclude>
+ <exclude>src/**</exclude>
+ <exclude>target/**</exclude>
+ <exclude>appConfig-default.json</exclude>
+ <exclude>metainfo.xml</exclude>
+ </excludes>
+ <fileMode>0755</fileMode>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ </fileSets>
+</assembly>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatAgentCommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatAgentCommandTestBase.groovy b/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatAgentCommandTestBase.groovy
new file mode 100644
index 0000000..fc96b04
--- /dev/null
+++ b/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatAgentCommandTestBase.groovy
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.slider.funtest.tomcat
+
+import groovy.util.logging.Slf4j
+import org.apache.slider.funtest.framework.AgentCommandTestBase
+import org.junit.After
+import org.junit.Before
+
+@Slf4j
+abstract class TomcatAgentCommandTestBase extends AgentCommandTestBase {
+ public static final int TOMCAT_LAUNCH_WAIT_TIME = 30 * 1000;
+
+ abstract public String getClusterName();
+
+ @Before
+ public void prepareCluster() {
+ setupCluster(getClusterName())
+ }
+
+ @After
+ public void destroyCluster() {
+ cleanup(getClusterName())
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatBasicIT.groovy
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatBasicIT.groovy b/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatBasicIT.groovy
new file mode 100644
index 0000000..d77897f
--- /dev/null
+++ b/app-packages/tomcat/src/test/groovy/org/apache/slider/funtest/tomcat/TomcatBasicIT.groovy
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+package org.apache.slider.funtest.tomcat
+
+import groovy.util.logging.Slf4j
+import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.fs.FileSystem
+import org.apache.hadoop.fs.FileUtil
+import org.apache.hadoop.fs.FileStatus
+import org.apache.hadoop.fs.Path
+import org.apache.hadoop.registry.client.types.ServiceRecord
+import org.apache.slider.api.ClusterDescription
+import org.apache.slider.client.SliderClient
+import org.apache.slider.common.SliderKeys
+import org.apache.slider.core.conf.ConfTree
+import org.apache.slider.core.persist.ConfTreeSerDeser
+import org.apache.slider.core.registry.docstore.PublishedConfiguration
+import org.apache.slider.core.registry.retrieve.RegistryRetriever
+import org.apache.slider.funtest.framework.SliderShell
+import org.apache.slider.providers.agent.AgentKeys
+
+import org.junit.Before
+import org.junit.Test
+
+import static org.apache.hadoop.registry.client.binding.RegistryUtils.currentUser
+import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath
+
+@Slf4j
+class TomcatBasicIT extends TomcatAgentCommandTestBase {
+ protected ConfTree tree
+
+ protected String getAppResource() {
+ return sysprop("test.app.resources.dir") + "/resources.json"
+ }
+
+ protected String templateName() {
+ return sysprop("test.app.resources.dir") + "/appConfig.json"
+ }
+
+ protected String getDefaultTemplate() {
+ return sysprop("test.app.resources.dir") + "/appConfig-default.json"
+ }
+
+ protected String getAppTemplate() {
+ String appTemplateFile = templateName()
+ Configuration conf = new Configuration()
+ FileSystem fs = FileSystem.getLocal(conf)
+ InputStream stream = new FileInputStream(getDefaultTemplate())
+ assert stream!=null, "Couldn't pull appConfig.json from app pkg"
+ ConfTreeSerDeser c = new ConfTreeSerDeser()
+ ConfTree t = c.fromStream(stream)
+ t = modifyTemplate(t)
+ log.info("Writing new template to {}", appTemplateFile)
+ c.save(fs, new Path(appTemplateFile), t, true)
+ return appTemplateFile
+ }
+
+ protected ConfTree modifyTemplate(ConfTree original) {
+ // Set our custom WAR file in the appConfig and load it to the "cluster" filesystem
+ Configuration conf = new Configuration()
+ FileSystem fs = FileSystem.getLocal(conf)
+ // The path from the local filesystem of the war (copied to target/test-classes from src/test/resources)
+ Path sourcePath = fs.makeQualified(new Path(sysprop("test-classes.dir") + "/slider-test.war"))
+ // Path in HDFS we'll put the WAR
+ Path targetPath = clusterFS.makeQualified(new Path("/tmp/slider-test.war"))
+ if (clusterFS.exists(targetPath)) {
+ log.info("Deleting {}", targetPath)
+ clusterFS.delete(targetPath, true)
+ }
+ log.info("Copying {} on {} to {} on {}", sourcePath, fs, targetPath, clusterFS)
+ // Copy the file
+ FileUtil.copy(fs, sourcePath, clusterFS, targetPath, false, true, clusterFS.getConf())
+ FileStatus fileStatus = clusterFS.getFileStatus(targetPath)
+ FileStatus origFileStatus = fs.getFileStatus(sourcePath)
+ assert origFileStatus.getLen() == fileStatus.getLen(), "Expected file length to be the same in both source and destination"
+
+ log.info("Setting {} to {} in appConfig.json", AgentKeys.APP_RESOURCES, targetPath.toString())
+ // Set that path in the appConfig
+ original.global.put(AgentKeys.APP_RESOURCES, targetPath.toString())
+
+ return original
+ }
+
+ @Override
+ public String getClusterName() {
+ return "test_tomcat_basic"
+ }
+
+ protected Map<String, Integer> getRoleMap() {
+ // must match the values in src/test/resources/resources.json
+ return [
+ "TOMCAT" : 1
+ ];
+ }
+
+ @Test
+ public void testTomcatClusterCreate() throws Throwable {
+
+ describe getDescription()
+
+ def path = buildClusterPath(getClusterName())
+ assert !clusterFS.exists(path)
+
+ SliderShell shell = createTemplatedSliderApplication(getClusterName(),
+ APP_TEMPLATE, APP_RESOURCE, [])
+
+ logShell(shell)
+
+ ensureApplicationIsUp(getClusterName())
+
+ //get a slider client against the cluster
+ SliderClient sliderClient = bondToCluster(SLIDER_CONFIG, getClusterName())
+ ClusterDescription cd = sliderClient.clusterDescription
+ assert getClusterName() == cd.name
+
+ log.info("Connected via Client {}", sliderClient.toString())
+
+ //wait for the role counts to be reached, containers to get launched
+ waitForRoleCount(sliderClient, getRoleMap(), TOMCAT_LAUNCH_WAIT_TIME)
+
+ // Wait for Tomcat itself to boot
+ sleep(TOMCAT_LAUNCH_WAIT_TIME);
+
+ clusterLoadOperations(cd, sliderClient)
+ }
+
+
+ public String getDescription() {
+ return "Create a working Tomcat cluster $clusterName"
+ }
+
+ public static PublishedConfiguration getExport(SliderClient sliderClient,
+ String clusterName,
+ String exportName) {
+ String path = servicePath(currentUser(),
+ SliderKeys.APP_TYPE,
+ clusterName);
+ ServiceRecord instance = sliderClient.resolve(path)
+ RegistryRetriever retriever = new RegistryRetriever(
+ sliderClient.config,
+ instance)
+ PublishedConfiguration configuration = retriever.retrieveConfiguration(
+ retriever.getConfigurations(true), exportName, true)
+ return configuration
+ }
+
+ /**
+ * Override point for any cluster load operations
+ */
+ public void clusterLoadOperations(ClusterDescription cd, SliderClient sliderClient) {
+ String httpAddress = getHttpAddress(sliderClient, getClusterName())
+ assert httpAddress.startsWith("http://"), "Tomcat HTTP URL didn't have expected protocol"
+ checkHttpAddress(httpAddress)
+ }
+
+ /**
+ * Attempt to fetch the published Tomcat webserver address from the quicklinks.
+ */
+ public static String getHttpAddress(SliderClient sliderClient, String clusterName) {
+ int tries = 5
+ Exception caught;
+ while (true) {
+ try {
+ PublishedConfiguration configuration = getExport(sliderClient,
+ clusterName, "quicklinks")
+
+ // must match name set in metainfo.xml
+ String httpAddress = configuration.entries.get("HTTP")
+ assertNotNull httpAddress
+ log.info("Got exported server address: '{}'", httpAddress)
+ return httpAddress
+ } catch (Exception e) {
+ caught = e;
+ log.info("Got exception trying to read quicklinks")
+ if (tries-- == 0) {
+ break
+ }
+ sleep(20000)
+ }
+ }
+ throw caught;
+ }
+
+ /**
+ * Validate the URL for the Tomcat server, checking deployed web content.
+ */
+ public static void checkHttpAddress(String serverAddress) {
+ // Check the Tomcat manager webapp
+ String page = fetchWebPageRaisedErrorCodes(serverAddress);
+ assert page != null, "Tomcat manager page null"
+ assert page.length() > 100, "Tomcat manager page too short"
+ assert page.contains("Apache Tomcat"), "Tomcat monitor page didn't contain expected text"
+
+ // Check our test war we deployed too
+ page = fetchWebPageRaisedErrorCodes(serverAddress + '/slider-test');
+ assert page != null, "Could not fetch auto-deployed webapp"
+ // The custom war file will return a plain-text response of "Success" for "/"
+ assert page == "Success", "Did not find the expected content produced by the webapp"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/java/org/apache/slider/funtest/tomcat/StubToForceGroovyTestsToCompile.java
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/java/org/apache/slider/funtest/tomcat/StubToForceGroovyTestsToCompile.java b/app-packages/tomcat/src/test/java/org/apache/slider/funtest/tomcat/StubToForceGroovyTestsToCompile.java
new file mode 100644
index 0000000..5944984
--- /dev/null
+++ b/app-packages/tomcat/src/test/java/org/apache/slider/funtest/tomcat/StubToForceGroovyTestsToCompile.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+package org.apache.slider.funtest.tomcat;
+
+public class StubToForceGroovyTestsToCompile {
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/resources/appConfig-default.json
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/resources/appConfig-default.json b/app-packages/tomcat/src/test/resources/appConfig-default.json
new file mode 100644
index 0000000..009838c
--- /dev/null
+++ b/app-packages/tomcat/src/test/resources/appConfig-default.json
@@ -0,0 +1,23 @@
+{
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": {
+ },
+ "global": {
+ "application.def": ".slider/package/tomcat/slider-tomcat-app-package.zip",
+ "java_home": "/usr/jdk64/jdk1.7.0_67",
+ "application.resources": "hdfs://localhost:8020/user/jelser/my_application.war",
+
+ "site.global.xmx_val": "1g",
+ "site.global.xms_val": "128m",
+ "site.global.memory_val": "200M",
+ "site.server-xml.http.port":"${TOMCAT.ALLOCATED_PORT}",
+ "site.server-xml.connection.timeout":"20000",
+ "site.tomcat-users-xml.ui.user": "tomcat",
+ "site.tomcat-users-xml.ui.password": "password"
+ },
+ "components": {
+ "slider-appmaster": {
+ "jvm.heapsize": "128M"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/resources/resources.json
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/resources/resources.json b/app-packages/tomcat/src/test/resources/resources.json
new file mode 100644
index 0000000..fde881c
--- /dev/null
+++ b/app-packages/tomcat/src/test/resources/resources.json
@@ -0,0 +1,16 @@
+{
+ "schema" : "http://example.org/specification/v2.0.0",
+ "metadata" : {
+ },
+ "global" : {
+ },
+ "components": {
+ "slider-appmaster": {
+ },
+ "TOMCAT": {
+ "yarn.role.priority": "1",
+ "yarn.component.instances": "1",
+ "yarn.memory": "512"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/app-packages/tomcat/src/test/resources/slider-test.war
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/src/test/resources/slider-test.war b/app-packages/tomcat/src/test/resources/slider-test.war
new file mode 100644
index 0000000..7410435
Binary files /dev/null and b/app-packages/tomcat/src/test/resources/slider-test.war differ
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
index 710ced1..5ea95df 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
@@ -73,6 +73,9 @@ public interface AgentKeys {
String AGENT_CONF = "agent.conf";
String ADDON_FOR_ALL_COMPONENTS = "ALL";
+ String APP_RESOURCES = "application.resources";
+ String APP_RESOURCES_DIR = "app/resources";
+
String AGENT_INSTALL_DIR = "infra/agent";
String APP_DEFINITION_DIR = "app/definition";
String ADDON_DEFINITION_DIR = "addon/definition";
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/dd121b18/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
index 7e3e87b..cc089d0 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
@@ -507,6 +507,26 @@ public class AgentProviderService extends AbstractProviderService implements
packageMetainfo.toString());
}
+ // Additional files to localize in addition to the application def
+ String appResourcesString = instanceDefinition.getAppConfOperations()
+ .getGlobalOptions().getOption(AgentKeys.APP_RESOURCES, null);
+ log.info("Configuration value for extra resources to localize: {}", appResourcesString);
+ if (null != appResourcesString) {
+ try (Scanner scanner = new Scanner(appResourcesString).useDelimiter(",")) {
+ while (scanner.hasNext()) {
+ String resource = scanner.next();
+ Path resourcePath = new Path(resource);
+ LocalResource extraResource = fileSystem.createAmResource(
+ fileSystem.getFileSystem().resolvePath(resourcePath),
+ LocalResourceType.FILE);
+ String destination = AgentKeys.APP_RESOURCES_DIR + "/" + resourcePath.getName();
+ log.info("Localizing {} to {}", resourcePath, destination);
+ // TODO Can we try harder to avoid collisions?
+ launcher.addLocalResource(destination, extraResource);
+ }
+ }
+ }
+
// initialize addon pkg states for all componentInstanceStatus
Map<String, State> pkgStatuses = new TreeMap<>();
for (Metainfo appPkg : packageMetainfo.values()) {
[5/5] incubator-slider git commit: SLIDER-1042 Use the correct
cluster name when fetching the description
Posted by el...@apache.org.
SLIDER-1042 Use the correct cluster name when fetching the description
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/268cdbf1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/268cdbf1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/268cdbf1
Branch: refs/heads/develop
Commit: 268cdbf1515ba39f7df6dd72cd9f44af3f91985b
Parents: d5b3669
Author: Josh Elser <el...@apache.org>
Authored: Wed Dec 30 19:40:57 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Dec 30 19:41:39 2015 -0500
----------------------------------------------------------------------
.../org/apache/slider/providers/agent/TestBuildBasicAgent.groovy | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/268cdbf1/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
index 60e9035..2a255c7 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
@@ -139,7 +139,7 @@ class TestBuildBasicAgent extends AgentTestBase {
true, false,
false)
def instanceD = launcher.service.loadPersistedClusterDescription(
- clustername)
+ cluster02)
dumpClusterDescription("$clustername:", instanceD)
def resource = instanceD.getResourceOperations()
[3/5] incubator-slider git commit: SLIDER-1012 Modify server and
quicklinks for Tomcat (fengyongshe)
Posted by el...@apache.org.
SLIDER-1012 Modify server and quicklinks for Tomcat (fengyongshe)
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c5f7ff94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c5f7ff94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c5f7ff94
Branch: refs/heads/develop
Commit: c5f7ff9414cc59899fa9f6061fcdb1c1c3816441
Parents: dd121b1
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 29 20:33:32 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Dec 30 16:20:58 2015 -0500
----------------------------------------------------------------------
app-packages/tomcat/metainfo.xml | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c5f7ff94/app-packages/tomcat/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/metainfo.xml b/app-packages/tomcat/metainfo.xml
index 714bfa4..bdecda5 100644
--- a/app-packages/tomcat/metainfo.xml
+++ b/app-packages/tomcat/metainfo.xml
@@ -32,18 +32,39 @@
</export>
</exports>
</exportGroup>
+ <exportGroup>
+ <name>QuickLinks</name>
+ <exports>
+ <export>
+ <name>HTTP</name>
+ <value>http://${TOMCAT_HOST}:${site.server-xml.http.port}</value>
+ </export>
+ </exports>
+ </exportGroup>
</exportGroups>
+
<components>
<component>
<name>TOMCAT</name>
<category>MASTER</category>
- <compExports>Servers-host_port</compExports>
+ <appExports>Servers-tomcat.http_port,QuickLinks-HTTP</appExports>
+ <componentExports>
+ <componentExport>
+ <name>tomcat.http.port</name>
+ <value>${TOMCAT_HOST}:${site.server-xml.http.port}</value>
+ </componentExport>
+ <componentExport>
+ <name>HTTP</name>
+ <value>http://${TOMCAT_HOST}:${site.global.listen_port}</value>
+ </componentExport>
+ </componentExports>
<commandScript>
<script>scripts/tomcat.py</script>
<scriptType>PYTHON</scriptType>
</commandScript>
</component>
</components>
+
<osSpecifics>
<osSpecific>
<osType>any</osType>
@@ -56,18 +77,6 @@
</osSpecific>
</osSpecifics>
- <exportGroups>
- <exportGroup>
- <name>QuickLinks</name>
- <exports>
- <export>
- <name>HTTP</name>
- <value>http://${TOMCAT_HOST}:${site.global.listen_port}</value>
- </export>
- </exports>
- </exportGroup>
- </exportGroups>
-
<configFiles>
<configFile>
<type>env</type>
[2/5] incubator-slider git commit: SLIDER-1040 Better formatting on
the AM's web ui.
Posted by el...@apache.org.
SLIDER-1040 Better formatting on the AM's web ui.
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/92484311
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/92484311
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/92484311
Branch: refs/heads/develop
Commit: 924843114b7c0d194e762c4f7a3314e99abbfe7b
Parents: c5f7ff9
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 29 20:34:34 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Dec 30 16:20:58 2015 -0500
----------------------------------------------------------------------
.../providers/AbstractProviderService.java | 8 ++--
.../apache/slider/providers/MonitorDetail.java | 43 ++++++++++++++++++++
.../slider/providers/ProviderService.java | 4 +-
.../providers/agent/AgentProviderService.java | 12 +++---
.../server/appmaster/web/view/IndexBlock.java | 20 ++++++---
.../src/main/resources/webapps/static/yarn.css | 4 +-
6 files changed, 73 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
index c701a55..61b2655 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
@@ -335,8 +335,8 @@ public abstract class AbstractProviderService
in the external view
*/
@Override
- public Map<String, String> buildMonitorDetails(ClusterDescription clusterDesc) {
- Map<String, String> details = new LinkedHashMap<String, String>();
+ public Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterDesc) {
+ Map<String, MonitorDetail> details = new LinkedHashMap<String, MonitorDetail>();
// add in all the endpoints
buildEndpointDetails(details);
@@ -345,7 +345,7 @@ public abstract class AbstractProviderService
}
@Override
- public void buildEndpointDetails(Map<String, String> details) {
+ public void buildEndpointDetails(Map<String, MonitorDetail> details) {
ServiceRecord self = yarnRegistry.getSelfRegistration();
List<Endpoint> externals = self.external;
@@ -355,7 +355,7 @@ public abstract class AbstractProviderService
try {
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint);
if (!urls.isEmpty()) {
- details.put(endpoint.api, urls.get(0).toString());
+ details.put(endpoint.api, new MonitorDetail(urls.get(0).toString(), true));
}
} catch (InvalidRecordException | MalformedURLException ignored) {
// Ignored
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java b/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
new file mode 100644
index 0000000..27d3415
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.apache.slider.providers;
+
+/**
+ * Details about some exported information from a provider to the AM web UI.
+ */
+public class MonitorDetail {
+
+ private final String value;
+ private final boolean isUrl;
+
+ public MonitorDetail(String value, boolean isUrl) {
+ this.value = value;
+ this.isUrl = isUrl;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public boolean isUrl() {
+ return isUrl;
+ }
+
+ public String toString() {
+ return "MonitorDetail[" + value + " isUrl=" + isUrl + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
index 1a18db6..4689ae8 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
@@ -154,7 +154,7 @@ public interface ProviderService extends ProviderCore,
* If no anchor is needed/desired, insert the key with a null value.
* @return the details
*/
- Map<String, String> buildMonitorDetails(ClusterDescription clusterSpec);
+ Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterSpec);
/**
* Get a human friendly name for web UIs and messages
@@ -182,7 +182,7 @@ public interface ProviderService extends ProviderCore,
* Build up the endpoint details for this service
* @param details
*/
- void buildEndpointDetails(Map<String, String> details);
+ void buildEndpointDetails(Map<String, MonitorDetail> details);
/**
* Prior to going live -register the initial service registry data
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
index cc089d0..0a1a98f 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
@@ -62,6 +62,7 @@ import org.apache.slider.core.registry.docstore.PublishedConfiguration;
import org.apache.slider.core.registry.docstore.PublishedExports;
import org.apache.slider.core.registry.info.CustomRegistryConstants;
import org.apache.slider.providers.AbstractProviderService;
+import org.apache.slider.providers.MonitorDetail;
import org.apache.slider.providers.ProviderCore;
import org.apache.slider.providers.ProviderRole;
import org.apache.slider.providers.ProviderUtils;
@@ -1135,8 +1136,8 @@ public class AgentProviderService extends AbstractProviderService implements
}
@Override
- public Map<String, String> buildMonitorDetails(ClusterDescription clusterDesc) {
- Map<String, String> details = super.buildMonitorDetails(clusterDesc);
+ public Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterDesc) {
+ Map<String, MonitorDetail> details = super.buildMonitorDetails(clusterDesc);
buildRoleHostDetails(details);
return details;
}
@@ -2848,12 +2849,11 @@ public class AgentProviderService extends AbstractProviderService implements
}
}
- private void buildRoleHostDetails(Map<String, String> details) {
+ private void buildRoleHostDetails(Map<String, MonitorDetail> details) {
for (Map.Entry<String, Map<String, ClusterNode>> entry :
getRoleClusterNodeMapping().entrySet()) {
- details.put(entry.getKey() + " Host(s)/Container(s): " +
- getHostsList(entry.getValue().values(), false),
- "");
+ details.put(entry.getKey() + " Host(s)/Container(s)",
+ new MonitorDetail(getHostsList(entry.getValue().values(), false).toString(), false));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
index b3be3bf..e118896 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
@@ -20,12 +20,14 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.UL;
import org.apache.slider.api.ClusterDescription;
import org.apache.slider.api.StatusKeys;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.RoleStatistics;
import org.apache.slider.common.tools.SliderUtils;
+import org.apache.slider.providers.MonitorDetail;
import org.apache.slider.providers.ProviderService;
import org.apache.slider.server.appmaster.state.RoleStatus;
import org.apache.slider.server.appmaster.web.WebAppApi;
@@ -249,16 +251,24 @@ public class IndexBlock extends SliderHamletBlock {
protected void addProviderServiceOptions(ProviderService provider,
UL ul, ClusterDescription clusterStatus) {
- Map<String, String> details = provider.buildMonitorDetails(
+ Map<String, MonitorDetail> details = provider.buildMonitorDetails(
clusterStatus);
if (null == details) {
return;
}
// Loop over each entry, placing the text in the UL, adding an anchor when the URL is non-null/empty
- for (Entry<String, String> entry : details.entrySet()) {
- String url = entry.getValue();
- if (SliderUtils.isSet(url) ) {
- ul.li()._(entry.getKey()).a(url, url)._();
+ for (Entry<String, MonitorDetail> entry : details.entrySet()) {
+ MonitorDetail detail = entry.getValue();
+ if (SliderUtils.isSet(detail.getValue()) ) {
+ LI item = ul.li();
+ item.span().$class("bold")._(entry.getKey())._();
+ item._(" - ");
+ if (detail.isUrl()) {
+ // Render an anchor if the value is a URL
+ item.a(detail.getValue(), detail.getValue())._();
+ } else {
+ item._(detail.getValue())._();
+ }
} else {
ul.li(entry.getKey());
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/92484311/slider-core/src/main/resources/webapps/static/yarn.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/yarn.css b/slider-core/src/main/resources/webapps/static/yarn.css
index ba12acb..1e9ca94 100644
--- a/slider-core/src/main/resources/webapps/static/yarn.css
+++ b/slider-core/src/main/resources/webapps/static/yarn.css
@@ -58,6 +58,8 @@ div.role-options-wrap table { margin-left: 0.5em; }
h1.index_header { margin-bottom: 15px; }
div.general_info { margin-bottom: 15px; }
-div.provder_info { margin-bottom: 15px; }
+div.container_instances { margin-bottom: 15px; }
+div.diagnostics { margin-bottom: 15px; }
+div.provider_info { margin-bottom: 15px; }
div.cluster_json pre { white-space: pre-wrap; }
[4/5] incubator-slider git commit: SLIDER-1041 Fix consistency for
exports, enumerate all exports on HTML index.
Posted by el...@apache.org.
SLIDER-1041 Fix consistency for exports, enumerate all exports on HTML index.
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/d5b3669b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/d5b3669b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/d5b3669b
Branch: refs/heads/develop
Commit: d5b3669b6e36c7bc02a1045133310bc5ffb0c0ea
Parents: 9248431
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 29 22:18:15 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Dec 30 16:20:59 2015 -0500
----------------------------------------------------------------------
.../web/rest/publisher/PublisherResource.java | 3 +--
.../server/appmaster/web/view/IndexBlock.java | 28 +++++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d5b3669b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
index 58d6a8e..c727581 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
@@ -132,8 +132,7 @@ public class PublisherResource extends AbstractSliderResource {
@Produces({MediaType.APPLICATION_JSON})
public PublishedExportsSet gePublishedExports() {
- PublishedExportsSet set = appState.getPublishedExportsSet();
- return set.shallowCopy();
+ return appState.getPublishedExportsSet();
}
@GET
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d5b3669b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
index e118896..c3b9b6f 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
@@ -27,6 +27,9 @@ import org.apache.slider.api.StatusKeys;
import org.apache.slider.api.types.ApplicationLivenessInformation;
import org.apache.slider.api.types.RoleStatistics;
import org.apache.slider.common.tools.SliderUtils;
+import org.apache.slider.core.registry.docstore.ExportEntry;
+import org.apache.slider.core.registry.docstore.PublishedExports;
+import org.apache.slider.core.registry.docstore.PublishedExportsSet;
import org.apache.slider.providers.MonitorDetail;
import org.apache.slider.providers.ProviderService;
import org.apache.slider.server.appmaster.state.RoleStatus;
@@ -218,6 +221,13 @@ public class IndexBlock extends SliderHamletBlock {
addProviderServiceOptions(providerService, ul, clusterStatus);
ul._();
provider_info._();
+
+ DIV<Hamlet> exports = html.div("exports");
+ exports.h3("Exports");
+ ul = html.ul();
+ enumeratePublishedExports(appState.getPublishedExportsSet(), ul);
+ ul._();
+ exports._();
}
@VisibleForTesting
@@ -275,5 +285,21 @@ public class IndexBlock extends SliderHamletBlock {
}
}
-
+ protected void enumeratePublishedExports(PublishedExportsSet exports, UL<Hamlet> ul) {
+ for(String key : exports.keys()) {
+ PublishedExports export = exports.get(key);
+ LI<UL<Hamlet>> item = ul.li();
+ item.span().$class("bold")._(export.description)._();
+ UL sublist = item.ul();
+ for (Entry<String, List<ExportEntry>> entry : export.entries.entrySet()) {
+ LI sublistItem = sublist.li()._(entry.getKey());
+ for (ExportEntry exportEntry : entry.getValue()) {
+ sublistItem._(exportEntry.getValue());
+ }
+ sublistItem._();
+ }
+ sublist._();
+ item._();
+ }
+ }
}