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/

91
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,12 +13,12 @@
</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>
<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>
@ -54,6 +54,7 @@
</activation>
<properties>
<computedVersion>${versionNumber}.${BUILD_NUM}</computedVersion>
</properties>
</profile>
</profiles>
@ -184,6 +185,34 @@
<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>
@ -222,8 +251,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<configuration>
<finalName>mon-api</finalName>
<finalName>${computedName}</finalName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
@ -246,7 +276,7 @@
<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>
<mainClass>com.hpcloud.mon.MonApiApplication</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
@ -254,6 +284,51 @@
</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>
<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>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>

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