updated pom with Debian code to produce .deb file

This commit is contained in:
Derrick Johnson 2014-03-05 14:03:30 -05:00
parent b8461e6ed6
commit bc85539691
8 changed files with 454 additions and 252 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
.idea
.project
.target/
debs/*
.settings/
target/
test-output/

579
pom.xml
View File

@ -4,7 +4,7 @@
<groupId>com.hpcloud</groupId>
<artifactId>mon-api</artifactId>
<version>${computedVersion}</version>
<version>0.1.0</version>
<url>http://hpcloud.net</url>
<packaging>jar</packaging>
@ -13,267 +13,342 @@
</prerequisites>
<properties>
<versionNumber>1.0.0</versionNumber>
<computedVersion>${versionNumber}-SNAPSHOT</computedVersion>
<mon.common.version>1.0.0.1</mon.common.version>
<dropwizard.version>0.7.0-rc1</dropwizard.version>
<computedVersion>${project.version}-${timestamp}-${buildNumber}</computedVersion>
<skipITs>true</skipITs>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<computedName>${project.artifactId}-${computedVersion}</computedName>
<ps.common.version>1.0.0.285</ps.common.version>
<mon.common.version>1.0.0-SNAPSHOT</mon.common.version>
<dropwizard.version>0.7.0-rc1</dropwizard.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<scm>
<connection>scm:git:git@git.hpcloud.net:mon/mon-api.git</connection>
<developerConnection>scm:git:git@git.hpcloud.net:mon/mon-api.git</developerConnection>
</scm>
<scm>
<connection>scm:git:git@git.hpcloud.net:mon/mon-api.git</connection>
<developerConnection>scm:git:git@git.hpcloud.net:mon/mon-api.git</developerConnection>
</scm>
<repositories>
<repository>
<id>nexus releases</id>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>nexus 3rd party</id>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/thirdparty</url>
</repository>
<repository>
<id>nexus-snapshots</id>
<name>nexus snapshots</name>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/snapshots</url>
</repository>
</repositories>
<repositories>
<repository>
<id>nexus releases</id>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>nexus 3rd party</id>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/thirdparty</url>
</repository>
<repository>
<id>nexus-snapshots</id>
<name>nexus snapshots</name>
<url>http://nexus.paas.hpcloud.net:8081/nexus/content/repositories/snapshots</url>
</repository>
</repositories>
<profiles>
<profile>
<id>release-deploy-url-override</id>
<activation>
<property>
<name>BUILD_NUM</name>
</property>
</activation>
<properties>
<computedVersion>${versionNumber}.${BUILD_NUM}</computedVersion>
</properties>
</profile>
</profiles>
<profiles>
<profile>
<id>release-deploy-url-override</id>
<activation>
<property>
<name>BUILD_NUM</name>
</property>
</activation>
<properties>
<computedVersion>${versionNumber}.${BUILD_NUM}</computedVersion>
<dependencies>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-model</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-http</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-persistence</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-util</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-messaging</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-db</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jdbi</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-client</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>com.palominolabs.metrics</groupId>
<artifactId>metrics-guice</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.hp.csbu.cc</groupId>
<artifactId>CsMiddleware</artifactId>
<version>3.34.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.2.0-incubating</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.0</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
</properties>
</profile>
</profiles>
<!-- Test dependencies -->
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-testing</artifactId>
<version>${mon.common.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-dropwizard</artifactId>
<version>${mon.common.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-model</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-http</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-persistence</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-util</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-messaging</artifactId>
<version>${mon.common.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-db</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jdbi</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-client</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>com.palominolabs.metrics</groupId>
<artifactId>metrics-guice</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.hp.csbu.cc</groupId>
<artifactId>CsMiddleware</artifactId>
<version>3.34.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.2.0-incubating</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.0</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- Test dependencies -->
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-testing</artifactId>
<version>${mon.common.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.hpcloud</groupId>
<artifactId>mon-dropwizard</artifactId>
<version>${mon.common.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/debs</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<shortRevisionLength>6</shortRevisionLength>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>performance,functional,integration,database,slow</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>performance,functional,integration,database,slow</groups>
<skipTests>${skipITs}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<configuration>
<finalName>${computedName}</finalName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<source>1.7</source>
<target>1.7</target>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.hpcloud.mon.MonApiApplication</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId>
<version>1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<excludedGroups>performance,functional,integration,database,slow</excludedGroups>
<deb>${project.basedir}/debs/binaries/${computedName}.deb</deb>
<dataSet>
<data>
<type>file</type>
<src>${project.build.directory}/${computedName}.jar</src>
<dst>/opt/mon/mon-api.jar</dst>
</data>
<data>
<type>file</type>
<src>${project.basedir}/src/deb/init/mon-api.conf</src>
<dst>/etc/init/mon-api.conf</dst>
</data>
<data>
<type>file</type>
<src>${project.basedir}/src/deb/etc/mon-api-config.yml-sample</src>
<dst>/etc/mon/mon-api-config.yml-sample</dst>
</data>
</dataSet>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>performance,functional,integration,database,slow</groups>
<skipTests>${skipITs}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<finalName>mon-api</finalName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.hpcloud.mon.MonApiService</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<configuration>
<tag>${project.version}</tag>
</configuration>
</plugin>
</plugins>
</build>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<configuration>
<tag>${project.version}</tag>
</configuration>
</plugin>
</plugins>
</build>
</project>

9
src/deb/control/control Normal file
View File

@ -0,0 +1,9 @@
Package: [[name]]
Section: misc
Priority: optional
Architecture: all
Depends: openjdk-7-jre-headless | openjdk-7-jre
Version: [[version]]-[[timestamp]]-[[buildNumber]]
Maintainer: HPCloud SOM <hpcs-mon-som@hp.com>
Description: MON-API
RESTful API for all MON data.

13
src/deb/control/postinst Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
case "$1" in
configure)
if ! [ `getent passwd mon_api` ]; then
adduser --system --group mon_api
fi
restart mon-api
;;
esac
exit 0

9
src/deb/control/postrm Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
case "$1" in
remove|purge)
userdel mon_api
;;
esac
exit 0

9
src/deb/control/prerm Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
case "$1" in
remove)
stop mon-api
;;
esac
exit 0

View File

@ -0,0 +1,75 @@
repositoryType: vertica
useMiddleware: false
maxBatchSize: 1000
claimBufferSize: 128
deployBatchSeconds: 10
http:
port: 8080
adminPort: 8081
# A map of servlet context parameter names to servlet context
# parameter values.
contextParameters:
ServerVIP: csnode.rndd.aw1.hpcloud.net
ServerPort: 9543
ConnTimeout: 500
ConnSSLClientAuth: True
Keystore: ./hpmiddleware-keystore.jks
KeystorePass: changeit
Truststore: ./hpmiddleware-truststore.jks
TruststorePass: changeit
ConnPoolMaxActive: 3
ConnPoolMaxIdle: 3
ConnPoolEvictPeriod: 60000
ConnPoolMinIdleTime: 90000
DelayAuthDecision: False
AuthVersion: v3
database:
driverClass: com.vertica.jdbc.Driver
url: jdbc:vertica://15.185.251.191:5433/som
# url: jdbc:vertica://mon-aw1rdd1-vertica0001.rndd.aw1.hpcloud.net:5433/som
user: som_service
password: <password>
properties:
charSet: UTF-8
ssl: false
#
# The maximum amount of time to wait on an empty pool before throwing an exception
maxWaitForConnection: 1s
# The SQL vertica to run when validating a connection's liveness
validationQuery: "/* MyService Health Check */ SELECT 1"
# The minimum number of connections to keep open
minSize: 8
# The maximum number of connections to keep open
maxSize: 32
# Whether or not idle connections should be validated
checkConnectionWhileIdle: false
# How long a connection must be held before it can be validated
checkConnectionHealthWhenIdleFor: 10s
# The maximum lifetime of an idle connection
closeConnectionIfIdleFor: 1 minute
logging:
level: INFO #DEBUG, TRACE, WARN, INFO
# Settings for logging to a file
file:
# If true, addToBatch log statements to a file
enabled: true
# Do not addToBatch log statements below this threshold to the file
threshold: ALL
# The file to which statements will be logged
currentLogFilename: /var/log/som-api/som-api.log
# When the log file rolls over, the file will be archived to example-2012-03-15.log.gz
# example.log will be truncated, and new statements written to it
archivedLogFilenamePattern: /var/log/som-api/som-api%d.log.gz
# The maximum number of log files to archive
archivedFileCount: 10

11
src/deb/init/mon-api.conf Normal file
View File

@ -0,0 +1,11 @@
# Startup script for the SOM-Service
description "SOM API java app"
start on runlevel [2345]
console log
respawn
setgid som_api
setuid som_api
exec /usr/bin/java -Xmx8g -cp /opt/mon/mon-api.jar com.hpcloud.mon.MonApiApplicationRunner server /etc/mon/mon-api-config.yml