Does Waypoint Hashicorp support the development of multi-component products?

222 Views Asked by At

We have a multi-component product. Do you know if it's possible to use Waypoint for building, deploying, and releasing multi-component applications? Couldn't find it in their docs.

1

There are 1 best solutions below

0
paladin-devops On

A Waypoint "project" supports multiple "apps". Each app in a project can build a single application.

However depending on the plugin you use, you may be able to deploy multiple apps at once. For example, with the nomad-jobspec plugin, you could have one or more groups/tasks in your Nomad job file.

A workaround technique I've used where I have multiple apps in the same job file is have two different apps in the same project, and instead of using the "artifact" variables to reference the build, I use input variables. In the example waypoint.hcl file below, you can see that I'm passing in 2 variables to the Nomad jobspec (which is being templated), one for the tag of the image of the 1st app and one for the 2nd. The two Nomad tasks in the job file (not depicted here) refer to the respective variable in the "image" configuration of the task. These vars are being passed in both apps though. So in order to deploy both apps, I would need to build app 1, build app 2, and then deploy either app 1 or app 2.

project = "my-project"

app "app1" {
  build {
    use "docker" {}
    registry {
      use "docker" {
        image = "image1"
        tag   = var.app1tag
      }
    }
  }

  deploy {
    use "nomad-jobspec" {
      jobspec = templatefile("${path.app}/job.nomad.tpl", {
        app1tag = var.app1tag
        app2tag = var.app2tag
      })
    }
  }
}

app "app2" {
  build {
    use "docker" {}
    registry {
      use "docker" {
        image = "image2"
        tag   = var.app2tag
      }
    }
  }

  deploy {
    use "nomad-jobspec" {
      jobspec = templatefile("${path.app}/job.nomad.tpl", {
        app1tag = var.app1tag
        app2tag = var.app2tag
      })
    }
  }
}

variable "app1tag" {
  type = string
}

variable "app2tag" {
  type = string
}

I don't think this workaround lends itself well to the other features of Waypoint (logs, config, etc.) since you'd be managing multiple apps from one app, but this does allow deployment of multiple apps at the same time.