|
| 1 | +# Nomad and Consul Co-located Cluster Example |
| 2 | + |
| 3 | +This folder shows an example of Terraform code to deploy a [Nomad](https://www.nomadproject.io/) cluster co-located |
| 4 | +with a [Consul](https://www.consul.io/) cluster in [Google Cloud](https://cloud.google.com/) (if you want to run Nomad |
| 5 | +and Consul on separate clusters, see the [nomad-consul-separate-cluster example]( |
| 6 | +https://github.com/hashicorp/terraform-google-nomad/tree/master/examples/nomad-consul-separate-cluster) instead). The |
| 7 | +cluster consists of two Manged Instance Groups: one with a small number of Nomad and Consul server nodes, which are |
| 8 | +responsible for being part of the [consensus protocol](https://www.nomadproject.io/docs/internals/consensus.html), and |
| 9 | +one with an arbitrary number of Nomad and Consul client nodes, which are used to run jobs: |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +You will need to create a [Google Image](https://cloud.google.com/compute/docs/images) that has Nomad and Consul |
| 14 | +installed, which you can do using the [nomad-consul-image example]( |
| 15 | +https://github.com/hashicorp/terraform-google-nomad/tree/master/examples/nomad-consul-image)). |
| 16 | + |
| 17 | +For more info on how the Nomad cluster works, check out the [nomad-cluster]( |
| 18 | +https://github.com/hashicorp/terraform-google-nomad/tree/master/modules/nomad-cluster) documentation. |
| 19 | + |
| 20 | +## Quick start |
| 21 | + |
| 22 | +To deploy a Nomad Cluster: |
| 23 | + |
| 24 | +1. `git clone` this repo to your computer. |
| 25 | +1. Build a Nomad and Consul Image. See the [nomad-consul-image example]( |
| 26 | +https://github.com/hashicorp/terraform-google-nomad/tree/master/examples/nomad-consul-image) documentation for |
| 27 | + instructions. Make sure to note down the name of the Image. |
| 28 | +1. Install [Terraform](https://www.terraform.io/). |
| 29 | +1. Make sure your local environment is authenticated to Google Cloud. |
| 30 | +1. Open `variables.tf` and fill in any variables that don't have a default, including putting your Goolge Image ID into |
| 31 | + the `vault_source_image` and `consul_server_source_image` variables. |
| 32 | +1. Run `terraform init`. |
| 33 | +1. Run `terraform plan`. |
| 34 | +1. If the plan looks good, run `terraform apply`. |
| 35 | +1. From the same directoy where you ran `terraform apply`, run the [nomad-examples-helper.sh script]( |
| 36 | + https://github.com/hashicorp/terraform-google-nomad/tree/master/examples/nomad-examples-helper/nomad-examples-helper.sh) |
| 37 | + to print out the IP addresses of the Nomad servers and some example commands you can run to interact with the cluster: |
| 38 | + `../nomad-examples-helper/nomad-examples-helper.sh`. |
0 commit comments