AMBARI-21024. Support rpm/deb build for ambari-infra-manager (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b97d268a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b97d268a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b97d268a Branch: refs/heads/branch-feature-AMBARI-12556 Commit: b97d268a1920c833fd8c7e94921a9148f7d2c398 Parents: e54252c Author: oleewere <[email protected]> Authored: Mon May 15 16:43:10 2017 +0200 Committer: oleewere <[email protected]> Committed: Tue May 16 11:46:18 2017 +0200 ---------------------------------------------------------------------- ambari-infra/ambari-infra-assembly/pom.xml | 89 ++++++++++++++++++++ .../src/main/package/deb/manager/control | 22 +++++ .../src/main/package/deb/manager/postinst | 15 ++++ .../src/main/package/deb/manager/postrm | 15 ++++ .../src/main/package/deb/manager/preinst | 15 ++++ .../src/main/package/deb/manager/prerm | 15 ++++ ambari-infra/ambari-infra-manager/build.xml | 53 ++++++++++++ ambari-infra/ambari-infra-manager/pom.xml | 43 +++++++++- .../org/apache/ambari/infra/InfraManager.java | 1 - .../conf/batch/InfraManagerBatchConfig.java | 2 +- .../src/main/resources/infraManager.sh | 20 +++++ 11 files changed, 287 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/pom.xml b/ambari-infra/ambari-infra-assembly/pom.xml index 51e5804..550d97c 100644 --- a/ambari-infra/ambari-infra-assembly/pom.xml +++ b/ambari-infra/ambari-infra-assembly/pom.xml @@ -38,6 +38,10 @@ <solr.client.mapping.path>${mapping.base.path}/${solr.client.package.name}</solr.client.mapping.path> <solr.client.dir>${project.basedir}/../ambari-infra-solr-client</solr.client.dir> <infra.solr.plugin.dir>${project.basedir}/../ambari-infra-solr-plugin</infra.solr.plugin.dir> + <infra-manager.package.name>ambari-infra-manager</infra-manager.package.name> + <infra-manager.dir>${project.basedir}/../ambari-infra-manager</infra-manager.dir> + <infra-manager.mapping.path>${mapping.base.path}/${infra-manager.package.name}</infra-manager.mapping.path> + <infra-manager.conf.mapping.path>/etc/${infra-manager.package.name}/conf</infra-manager.conf.mapping.path> </properties> <profiles> @@ -118,6 +122,43 @@ </mappings> </configuration> </execution> + <execution> + <id>infra-manager</id> + <phase>package</phase> + <goals> + <goal>rpm</goal> + </goals> + <configuration> + <group>Development</group> + <name>${infra-manager.package.name}</name> + <mappings> + <mapping> + <directory>${infra-manager.mapping.path}</directory> + <sources> + <source> + <location>${infra-manager.dir}/target/package</location> + <excludes> + <exclude>log4j.xml</exclude> + <exclude>infra-manager.properties</exclude> + </excludes> + </source> + </sources> + </mapping> + <mapping> + <directory>${infra-manager.conf.mapping.path}</directory> + <sources> + <source> + <location>${infra-manager.dir}/target/package</location> + <includes> + <include>log4j.xml</include> + <include>infra-manager.properties</include> + </includes> + </source> + </sources> + </mapping> + </mappings> + </configuration> + </execution> </executions> </plugin> <plugin> @@ -277,6 +318,49 @@ </dataSet> </configuration> </execution> + + <execution> + <phase>package</phase> + <id>jdeb-infra-manager</id> + <goals> + <goal>jdeb</goal> + </goals> + <configuration> + <controlDir>${basedir}/src/main/package/deb/manager</controlDir> + <deb>${basedir}/target/${infra-manager.package.name}_${package-version}-${package-release}.deb</deb> + <skip>false</skip> + <skipPOMs>false</skipPOMs> + <dataSet> + <data> + <src>${infra-manager.dir}/target/ambari-infra-manager.tar.gz</src> + <type>archive</type> + <mapper> + <type>perm</type> + <user>root</user> + <group>root</group> + <prefix>${infra-manager.mapping.path}</prefix> + </mapper> + <excludes> + log4j.xml,infra-manager.properties + </excludes> + </data> + <data> + <src>${infra-manager.dir}/target/package</src> + <type>directory</type> + <mapper> + <prefix>${infra-manager.conf.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + <filemode>644</filemode> + </mapper> + <includes> + log4j.xml,infra-manager.properties + </includes> + </data> + </dataSet> + </configuration> + </execution> </executions> </plugin> <plugin> @@ -330,6 +414,11 @@ <artifactId>ambari-infra-solr-plugin</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-infra-manager</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/control new file mode 100644 index 0000000..03663a0 --- /dev/null +++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/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: [[infra-manager.package.name]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Depends: [[deb.dependency.list]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-infra/ambari-infra-assembly/src/main/package/deb/manager/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/build.xml ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-manager/build.xml b/ambari-infra/ambari-infra-manager/build.xml new file mode 100644 index 0000000..c7954d9 --- /dev/null +++ b/ambari-infra/ambari-infra-manager/build.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + 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. +--> +<project basedir="." default="build" name="infra-manager"> + <property environment="env"/> + <property name="debuglevel" value="source,lines,vars"/> + <dirname property="builddir" file="build.xml"/> + <property name="target" value="1.7"/> + <property name="source" value="1.7"/> + <target name="init"> + </target> + <target name="build"/> + + <target name="package"> + <delete dir="target/package"/> + <copy todir="target/package/libs" includeEmptyDirs="no"> + <fileset dir="target/libs"/> + </copy> + <copy todir="target/package/libs" includeEmptyDirs="no"> + <fileset file="target/*.jar"/> + </copy> + <copy todir="target/package" includeEmptyDirs="no"> + <fileset file="src/main/resources/infraManager.sh"/> + <fileset file="target/classes/infra-manager.properties"/> + <fileset file="target/classes/log4j.xml"/> + </copy> + <chmod file="target/package/*.sh" perm="755"/> + <tar compression="gzip" destfile="target/ambari-infra-manager.tar.gz"> + <tarfileset mode="755" dir="target/package"> + <include name="*.sh"/> + </tarfileset> + <tarfileset mode="664" dir="target/package"> + <exclude name="*.sh"/> + </tarfileset> + </tar> + + </target> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-manager/pom.xml b/ambari-infra/ambari-infra-manager/pom.xml index bd5bf03..b7708c2 100644 --- a/ambari-infra/ambari-infra-manager/pom.xml +++ b/ambari-infra/ambari-infra-manager/pom.xml @@ -43,7 +43,7 @@ </properties> <build> - <finalName>ambari-infra-manager</finalName> + <finalName>ambari-infra-manager_${project.version}</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -69,6 +69,47 @@ <mainClass>org.apache.ambari.infra.InfraManager</mainClass> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + <outputDirectory>${basedir}/target/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <ant antfile="build.xml"> + <target name="package"/> + </ant> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java index 227bab4..656127e 100644 --- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java +++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java @@ -142,7 +142,6 @@ public class InfraManager { ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*"); jerseyServlet.setInitOrder(1); jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.infra.rest,io.swagger.jaxrs.listing"); - context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT); context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(INFRA_MANAGER_SESSION_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java index a587ec2..7310626 100644 --- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java +++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/batch/InfraManagerBatchConfig.java @@ -104,7 +104,7 @@ public class InfraManagerBatchConfig { dataSource.setDriverClassName("org.sqlite.JDBC"); dataSource.setUrl("jdbc:sqlite:" + sqliteDbFileLocation); dataSource.setUsername(databaseUsername); - dataSource.setUsername(databasePassword); + dataSource.setPassword(databasePassword); return dataSource; } http://git-wip-us.apache.org/repos/asf/ambari/blob/b97d268a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh ---------------------------------------------------------------------- diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh new file mode 100644 index 0000000..9f40d5c --- /dev/null +++ b/ambari-infra/ambari-infra-manager/src/main/resources/infraManager.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +JVM="java" +sdir="`dirname \"$0\"`" + +PATH=$JAVA_HOME/bin:$PATH $JVM -classpath "/etc/ambari-infra-manager/conf:$sdir:$sdir/libs/*" org.apache.ambari.infra.InfraManager ${1+"$@"} \ No newline at end of file
