Skip to content

vantonov1/nomad-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages