Dropwizard Debian Package

Build Status Coverage Status Maven Central

A maven plugin for packaging your Dropwizard Application as a Debian package. Your Application is managed as a SystemD, Upstart or SystemV job, with the service name ${project.artifactId}.

During packaging your configuration file is treated as a Mustache template, and configuration properties injected. Parameters are exposes prefixed with both dw and dropwizard. Missing properties will cause the build to fail. Assuming validate is set to true (the default), the configuration will be validated, and build failed if it fails.

Usage

Sample plugin definition in project pom

<plugin>
    <groupId>com.jamierf.dropwizard</groupId>
    <artifactId>dropwizard-debpkg-maven-plugin</artifactId>
    <version>${dropwizard-debpkg-maven-plugin.version}</version>
    <configuration>
        <configTemplate>${basedir}/src/config.yml</configTemplate>
        <jvm>
            <memory>2g</memory>
        </jvm>
        <dropwizard>
            <httpPort>8080</httpPort>
            <httpAdminPort>8081</httpAdminPort>
        </dropwizard>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>dwpackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Sample Application configuration template

# {{{project.name}}} - {{{project.description}}}
# {{{project.artifactId}}} configuration

server:
  applicationConnectors:
    - type: http
      port: {{{dw.httpPort}}}
  adminConnectors:
    - type: http
      port: {{{dw.httpAdminPort}}}

logging:
  level: INFO

  appenders:
    - type: console
    - type: file
      currentLogFilename: "{{{path.logDirectory}}}/test.log"
      archive: false

Configuration

Below is the default configuration. The only required parameter is the configTemplate path, however it is highly likely you will also require some dropwizard properties to be injected in to the service configuration.

<configuration>
    <deb>
        <maintainer>Unspecified</maintainer><!-- Optional: The person responsible for this service. -->
        <name /><!-- Optional: the .deb package name. If not specified, project.artifactId is used. -->
        <version /><!-- Optional: the .deb package version. If not specified, project.version is used. -->
    </deb>
    <jvm>
        <memory>128m</memory><!-- Optional: JVM heap size to allocate, once deployed. -->
        <packageName>openjdk-7-jdk</packageName><!-- Optional: JRE package to ensure installed as part of deployment. -->
        <packageVersion>any</packageVersion><!-- Optional: Version of JRE package to require, defaults to the latest. -->
        <server>true</server><!-- Optional: If the JVM should run in server mode. -->
    </jvm>
    <unix>
        <user>dropwizard</user><!-- Optional: The unix user to create and run as. -->
        <respawn>true</respawn><!-- Optional: If the service should respawn upon exit (not supported for SystemV). -->
    </unix>
    <pgp><!-- Optional: Not present by default. If present, all children are required. -->
        <alias /><!-- Required: Alias of PGP key to sign with. -->
        <keyring /><!-- Required: Path to PGP keyring file. -->
        <passphrase /><!-- Required: Pass phrase of PGP keyring. -->
    </pgp>
    <path>
        <jarFile>/usr/share/java/${project.artifactId}.jar</jarFile><!-- Optional: Path to the service jar, once deployed. -->
        <startScript>/usr/bin/${project.artifactId}</startScript><!-- Optional Path to the start script, once deployed. -->
        <configFile>/etc/${project.artifactId}.yml</configFile><!-- Optional: Path to your service configuration, once deployed. -->
        <jvmConfigFile>/etc/${project.artifactId}.jvm.conf</jvmConfigFile><!-- Optional: Path to your JVM parameter configuration, once deployed. -->
        <logDirectory>/var/log/${project.artifactId}</logDirectory><!-- Optional: Directory for service logs, once deployed. -->
        <upstartFile>/etc/init/${project.artifactId}.conf</upstartFile><!-- Optional: Path to the service upstart configuration, once deployed. -->
        <systemVFile>/etc/init.d/${project.artifactId}</systemVFile><!-- Optional: Path to the service init configuration, once deployed. -->
        <systemDFile>/lib/systemd/system/${project.artifactId}.service</systemDFile><!-- Optional: Path to the service systemd configuration, once deployed. -->
    </path>
    <files><!-- Optional: Empty by default. -->
        <file>
            <source /><!-- Required: Path to the resource file. -->
            <target /><!-- Required: Path to the resource, once deployed. -->
            <filter>true</filter><!-- Optional: If this resource should be treated as a template. -->
            <user>${unix.user}</user><!-- Optional: The user the resource should be owned by. -->
            <mode>0600</mode><!-- Optional: The filemode for this resource. -->
        </file>
    </files>
    <dropwizard /><!-- Optional: Map of parameters to substitute in to your configuration template on packaging. -->
    <configTemplate /><!-- Required: Path to your service configuration template. -->
    <artifactFile>${project.build.directory}/${project.artifactId}-${project.version}.jar</artifactFile><!-- Optional: Path to the service jar to package. -->
    <outputFile>${project.build.directory}/${project.artifactId}-${project.version}.deb</outputFile><!-- Optional: The path to output the Debian package to. -->
    <validate>true</validate><!-- Optional: Enable validation of your service configuration at package time. -->
</configuration>

Change Log

0.10 - 9 March 2016

0.9 - 10 August 2015

0.8 - 14 April 2015

0.7 - 28 September 2014

0.6 - 24 September 2014

0.5 - 12 June 2014

0.4 - 11 June 2014

0.3 - 4 June 2014

0.2 - 4 June 2014

0.1 - 26 May 2014

License

Released under the Apache 2.0 License.