An implementation of the spring-cloud-deployer SPI for scheduling applications with Hashicorp Nomad.
Please see the Spring Cloud Data Flow Server Nomad for a runtime implementation of this deployer SPI implementation.
This implementation borrows heavily from the spring-cloud-deployer-kubernetes project.
The Nomad HTTP API is consumed using the nomad-api project by Rafael Zanella. Huge thanks for the already having done all the hard work.
If you don't have a Nomad/Consul instance available to run the integration tests as part of the build, you can skip the integration tests and build the Nomad deployer with:
$ ./mvnw install -Dnomad.enabled=false
If you require a local Nomad instance to run the integration tests, you can use the hashistack-vagrant
project to stand up Nomad and accompanying tools. Assuming you have Vagrant
installed, clone the hashistack-vagrant
project and follow the below steps:
$ git clone https://github.com/donovanmuller/hashistack-vagrant.git
$ cd hashistack-vagrant
$ vagrant plugin install landrush # requires the 'landrush' plugin
$ vagrant up
$ vagrant ssh
...
vagrant@hashistack:~$ tmuxp load full-hashistack.yml
...
by default this will stand up a Nomad instance on 172.16.0.2:4646
/nomad-client.hashistack.vagrant:4646
.
Please see the hashistack-vagrant GitHub project for more details.
Assuming you have access to a Nomad instance (see above if you don't), you can run the integration tests with:
$ ./mvnw test \
-Dspring.cloud.deployer.nomad.nomadHost=172.16.0.2 \
-Dspring.cloud.deployer.nomad.nomadPort=4646 \
-Dspring.cloud.deployer.nomad.deployerHost=<local machines IP> \
-Dspring.cloud.consul.host=<local machines IP>
where -Dspring.cloud.deployer.nomad.nomadHost
and -Dspring.cloud.deployer.nomad.port
optionally specify the host and port where a Nomad client is listening. The default values are localhost
and 4646
respectively.
The spring.cloud.deployer.nomad.deployerHost
value must be set for the Maven resource support. The value should be the accessible (from the VM) IP address of your local machine
from where you run the tests.