nomad-maven-plugin

Maven plugin to deploy jar artifact (like microservice) to HashiCorp Nomad (https://www.nomadproject.io/)

License

License

Categories

Categories

Maven Build Tools Ant
GroupId

GroupId

com.github.vantonov1
ArtifactId

ArtifactId

nomad-maven-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

nomad-maven-plugin
Maven plugin to deploy jar artifact (like microservice) to HashiCorp Nomad (https://www.nomadproject.io/)
Project URL

Project URL

https://github.com/vantonov1/nomad-maven-plugin
Source Code Management

Source Code Management

https://github.com/vantonov1/nomad-maven-plugin

Download nomad-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.vantonov1</groupId>
    <artifactId>nomad-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
com.hashicorp.nomad : nomad-sdk jar 0.8.6.1
javax.xml.bind : jaxb-api jar 2.3.1

provided (4)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven : maven-core jar 3.3.9
org.apache.maven : maven-artifact jar 3.3.9
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

runtime (1)

Group / Artifact Type Version
org.glassfish.jaxb : jaxb-runtime jar 2.3.1

Project Modules

There are no modules declared in this project.

Usage: nomad:deploy. Plugin is not bound to any lifecycle phase by default (rather it is expected to be used as a part of release process), but it could be bound as usual, using <execution> block

Nomad needs artifact to be downloaded from some repository, it could not be deployed right from the target folder. Therefore, artifact is expected to be deployed to the repository first, and project distributionManagement.downloadUrl have to be set. Plugin constructs download URL using distributionManagement.downloadUrl, groupId, artifactId, version and classifier from the project POM. For SNAPSHOT artifacts, it downloads and parses maven-metadata.xml to get the latest uploaded version

Task name and task group name will be set to artifactId. These Nomad environment variables will be used:

Variable Default value Description
NOMAD_ADDR http://127.0.0.1:4646 URL of the HTTP API
NOMAD_REGION Region
NOMAD_NAMESPACE default Job namespace
NOMAD_CA_CERT Path to TLS Authority certificate file
NOMAD_CLIENT_CERT Path to client certificate file
NOMAD_CLIENT_KEY Path to client key file
NOMAD_TOKEN ACL token

Additionally, you can set these parameters in the configuration block:

Variable Default value Description
addr from NOMAD_ADDR Overrides API address
options Java options, passed to nomad java driver to start the job
datacenters dc1 List of data centers, divided by comma
port http Label for the dynamic port allocation
env <env><key1>value1</key1>...</env> passed as a set of environment variables
meta <meta><key1>value1</key1>...</meta> passed as meta information

Configuration example:

            <plugin>
                <groupId>com.github.vantonov1</groupId>
                <artifactId>nomad-maven-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <addr>http://nomad.local:4646</addr>
                    <datacenters>west,east</datacenters>
                    <options>-Xmx1G</options>
                    <port>web</port>
                    <meta>
                        <k1>v1</k1>
                    </meta>
                </configuration>
            </plugin>

Versions

Version
1.0