Browse Source

AMBARI-8869. Include AMS debian packages in Ambari build. (swagle, dsen via swagle)

Siddharth Wagle 10 năm trước cách đây
mục cha
commit
e6cdb06bc7

+ 282 - 4
ambari-metrics/ambari-metrics-assembly/pom.xml

@@ -36,6 +36,10 @@
     <hadoop-sink.dir>${project.basedir}/../ambari-metrics-hadoop-sink</hadoop-sink.dir>
     <storm-sink.dir>${project.basedir}/../ambari-metrics-storm-sink</storm-sink.dir>
     <flume-sink.dir>${project.basedir}/../ambari-metrics-flume-sink</flume-sink.dir>
+    <python.ver>python &gt;= 2.6</python.ver>
+    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
+    <deb.architecture>amd64</deb.architecture>
+    <deb.dependency.list>${deb.python.ver},python-dev,gcc</deb.dependency.list>
   </properties>
 
   <build>
@@ -96,7 +100,6 @@
     </plugins>
   </build>
 
-
   <profiles>
     <profile>
       <id>rpm</id>
@@ -455,12 +458,287 @@
                   </mappings>
                 </configuration>
               </execution>
-
-
-
             </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>deb</id>
 
+      <activation>
+        <property>
+          <name>build-deb</name>
+        </property>
+      </activation>
 
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>jdeb</artifactId>
+            <groupId>org.vafer</groupId>
+            <version>1.0.1</version>
+            <executions>
+              <execution>
+                <!-- unbinds rpm creation from maven lifecycle -->
+                <phase>package</phase>
+                <goals>
+                  <goal>jdeb</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <controlDir>${basedir}/src/main/package/deb/control</controlDir>
+              <deb>${basedir}/target/${artifactId}_${package-version}-${package-release}.deb</deb>
+              <dataSet>
+                <data>
+                  <type>file</type>
+                  <src>${monitor.dir}/src/main/python/__init__.py</src>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>${resmonitor.install.dir}</prefix>
+                    <!-- TODO: Figure out if file perms should be set -->
+                    <!--user>root</user>
+                    <group>root</group-->
+                    <filemode>755</filemode>
+                  </mapper>
+                </data>
+                <data>
+                  <type>file</type>
+                  <src>${monitor.dir}/src/main/python/main.py</src>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>${resmonitor.install.dir}</prefix>
+                    <filemode>755</filemode>
+                  </mapper>
+                </data>
+                <data>
+                  <type>directory</type>
+                  <src>${monitor.dir}/src/main/python/core</src>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>${resmonitor.install.dir}/core</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <type>directory</type>
+                  <src>${monitor.dir}/src/main/python/psutil</src>
+                  <excludes>build/**</excludes>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>${resmonitor.install.dir}/psutil</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <type>template</type>
+                  <paths>
+                    <path>/var/run/ambari-metrics-monitor</path>
+                    <path>/var/log/ambari-metrics-monitor</path>
+                    <path>/etc/ambari-metrics-monitor/conf</path>
+                    <path>/usr/lib/ambari-metrics-collector</path>
+                    <path>/etc/ambari-metrics-collector/conf</path>
+                    <path>/etc/ams-hbase/conf</path>
+                    <path>/var/run/ambari-metrics-collector</path>
+                    <path>/var/run/ams-hbase</path>
+                    <path>/var/log/ambari-metrics-collector</path>
+                    <path>/var/lib/ambari-metrics-collector</path>
+                    <path>/usr/lib/ambari-metrics-hadoop-sink</path>
+                    <path>/usr/lib/flume/lib</path>
+                    <path>/usr/lib/storm/lib</path>
+                  </paths>
+                </data>
+                <data>
+                  <src>${monitor.dir}/conf/unix/metric_groups.conf</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>/etc/ambari-metrics-monitor/conf</prefix>
+                    <filemode>644</filemode>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${monitor.dir}/conf/unix/metric_monitor.ini</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>/etc/ambari-metrics-monitor/conf</prefix>
+                    <filemode>644</filemode>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${monitor.dir}/conf/unix/ambari-metrics-monitor</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>/usr/sbin</prefix>
+                    <filemode>755</filemode>
+                  </mapper>
+                </data>
+
+                <!-- Metric collector -->
+
+                <data>
+                  <src>${collector.dir}/target/ambari-metrics-timelineservice-${project.version}.jar</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <dirmode>644</dirmode>
+                    <prefix>/usr/lib/ambari-metrics-collector</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/target/lib</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/usr/lib/ambari-metrics-collector</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/target/embedded/${hbase.folder}</src>
+                  <type>directory</type>
+                  <excludes>bin/**,bin/*</excludes>
+                  <mapper>
+                    <type>perm</type>
+                    <prefix>/usr/lib/ams-hbase</prefix>
+                    <filemode>644</filemode>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/target/embedded/${hbase.folder}/bin</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/usr/lib/ams-hbase/bin</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/target/lib</src>
+                  <type>directory</type>
+                  <includes>phoenix*.jar,antlr*.jar</includes>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/usr/lib/ams-hbase/lib</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/conf/unix/ambari-metrics-collector</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/usr/sbin</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/conf/unix/ams-env.sh</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/etc/ambari-metrics-collector/conf</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/conf/unix/ams-site.xml</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/etc/ambari-metrics-collector/conf</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/conf/unix/log4j.properties</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/etc/ambari-metrics-collector/conf</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${collector.dir}/target/embedded/${hbase.folder}/conf/hbase-site.xml</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/etc/ambari-metrics-collector/conf</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <type>directory</type>
+                  <src>${collector.dir}/target/embedded/${hbase.folder}/conf</src>
+                  <mapper>
+                    <type>perm</type>
+                    <dirmode>755</dirmode>
+                    <filemode>644</filemode>
+                    <prefix>/etc/ams-hbase/conf</prefix>
+                  </mapper>
+                </data>
+
+                <!-- hadoop sink -->
+
+                <data>
+                  <src>${hadoop-sink.dir}/target/ambari-metrics-hadoop-sink-with-common-${project.version}.jar</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <dirmode>755</dirmode>
+                    <prefix>/usr/lib/ambari-metrics-hadoop-sink</prefix>
+                  </mapper>
+                </data>
+
+                <!-- flume sink -->
+
+                <data>
+                  <src>${flume-sink.dir}/target/ambari-metrics-flume-sink-${project.version}.jar</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <dirmode>755</dirmode>
+                    <prefix>/usr/lib/flume/lib</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${flume-sink.dir}/target/lib</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/usr/lib/flume/lib</prefix>
+                  </mapper>
+                </data>
+
+                <!-- storm sink -->
+
+                <data>
+                  <src>${storm-sink.dir}/target/ambari-metrics-storm-sink-${project.version}.jar</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <dirmode>755</dirmode>
+                    <prefix>/usr/lib/storm/lib</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${storm-sink.dir}/target/lib</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/usr/lib/storm/lib</prefix>
+                  </mapper>
+                </data>
+
+              </dataSet>
+            </configuration>
           </plugin>
         </plugins>
       </build>

+ 22 - 0
ambari-metrics/ambari-metrics-assembly/src/main/package/deb/control/control

@@ -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: [[artifactId]]
+Version: [[package-version]]-[[package-release]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Depends: [[deb.dependency.list]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 24 - 0
ambari-metrics/ambari-metrics-assembly/src/main/package/deb/control/postinst

@@ -0,0 +1,24 @@
+#!/bin/sh
+# 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
+
+LINK_NAME="/usr/lib/ambari-metrics-hadoop-sink/ambari-metrics-hadoop-sink.jar"
+JAR_NAME="/usr/lib/ambari-metrics-hadoop-sink/${sinkJarName}"
+
+if [ -e "$LINK_NAME" ]; then
+  rm -f $LINK_NAME
+fi
+
+ln -s $JAR_NAME $LINK_NAME

+ 28 - 0
ambari-metrics/ambari-metrics-assembly/src/main/package/deb/control/prerm

@@ -0,0 +1,28 @@
+# 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
+
+# WARNING: This script is performed not only on uninstall, but also
+# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/
+# for details
+
+RESOURCE_MONITORING_DIR=/usr/lib/python2.6/site-packages/resource_monitoring
+PSUTIL_DIR="${RESOURCE_MONITORING_DIR}/psutil"
+
+
+if [ -d "${PSUTIL_DIR}" ]; then
+  rm -rf "${PSUTIL_DIR}/*"
+fi
+
+exit 0

+ 0 - 42
ambari-metrics/ambari-metrics-hadoop-sink/pom.xml

@@ -99,48 +99,6 @@ limitations under the License.
           </execution>
         </executions>
       </plugin>
-      <!--<plugin>-->
-        <!--<groupId>org.codehaus.mojo</groupId>-->
-        <!--<artifactId>rpm-maven-plugin</artifactId>-->
-        <!--<version>2.0.1</version>-->
-        <!--<executions>-->
-          <!--<execution>-->
-            <!--<phase>none</phase>-->
-            <!--<goals>-->
-              <!--<goal>rpm</goal>-->
-            <!--</goals>-->
-          <!--</execution>-->
-        <!--</executions>-->
-        <!--<configuration>-->
-          <!--<name>ambari-metrics-hadoop-sink</name>-->
-          <!--<copyright>2012, Apache Software Foundation</copyright>-->
-          <!--<group>Development</group>-->
-          <!--<description>Maven Recipe: RPM Package.</description>-->
-
-          <!--<defaultDirmode>755</defaultDirmode>-->
-          <!--<defaultFilemode>644</defaultFilemode>-->
-          <!--<defaultUsername>root</defaultUsername>-->
-          <!--<defaultGroupname>root</defaultGroupname>-->
-
-          <!--<postinstallScriptlet>-->
-            <!--<scriptFile>${project.build.outputDirectory}/rpm/postinstall.sh</scriptFile>-->
-            <!--<fileEncoding>utf-8</fileEncoding>-->
-          <!--</postinstallScriptlet>-->
-
-          <!--<mappings>-->
-            <!--<mapping>-->
-              <!--<directory>/usr/lib/ambari-metrics-hadoop-sink</directory>-->
-              <!--<sources>-->
-                <!--<source>-->
-                  <!--<location>target/${project.artifactId}-with-common-${project.version}.jar</location>-->
-                <!--</source>-->
-              <!--</sources>-->
-
-            <!--</mapping>-->
-
-          <!--</mappings>-->
-        <!--</configuration>-->
-      <!--</plugin>-->
     </plugins>
 
     <resources>

+ 1 - 1
ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor

@@ -73,7 +73,7 @@ if [ ! "$(ls -A ${RESOURCE_MONITORING_DIR}/psutil/build)" ]; then
   echo "Building psutil..."
   dir=$(pwd)
   cd "${RESOURCE_MONITORING_DIR}/psutil"
-  ${PYTHON} "build.py"
+  ${PYTHON} "setup.py" "install"
   cd "${dir}"
 else
   echo "psutil build directory is not empty, continuing..."

+ 6 - 2
ambari-metrics/pom.xml

@@ -39,7 +39,9 @@
     <python.ver>python &gt;= 2.6</python.ver>
     <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
     <!--TODO change to HDP URL-->
-    <hbase.tar>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz</hbase.tar>
+    <hbase.tar>
+      http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz
+    </hbase.tar>
     <hbase.folder>hbase-0.98.4.2.2.0.0-2041-hadoop2</hbase.folder>
     <resmonitor.install.dir>
       /usr/lib/python2.6/site-packages/resource_monitoring
@@ -116,7 +118,9 @@
             <configuration>
               <name>package-release</name>
               <value>${project.version}</value>
-              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-)(([0-9]+)|(SNAPSHOT)).*</regex>
+              <regex>
+                ^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-)(([0-9]+)|(SNAPSHOT)).*
+              </regex>
               <replacement>$5</replacement>
               <failIfNoMatch>true</failIfNoMatch>
             </configuration>

+ 12 - 1
ambari-server/src/main/resources/common-services/AMS/0.1.0/metainfo.xml

@@ -65,7 +65,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>any</osFamily>
+          <osFamily>redhat5,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>ambari-metrics-collector</name>
@@ -78,6 +78,17 @@
             </package>
           </packages>
         </osSpecific>
+        <osSpecific>
+          <osFamily>ubuntu12</osFamily>
+          <packages>
+            <package>
+              <name>ambari-metrics-assembly</name>
+            </package>
+            <package>
+              <name>hadoop-2-2-.*</name>
+            </package>
+          </packages>
+        </osSpecific>
       </osSpecifics>
 
       <commandScript>