Skip to content

Commit

Permalink
create an assembly for the Minion, port the RPM spec to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Oct 17, 2016
1 parent 615ff47 commit c58bdc7
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 57 deletions.
32 changes: 17 additions & 15 deletions debian/rules
Expand Up @@ -8,6 +8,9 @@ export SHELL=/bin/bash

export JAVA_HOME=$(shell opennms-base-assembly/src/main/filtered/bin/find-java.sh 1.8 1.8.9999)

export OPTS_ASSEMBLIES=-Passemblies
export OPTS_PROFILES=-Prun-expensive-tasks

export BUILDDEFINES=\
-Dopennms.home=/usr/share/opennms \
-Ddist.dir=$(CURDIR)/debian -Ddist.name=temp \
Expand All @@ -25,7 +28,7 @@ export BUILDDEFINES=\
-Dproduct.snapshot=true \
-Daether.connector.basic.threads=1 \
-Daether.connector.resumeDownloads=false \
-Prun-expensive-tasks
$(OPTS_PROFILES)

configure:

Expand All @@ -38,33 +41,33 @@ $(STAMP_BUILD):
echo "using $$OPENNMS_SETTINGS_XML"; \
if [ -z "$$OPENNMS_SKIP_COMPILE" ] || [ "$$OPENNMS_SKIP_COMPILE" = 0 ]; then \
if [ -z "$$OPENNMS_ENABLE_SNAPSHOTS" ] || [ "$$OPENNMS_ENABLE_SNAPSHOTS" = 1 ]; then \
./compile.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install && \
./assemble.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
./compile.pl -Denable.snapshots=true -DupdatePolicy=always -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install && \
./assemble.pl -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
else \
./compile.pl -Dbuild=all -DupdatePolicy=always -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install && \
./assemble.pl -Dbuild=all -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
./compile.pl -DupdatePolicy=always -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install && \
./assemble.pl -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
fi; \
else \
if [ -z "$$OPENNMS_ENABLE_SNAPSHOTS" ] || [ "$$OPENNMS_ENABLE_SNAPSHOTS" = 1 ]; then \
./assemble.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
./assemble.pl -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
else \
./assemble.pl -Dbuild=all -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
./assemble.pl -DupdatePolicy=always -Dbuild.profile=fulldir -s $$OPENNMS_SETTINGS_XML $(BUILDDEFINES) install; \
fi; \
fi; \
else \
if [ -z "$$OPENNMS_SKIP_COMPILE" ] || [ "$$OPENNMS_SKIP_COMPILE" = 0 ]; then \
if [ -z "$$OPENNMS_ENABLE_SNAPSHOTS" ] || [ "$$OPENNMS_ENABLE_SNAPSHOTS" = 1 ]; then \
./compile.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -Duser.home=$(HOME) $(BUILDDEFINES) install && \
./assemble.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -Duser.home=$(HOME) $(BUILDDEFINES) install; \
./compile.pl -Denable.snapshots=true -DupdatePolicy=always -Duser.home=$(HOME) $(BUILDDEFINES) install && \
./assemble.pl -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir -Duser.home=$(HOME) $(BUILDDEFINES) install; \
else \
./compile.pl -Dbuild=all -DupdatePolicy=always -Duser.home=$(HOME) $(BUILDDEFINES) install && \
./assemble.pl -Dbuild=all -DupdatePolicy=always -Dbuild.profile=fulldir -Duser.home=$(HOME) $(BUILDDEFINES) install; \
./compile.pl -DupdatePolicy=always -Duser.home=$(HOME) $(BUILDDEFINES) install && \
./assemble.pl -DupdatePolicy=always -Dbuild.profile=fulldir -Duser.home=$(HOME) $(BUILDDEFINES) install; \
fi; \
else \
if [ -z "$$OPENNMS_ENABLE_SNAPSHOTS" ] || [ "$$OPENNMS_ENABLE_SNAPSHOTS" = 1 ]; then \
./assemble.pl -Dbuild=all -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir $(BUILDDEFINES) install; \
./assemble.pl -Denable.snapshots=true -DupdatePolicy=always -Dbuild.profile=fulldir $(BUILDDEFINES) install; \
else \
./assemble.pl -Dbuild=all -DupdatePolicy=always -Dbuild.profile=fulldir $(BUILDDEFINES) install; \
./assemble.pl -DupdatePolicy=always -Dbuild.profile=fulldir $(BUILDDEFINES) install; \
fi; \
fi; \
fi
Expand All @@ -75,8 +78,7 @@ $(STAMP_BUILD):
clean:
dh_testdir
dh_testroot
./compile.pl -Dbuild=all -Duser.home=$(HOME) -Ddist.dir=$(CURDIR)/debian -Ddist.name=temp clean
./assemble.pl -Dbuild=all -Duser.home=$(HOME) -Ddist.dir=$(CURDIR)/debian -Ddist.name=temp clean
./compile.pl $(OPTS_PROFILES) $(OPTS_ASSEMBLIES) -Duser.home=$(HOME) -Ddist.dir=$(CURDIR)/debian -Ddist.name=temp clean
rm -f opennms-remote-poller.{init,default}
dh_clean
rm -f $(STAMP_BUILD)
Expand Down
141 changes: 141 additions & 0 deletions opennms-assemblies/minion/pom.xml
@@ -0,0 +1,141 @@
<?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">
<parent>
<groupId>org.opennms</groupId>
<artifactId>org.opennms.assemblies</artifactId>
<version>19.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opennms.assemblies</groupId>
<artifactId>org.opennms.assemblies.minion</artifactId>
<packaging>jar</packaging>
<name>OpenNMS Minion</name>
<url>http://maven.apache.org</url>
<properties>
<INSTPREFIX>/opt/minion</INSTPREFIX>
<SYSCONFDIR>/opt/minion/etc</SYSCONFDIR>
</properties>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/filtered</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<escapeString>\</escapeString>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.opennms.features.minion.container</groupId>
<artifactId>karaf</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
</artifactItem>
<artifactItem>
<groupId>org.opennms.features.minion</groupId>
<artifactId>repository</artifactId>
<version>${project.version}</version>
<classifier>repo</classifier>
<type>tar.gz</type>
<outputDirectory>${project.build.directory}/default</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.opennms.features.minion</groupId>
<artifactId>core-repository</artifactId>
<version>${project.version}</version>
<classifier>repo</classifier>
<type>tar.gz</type>
<outputDirectory>${project.build.directory}/core</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.opennms</groupId>
<artifactId>opennms-base-assembly</artifactId>
<version>${project.version}</version>
<classifier>daemon</classifier>
<type>tar.gz</type>
<outputDirectory>${project.build.directory}/base-assembly</outputDirectory>
<includes>bin/find-java.sh</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/minion.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.opennms.features.minion.container</groupId>
<artifactId>karaf</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
</dependency>
<dependency>
<groupId>org.opennms.features.minion</groupId>
<artifactId>core-repository</artifactId>
<version>${project.version}</version>
<classifier>repo</classifier>
<type>tar.gz</type>
</dependency>
<dependency>
<groupId>org.opennms.features.minion</groupId>
<artifactId>repository</artifactId>
<version>${project.version}</version>
<classifier>repo</classifier>
<type>tar.gz</type>
</dependency>
<dependency>
<groupId>org.opennms</groupId>
<artifactId>opennms-base-assembly</artifactId>
<version>${project.version}</version>
<classifier>daemon</classifier>
<type>tar.gz</type>
</dependency>
</dependencies>
</project>
46 changes: 46 additions & 0 deletions opennms-assemblies/minion/src/assembly/minion.xml
@@ -0,0 +1,46 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>minion</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>minion-${project.version}</outputDirectory>
<includes>
<include>debian/rules</include>
<include>etc/minion.init</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>minion-${project.version}</outputDirectory>
<excludes>
<exclude>debian/rules</exclude>
<exclude>etc/minion.init</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>target/karaf-${project.version}</directory>
<outputDirectory>minion-${project.version}</outputDirectory>
</fileSet>
<fileSet>
<directory>target/core</directory>
<outputDirectory>minion-${project.version}/repositories/core</outputDirectory>
</fileSet>
<fileSet>
<directory>target/default</directory>
<outputDirectory>minion-${project.version}/repositories/default</outputDirectory>
</fileSet>
<fileSet>
<directory>target/base-assembly/bin</directory>
<outputDirectory>minion-${project.version}/bin</outputDirectory>
</fileSet>
</fileSets>
</assembly>
81 changes: 81 additions & 0 deletions opennms-assemblies/minion/src/main/filtered/debian/rules
@@ -0,0 +1,81 @@
#!/usr/bin/make -f

export DH_VERBOSE=1
export JAVA_HOME=$(shell opennms-base-assembly/src/main/filtered/bin/find-java.sh 1.8 1.8.9999)

export OPTS_MAVEN="-Daether.connector.basic.threads=1 -Daether.connector.resumeDownloads=false"
export OPTS_SKIP_TESTS="-DskipITs=true -Dmaven.test.skip.exec=true"
export OPTS_SKIP_TARBALL="-Dbuild.skip.tarball=true"
export OPTS_ASSEMBLIES="-Passemblies"
export OPTS_PROFILES="-Prun-expensive-tasks"
export COMPILE_PROJECTS="org.opennms.features.minion.container:karaf,org.opennms.features.minion:core-repository,org.opennms.features.minion:repository,org.opennms.features.minion:container-parent,org.opennms.features.minion:core-parent,org.opennms.features.minion:org.opennms.features.minion.heartbeat,org.opennms.features.minion:repository,org.opennms.features.minion:shell"
export ASSEMBLY_PROJECTS=":org.opennms.assemblies.minion"

export BUILDDEFINES=\
$(OPTS_MAVEN) \
$(OPTS_SKIP_TESTS) \
$(OPTS_SKIP_TARBALL) \
$(OPTS_PROFILES) \
-Duser.home=$(HOME) \
-Dbuild.profile=fulldir \
-Dopennms.home=/opt/minion \
-Ddist.dir=$(CURDIR)/debian \
-Ddist.name=temp

STAMP_BUILD = debian/stamp-build

configure:

build: configure $(STAMP_BUILD)

$(STAMP_BUILD):
dh_testdir
./compile.pl -N $(BUILDDEFINES) install
if [ -z "$$OPENNMS_ENABLE_SNAPSHOTS" ] || [ "$$OPENNMS_ENABLE_SNAPSHOTS" = 1 ]; then export OPTS_ENABLE_SNAPSHOTS="-Denable.snapshots=true"; fi
if [ -z "$$OPENNMS_SKIP_COMPILE" ] || [ "$$OPENNMS_SKIP_COMPILE" = 0 ]; then \
./compile.pl $(OPTS_SKIP_TESTS) $(OPTS_SKIP_TARBALL) $(OPTS_UPDATE_POLICY) $(BUILDDEFINES) $$OPTS_ENABLE_SNAPSHOTS --projects $(COMPILE_PROJECTS) --also-make install; \
fi
./assemble.pl $(OPTS_SKIP_TESTS) $(OPTS_SKIP_TARBALL) $(OPTS_UPDATE_POLICY) $(BUILDDEFINES) $$OPTS_ENABLE_SNAPSHOTS --projects $(ASSEMBLY_PROJECTS) install
find debian/temp -type d -name .svn -exec rm -rf {} \;
find debian/temp -type d -name .git -exec rm -rf {} \;
touch $(STAMP_BUILD)

clean:
dh_testdir
dh_testroot
./compile.pl $(OPTS_ASSEMBLIES) $(OPTS_PROFILES) $(BUILDDEFINES) clean
rm -f opennms-remote-poller.{init,default}
dh_clean
rm -f $(STAMP_BUILD)

install:
dh_testdir
dh_clean -k --exclude=temp
dh_installdirs
dh_testroot

binary-indep: build install
dh_testdir
dh_testroot
dh_installdocs
#dh_installinit --package=opennms-server --name=opennms --no-start -u"defaults 21 19"
#dh_installinit --package=opennms-remote-poller --no-start -u"defaults 21 19"
dh_installman
dh_installdebconf
dh_link
dh_strip
dh_compress
#dh_fixperms # Disabled to allow non-standard permissions
dh_makeshlibs -n
dh_installdeb
#dh_perl debian/opennms-common/usr/share/opennms/bin debian/opennms-contrib/usr/share/opennms/contrib
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
File renamed without changes.
10 changes: 6 additions & 4 deletions tools/packages/minion/minion.init → .../minion/src/main/filtered/etc/minion.init 100644 → 100755
Expand Up @@ -19,8 +19,8 @@
NAME="minion"
DESC="Minion"
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MINION_HOME="@INSTPREFIX@"
SYSCONFDIR="@SYSCONFDIR@"
MINION_HOME="/opt/minion"
SYSCONFDIR="${MINION_HOME}/etc"
STOP_RETRIES=10
STOP_WAIT=5

Expand All @@ -33,8 +33,10 @@ fi
if [ -e "${SYSCONFDIR}/minion" ]; then
# shellcheck disable=SC1090,SC1091
. "${SYSCONFDIR}/minion"
elif [ -e "${SYSCONFDIR}/minion.conf" ]; then
. "${SYSCONFDIR}/minion.conf"
fi

if [ -e "${MINION_HOME}/minion.conf" ]; then
. "${MINION_HOME}/minion.conf"
fi

# always dump heap if we OOM
Expand Down
1 change: 1 addition & 0 deletions opennms-assemblies/pom.xml
Expand Up @@ -23,6 +23,7 @@

<modules>
<module>http-remoting</module>
<module>minion</module>
<module>remote-poller-onejar</module>
<module>remote-poller-standalone</module>
<module>remote-poller-nsis</module>
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Expand Up @@ -1507,6 +1507,12 @@
<install.rrdtool.bin>/opt/csw/bin/rrdtool</install.rrdtool.bin>
</properties>
</profile>
<profile>
<id>assemblies</id>
<modules>
<module>opennms-full-assembly</module>
</modules>
</profile>
<profile>
<id>build-bamboo</id>
<modules>
Expand Down

0 comments on commit c58bdc7

Please sign in to comment.