# Generated with .waypoint-tmpl.sh project = "report-builder" runner { enabled = true } app "multi-tenant" { config { env = { ENV = var.ENV } } build { use "docker" {} registry { use "aws-ecr" { tag = var.image_tag repository = "report-builder" } } } deploy { use "nomad-jobspec" { jobspec = templatefile("${path.app}/.jobspec.nomad", { kv_path = var.ENV, client_path = "", image = "${artifact.image}:${artifact.tag}", datacenter = var.nomad_datacenter, job_name = var.nomad_jobname, url_hostname = "main-rb.${var.dns_domain}", cpu = var.multi_tenant_cpu, memory = var.multi_tenant_memory_soft_limit, memory_max = var.multi_tenant_memory_hard_limit }) } } } # ------------------------------------------------------------------ # # Client Applications # ------------------------------------------------------------------ # app "client_a" { config { env = { ENV = var.ENV } } build { use "docker-pull" { image = var.ecr_repo tag = var.image_tag disable_entrypoint = true } } deploy { use "nomad-jobspec" { jobspec = templatefile("${path.app}/.jobspec.nomad", { kv_path = "${var.ENV}", client_path = "/client_a", image = "${var.ecr_repo}:${var.image_tag}", datacenter = var.nomad_datacenter, job_name = "${var.nomad_jobname}-${app.name}", url_hostname = "client_a-rb.${var.dns_domain}", cpu = var.cpu, memory = var.memory_soft_limit, memory_max = var.memory_hard_limit }) } } } app "client_b" { config { env = { ENV = var.ENV } } build { use "docker-pull" { image = var.ecr_repo tag = var.image_tag disable_entrypoint = true } } deploy { use "nomad-jobspec" { jobspec = templatefile("${path.app}/.jobspec.nomad", { kv_path = "${var.ENV}", client_path = "/client_b", image = "${var.ecr_repo}:${var.image_tag}", datacenter = var.nomad_datacenter, job_name = "${var.nomad_jobname}-${app.name}", url_hostname = "client_b-rb.${var.dns_domain}", cpu = var.cpu, memory = var.memory_soft_limit, memory_max = var.memory_hard_limit }) } } } app "client_z" { config { env = { ENV = var.ENV } } build { use "docker-pull" { image = var.ecr_repo tag = var.image_tag disable_entrypoint = true } } deploy { use "nomad-jobspec" { jobspec = templatefile("${path.app}/.jobspec.nomad", { kv_path = "${var.ENV}", client_path = "/client_z", image = "${var.ecr_repo}:${var.image_tag}", datacenter = var.nomad_datacenter, job_name = "${var.nomad_jobname}-${app.name}", url_hostname = "client_z-rb.${var.dns_domain}", cpu = var.cpu, memory = var.memory_soft_limit, memory_max = var.memory_hard_limit }) } } } # Variables variable "image_tag" { type = string default = "latest" } variable "ENV" { type = string default = null } variable "nomad_datacenter" { type = string description = "The Nomad datacenter we are deploying to. Set the ENV WP_VAR_nomad_datacenter." } variable "nomad_jobname" { type = string description = "The name of the job in Nomad." default = "report-builder" } variable "ecr_repo" { type = string description = "A URL to the ECR repository" default = "report-builder" } variable "dns_domain" { type = string description = "The DNS domain hosts are on." } variable "cpu" { type = number default = 500 } variable "memory_soft_limit" { type = number default = 1024 } variable "memory_hard_limit" { type = number default = 2048 } variable "multi_tenant_cpu" { type = number default = 800 } variable "multi_tenant_memory_soft_limit" { type = number default = 7168 } variable "multi_tenant_memory_hard_limit" { type = number default = 8192 }