SlideShare a Scribd company logo
10 things i learned building
Nomad packs
Bram Vogelaar
@attachmentgenie
Confidential and Proprietary
~ ❯ whoami => Bram Vogelaar
• Used to be a Molecular Biologist
• Then became a Dev, now an Ops
• Currently Cloud Engineer @ The Factory
• Amsterdam HUG organizer
Confidential and Proprietary
Nomad
• Open-source tool for dynamic workload scheduling
• Batch, containerized, and non-containerized applications.
• Has native Consul and Vault integrations.
• Has token based access setup.
• Jobs written in (H)ashiCorp (C)onfiguration (L)anguage
https://www.nomadproject.io/
Confidential and Proprietary
Nomad Job Structure
job "lorem-ipsum" {
group ”frontend" {
network {
port "http" { to = ”3000” }
}
service {
name = ”lorem"
port. = ”http"
}
task "server" {
driver = "docker"
config {
image = ”cicero/lorem-ipsum:v1.0.0"
ports = ["http"]
}
}
}
Confidential and Proprietary
Surprisingly Dynamic
job "lorem-ipsum" {
group ”frontend" {
network {
port "http" { to = ”3000” }
}
service {
name = ”lorem"
port. = ”http"
}
task "server" {
driver = "docker"
config {
image = ”cicero/lorem-ipsum:v1.0.0"
ports = ["http"]
}
}
}
Confidential and Proprietary
Incredibly Dynamic
● Data Centers
● Region
● Namespace
● Constraints
● Count
● Restart Configuration
● Network
● Volumes
● Service Checks
● Consul Connect
● Resource Limits
● Artifacts
● Templates
● Autoscaler Configuration
Confidential and Proprietary
UX Pyramid
Confidential and Proprietary
Nomad Pack
• Templating and Packaging tool
• Easily deploy popular applications to Nomad
• Re-use common patterns across internal applications
• Find and share job definitions with the Nomad community
• Jobs written in (H)ashiCorp (C)onfiguration (L)anguage
• Templates are written using Go Template Syntax.
• Nightlies only right now!
https://github.com/hashicorp/nomad-pack
Confidential and Proprietary
Pack Registries
$ nomad-pack registry list
$ nomad-pack registry add o11y https://github.com/attachmentgenie/nomad-pack-o11y-registry
$ nomad-pack run grafana --var job_name=dashboard --registry=o11y
$ nomad-pack run packs/grafana -f vars/grafana.hcl –f vars/lab.hcl
https://github.com/hashicorp/nomad-pack-o11y-registry
Confidential and Proprietary
Default Registry
$ nomad-pack registry list
PACK NAME | REF | METADATA VERSION | REGISTRY | REGISTRY URL
-----------------------------+--------+------------------+-----------------+-----------------------------
alertmanager | latest | 0.0.1 | default | github.com/hashicorp
aws_efs_csi | latest | 0.0.1 | default | github.com/hashicorp
mkdir –p $HOME/.nomad/packs/default on offline systems!
Confidential and Proprietary
Pack Structure
lorem-ipsum ❯ tree |--
CHANGELOG.md
|-- README.md
|-- metadata.hcl
|-- outputs.tpl
|-- templates
| |-- _helpers.tpl
| `-- lorem-ipsum.nomad.tpl
`-- variables.hcl
1 directory, 7 files
Confidential and Proprietary
metadata.hcl
app {
url = "https://grafana.com/"
author = "Grafana Labs"
}
pack {
name = "grafana"
description = "Grafana is a multi-platform open source analytics and interactive visualization tool."
url = "https://github.com/attachmentgenie/nomad-pack-o11y-registry/grafana"
version = "0.1.0"
}
Confidential and Proprietary
variables.hcl
variable "datacenters" {
description = "A list of datacenters in the region which are eligible for task placement"
type = list(string)
default = [“dc1”]
}
Variable “resources” {
description = “The resource to assign to the Grafana service task”
type = object({
cpu = number
memory = number
})
default = {
cpu = 200,
memory = 256
}
}
Confidential and Proprietary
Pack Templates
$ cat packs/grafana/templates/grafana.nomad.tpl
….
datacenters = [[ .my.datacenters | toStringList ]]
…
resources {
cpu = [[ .my.grafana_resources.cpu ]]
memory = [[ .my.grafana_resources.memory ]]
}
…
https://github.com/hashicorp/nomad-pack-community-registry
Confidential and Proprietary
CI-CD
$ nomad-pack plan packs/loki --var version=vX.Y.Z -f vars/loki.hcl
+/- Job: "loki"
+ VaultToken: "s.IJcEJqpsCkGU0mfY3GmnCLSd"
+/- Task Group: "loki" (1 create, 2 in-place update)
+/- Count: "2" => "3" (forces create)
Task: "connect-proxy-loki" Task: "server"
» Scheduler dry-run:
- All tasks successfully allocated.
Plan succeeded
$ nomad-pack nomad-pack run packs/loki --var version=vX.Y.Z -f vars/loki.hcl
Confidential and Proprietary
CI-CD Paranoid Version
$ nomad-pack render packs/loki --var version=vX.Y.Z -f vars/loki.hcl -o $WORKSPACE/render
$ nomad run $WORKSPACE/render/loki/loki.nomad
https://github.com/marketplace/actions/setup-hashicorp-nomad-pack
Confidential and Proprietary
Nomad UI
Confidential and Proprietary
Helper template
$ cat packs/grafana/templates/grafana.nomad.tpl
job [[ template "job_name" . ]] {
[[ template "region" . ]]
[[ template "namespace" . ]]
….
$ cat packs/grafana/templates/_helpers.tpl
…
[[- define "job_name" -]]
[[- if eq .grafana.job_name "" -]]
[[- .nomad_pack.pack.name | quote -]]
[[- else -]]
[[- .grafana.job_name | quote -]]
[[- end -]]
[[- end -]]
…
Confidential and Proprietary
Abstracting away boring repetitive bits
$ cat packs/grafana/templates/_helpers.tpl
…
[[ define "resources" -]]
[[- $resources := . ]]
resources {
cpu = [[ $resources.cpu ]]
memory = [[ $resources.memory ]]
}
[[- end ]]
…
$ cat packs/grafana/templates/grafana.nomad.tpl
…
[[ template " resources " . ]]
…
Confidential and Proprietary
Abstracting away boring repetitive bits
$ cat packs/grafana/templates/_resources.tpl
…
[[ define "resources" -]]
[[- $resources := . ]]
resources {
cpu = [[ $resources.cpu ]]
memory = [[ $resources.memory ]]
}
[[- end ]]
…
$ cat packs/grafana/templates/grafana.nomad.tpl
…
[[ template " resources " . ]]
…
Confidential and Proprietary
Abstracting away boring repetitive bits
$ cat packs/grafana/metadata.hcl
…
dependency ”hashitalks_helpers" {
name = "hashitalks_helpers"
source = "https://github.com/attachmentgenie/hashitalks-registry/helpers"
}
$ cat packs/grafana/templates/grafana.nomad.tpl
…
[[ template "hashitalks_helpers .resources" . ]]
…
Confidential and Proprietary
Wishlist: pre-commit-nomad
Currently no clear alternatives/equivalents for:
Terraform_docs
Terraform_fmt
Terraform_tflint
Terraform_validate
Terrascan
Confidential and Proprietary
Wishlist: Locals
network {
mode = "bridge"
port "mysql" {
to = 3306 <- local.mysql_port
}
}
[[ if .my.register_consul_service ]]
service {
name = "[[ .my.consul_service_name ]]"
tags = [[ .my.consul_service_tags | toStringList ]]
port = "mysql"
connect {
sidecar_service {
tags = [""]
proxy {
local_service_port = 3306 <- local.mysql_port
…
Confidential and Proprietary
Wishlist: Meta package support
$ cat deploy.sh
#!/bin/bash
set -e
nomad-pack run minio -f vars/minio.hcl -f vars/lab.hcl --registry=attachmentgenie
nomad-pack run packs/loki -f vars/loki.hcl -f vars/lab.hcl
nomad-pack run packs/mimir -f vars/mimir.hcl -f vars/lab.hcl
nomad-pack run packs/phlare -f vars/phlare.hcl -f vars/lab.hcl
nomad-pack run packs/tempo -f vars/tempo.hcl -f vars/lab.hcl
nomad-pack run packs/grafana -f vars/grafana.hcl -f vars/lab.hcl
nomad-pack run redis -f vars/redis.hcl -f vars/lab.hcl --registry=attachmentgenie
nomad-pack run packs/grafana_oncall -f vars/grafana_oncall.hcl -f vars/lab.hcl
nomad-pack run packs/prometheus -f vars/prometheus.hcl -f vars/lab.hcl
nomad-pack run packs/promlens -f vars/promlens.hcl -f vars/lab.hcl
Confidential and Proprietary
Wishlist: Dependency health checks
$ cat deploy.sh
#!/bin/bash
set -e
export NOMAD_ADDR=http://192.168.1.30:4646/ui/jobs
wait-for-url() {
echo "Testing $1"
timeout -s TERM 45 bash -c 
'while [[ "$(curl -s -o /dev/null -L -w ''%{http_code}'' ${0})" != "200" ]];
do echo "Waiting for ${0}" && sleep 2;
done' ${1}
echo "OK!"
}
nomad-pack run minio -f vars/minio.hcl -f vars/lab.hcl --registry=attachmentgenie
wait-for-url https://s3.teambla.dev/minio/health/live
nomad-pack run packs/loki -f vars/loki.hcl -f vars/lab.hcl
Questions Before Takeoff?
bram@attachmentgenie.com
@attachmentgenie
https://www.slideshare.net/attachmentgenie

More Related Content

PPTX
Secure container: Kata container and gVisor
PDF
Securing Prometheus exporters using HashiCorp Vault
PDF
Easy Cloud Native Transformation using HashiCorp Nomad
PDF
[XECon2016] A-4 조정현 GitHub + Jenkins + Docker로 자동배포 시스템 구축하기
PDF
Prometheus Storage
PPTX
A brief study on Kubernetes and its components
PDF
Operator SDK for K8s using Go
PDF
Docker swarm introduction
Secure container: Kata container and gVisor
Securing Prometheus exporters using HashiCorp Vault
Easy Cloud Native Transformation using HashiCorp Nomad
[XECon2016] A-4 조정현 GitHub + Jenkins + Docker로 자동배포 시스템 구축하기
Prometheus Storage
A brief study on Kubernetes and its components
Operator SDK for K8s using Go
Docker swarm introduction

What's hot (20)

PDF
Exploring the power of OpenTelemetry on Kubernetes
PDF
Kubernetes Security Best Practices - With tips for the CKS exam
PDF
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
PDF
Observables in Angular
PDF
PDF
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
PPTX
How Kubernetes scheduler works
PPTX
Kubernetes and container security
PDF
Ansible - Introduction
PDF
Kubernetes security
PDF
Free GitOps Workshop + Intro to Kubernetes & GitOps
PPTX
Initiation à Express js
PDF
Introduction to Docker
PDF
Introduction to Docker - VIT Campus
PDF
Kubernetes Secrets Management on Production with Demo
PDF
A Hands-on Introduction to Docker
PDF
Midi technique - présentation docker
PDF
Best Practices for Getting Started with NGINX Open Source
PDF
Extending kubernetes with CustomResourceDefinitions
PDF
Configuration Management in Ansible
Exploring the power of OpenTelemetry on Kubernetes
Kubernetes Security Best Practices - With tips for the CKS exam
Architecture Overview: Kubernetes with Red Hat Enterprise Linux 7.1
Observables in Angular
Helm - the Better Way to Deploy on Kubernetes - Reinhard Nägele - Codemotion...
How Kubernetes scheduler works
Kubernetes and container security
Ansible - Introduction
Kubernetes security
Free GitOps Workshop + Intro to Kubernetes & GitOps
Initiation à Express js
Introduction to Docker
Introduction to Docker - VIT Campus
Kubernetes Secrets Management on Production with Demo
A Hands-on Introduction to Docker
Midi technique - présentation docker
Best Practices for Getting Started with NGINX Open Source
Extending kubernetes with CustomResourceDefinitions
Configuration Management in Ansible
Ad

Similar to 10 things i learned building nomad-packs (20)

PDF
10 things I learned building Nomad packs
PDF
Easy Cloud Native Transformation with Nomad
PDF
Uncomplicated Nomad
PDF
Running trusted payloads with Nomad and Waypoint
PPTX
Modern Scheduling for Modern Applications with Nomad
PDF
Running Trusted Payload with Nomad and Waypoint
PDF
Ground Control to Nomad Job Dispatch
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Openstack Quantum + Devstack Tutorial
ODP
Puppet and the HashiCorp Suite
PPTX
Couch to OpenStack: Nova - July, 30, 2013
PDF
20220608 - Luxembourg HUG Meetup
PDF
Open nebula froscon
PDF
Homologous Apache Spark Clusters Using Nomad with Alex Dadgar
PDF
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
PPTX
Couch to OpenStack: Glance - July, 23, 2013
PDF
DACHNUG50 EVERYTHING-you-need-to-know-about-HCL-Nomad-Web.pdf
PDF
Bare Metal to OpenStack with Razor and Chef
PDF
Autoscaling with hashi_corp_nomad
10 things I learned building Nomad packs
Easy Cloud Native Transformation with Nomad
Uncomplicated Nomad
Running trusted payloads with Nomad and Waypoint
Modern Scheduling for Modern Applications with Nomad
Running Trusted Payload with Nomad and Waypoint
Ground Control to Nomad Job Dispatch
Nomad by HashiCorp Presentation (DevOps)
Nomad by HashiCorp Presentation (DevOps)
Openstack Quantum + Devstack Tutorial
Puppet and the HashiCorp Suite
Couch to OpenStack: Nova - July, 30, 2013
20220608 - Luxembourg HUG Meetup
Open nebula froscon
Homologous Apache Spark Clusters Using Nomad with Alex Dadgar
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
Couch to OpenStack: Glance - July, 23, 2013
DACHNUG50 EVERYTHING-you-need-to-know-about-HCL-Nomad-Web.pdf
Bare Metal to OpenStack with Razor and Chef
Autoscaling with hashi_corp_nomad
Ad

More from Bram Vogelaar (20)

PPTX
Terraforming your Platform Engineering organisation.pptx
PDF
Secure second days operations with Boundary and Vault.pdf
PDF
Cost reconciliation in a post CMDB world
PDF
Self scaling Multi cloud nomad workloads
PDF
Scraping metrics for fun and profit
PDF
Observability; a gentle introduction
PDF
CICD using jenkins and Nomad
PDF
Bootstrapping multidc observability stack
PDF
Gamification of Chaos Testing
PDF
Puppet and the HashiStack
PDF
Bootstrapping multidc observability stack
PPTX
Creating Reusable Puppet Profiles
PDF
Gamification of Chaos Testing
PDF
Observability with Consul Connect
PDF
Testing your infrastructure with litmus
PDF
Devops its not about the tooling
PDF
High Available Drupal
PDF
Over engineering your personal website
PDF
Integrating icinga2 and the HashiCorp suite
ODP
Integrating icinga2 and the HashiCorp suite
Terraforming your Platform Engineering organisation.pptx
Secure second days operations with Boundary and Vault.pdf
Cost reconciliation in a post CMDB world
Self scaling Multi cloud nomad workloads
Scraping metrics for fun and profit
Observability; a gentle introduction
CICD using jenkins and Nomad
Bootstrapping multidc observability stack
Gamification of Chaos Testing
Puppet and the HashiStack
Bootstrapping multidc observability stack
Creating Reusable Puppet Profiles
Gamification of Chaos Testing
Observability with Consul Connect
Testing your infrastructure with litmus
Devops its not about the tooling
High Available Drupal
Over engineering your personal website
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

10 things i learned building nomad-packs

  • 1. 10 things i learned building Nomad packs Bram Vogelaar @attachmentgenie
  • 2. Confidential and Proprietary ~ ❯ whoami => Bram Vogelaar • Used to be a Molecular Biologist • Then became a Dev, now an Ops • Currently Cloud Engineer @ The Factory • Amsterdam HUG organizer
  • 3. Confidential and Proprietary Nomad • Open-source tool for dynamic workload scheduling • Batch, containerized, and non-containerized applications. • Has native Consul and Vault integrations. • Has token based access setup. • Jobs written in (H)ashiCorp (C)onfiguration (L)anguage https://www.nomadproject.io/
  • 4. Confidential and Proprietary Nomad Job Structure job "lorem-ipsum" { group ”frontend" { network { port "http" { to = ”3000” } } service { name = ”lorem" port. = ”http" } task "server" { driver = "docker" config { image = ”cicero/lorem-ipsum:v1.0.0" ports = ["http"] } } }
  • 5. Confidential and Proprietary Surprisingly Dynamic job "lorem-ipsum" { group ”frontend" { network { port "http" { to = ”3000” } } service { name = ”lorem" port. = ”http" } task "server" { driver = "docker" config { image = ”cicero/lorem-ipsum:v1.0.0" ports = ["http"] } } }
  • 6. Confidential and Proprietary Incredibly Dynamic ● Data Centers ● Region ● Namespace ● Constraints ● Count ● Restart Configuration ● Network ● Volumes ● Service Checks ● Consul Connect ● Resource Limits ● Artifacts ● Templates ● Autoscaler Configuration
  • 8. Confidential and Proprietary Nomad Pack • Templating and Packaging tool • Easily deploy popular applications to Nomad • Re-use common patterns across internal applications • Find and share job definitions with the Nomad community • Jobs written in (H)ashiCorp (C)onfiguration (L)anguage • Templates are written using Go Template Syntax. • Nightlies only right now! https://github.com/hashicorp/nomad-pack
  • 9. Confidential and Proprietary Pack Registries $ nomad-pack registry list $ nomad-pack registry add o11y https://github.com/attachmentgenie/nomad-pack-o11y-registry $ nomad-pack run grafana --var job_name=dashboard --registry=o11y $ nomad-pack run packs/grafana -f vars/grafana.hcl –f vars/lab.hcl https://github.com/hashicorp/nomad-pack-o11y-registry
  • 10. Confidential and Proprietary Default Registry $ nomad-pack registry list PACK NAME | REF | METADATA VERSION | REGISTRY | REGISTRY URL -----------------------------+--------+------------------+-----------------+----------------------------- alertmanager | latest | 0.0.1 | default | github.com/hashicorp aws_efs_csi | latest | 0.0.1 | default | github.com/hashicorp mkdir –p $HOME/.nomad/packs/default on offline systems!
  • 11. Confidential and Proprietary Pack Structure lorem-ipsum ❯ tree |-- CHANGELOG.md |-- README.md |-- metadata.hcl |-- outputs.tpl |-- templates | |-- _helpers.tpl | `-- lorem-ipsum.nomad.tpl `-- variables.hcl 1 directory, 7 files
  • 12. Confidential and Proprietary metadata.hcl app { url = "https://grafana.com/" author = "Grafana Labs" } pack { name = "grafana" description = "Grafana is a multi-platform open source analytics and interactive visualization tool." url = "https://github.com/attachmentgenie/nomad-pack-o11y-registry/grafana" version = "0.1.0" }
  • 13. Confidential and Proprietary variables.hcl variable "datacenters" { description = "A list of datacenters in the region which are eligible for task placement" type = list(string) default = [“dc1”] } Variable “resources” { description = “The resource to assign to the Grafana service task” type = object({ cpu = number memory = number }) default = { cpu = 200, memory = 256 } }
  • 14. Confidential and Proprietary Pack Templates $ cat packs/grafana/templates/grafana.nomad.tpl …. datacenters = [[ .my.datacenters | toStringList ]] … resources { cpu = [[ .my.grafana_resources.cpu ]] memory = [[ .my.grafana_resources.memory ]] } … https://github.com/hashicorp/nomad-pack-community-registry
  • 15. Confidential and Proprietary CI-CD $ nomad-pack plan packs/loki --var version=vX.Y.Z -f vars/loki.hcl +/- Job: "loki" + VaultToken: "s.IJcEJqpsCkGU0mfY3GmnCLSd" +/- Task Group: "loki" (1 create, 2 in-place update) +/- Count: "2" => "3" (forces create) Task: "connect-proxy-loki" Task: "server" » Scheduler dry-run: - All tasks successfully allocated. Plan succeeded $ nomad-pack nomad-pack run packs/loki --var version=vX.Y.Z -f vars/loki.hcl
  • 16. Confidential and Proprietary CI-CD Paranoid Version $ nomad-pack render packs/loki --var version=vX.Y.Z -f vars/loki.hcl -o $WORKSPACE/render $ nomad run $WORKSPACE/render/loki/loki.nomad https://github.com/marketplace/actions/setup-hashicorp-nomad-pack
  • 18. Confidential and Proprietary Helper template $ cat packs/grafana/templates/grafana.nomad.tpl job [[ template "job_name" . ]] { [[ template "region" . ]] [[ template "namespace" . ]] …. $ cat packs/grafana/templates/_helpers.tpl … [[- define "job_name" -]] [[- if eq .grafana.job_name "" -]] [[- .nomad_pack.pack.name | quote -]] [[- else -]] [[- .grafana.job_name | quote -]] [[- end -]] [[- end -]] …
  • 19. Confidential and Proprietary Abstracting away boring repetitive bits $ cat packs/grafana/templates/_helpers.tpl … [[ define "resources" -]] [[- $resources := . ]] resources { cpu = [[ $resources.cpu ]] memory = [[ $resources.memory ]] } [[- end ]] … $ cat packs/grafana/templates/grafana.nomad.tpl … [[ template " resources " . ]] …
  • 20. Confidential and Proprietary Abstracting away boring repetitive bits $ cat packs/grafana/templates/_resources.tpl … [[ define "resources" -]] [[- $resources := . ]] resources { cpu = [[ $resources.cpu ]] memory = [[ $resources.memory ]] } [[- end ]] … $ cat packs/grafana/templates/grafana.nomad.tpl … [[ template " resources " . ]] …
  • 21. Confidential and Proprietary Abstracting away boring repetitive bits $ cat packs/grafana/metadata.hcl … dependency ”hashitalks_helpers" { name = "hashitalks_helpers" source = "https://github.com/attachmentgenie/hashitalks-registry/helpers" } $ cat packs/grafana/templates/grafana.nomad.tpl … [[ template "hashitalks_helpers .resources" . ]] …
  • 22. Confidential and Proprietary Wishlist: pre-commit-nomad Currently no clear alternatives/equivalents for: Terraform_docs Terraform_fmt Terraform_tflint Terraform_validate Terrascan
  • 23. Confidential and Proprietary Wishlist: Locals network { mode = "bridge" port "mysql" { to = 3306 <- local.mysql_port } } [[ if .my.register_consul_service ]] service { name = "[[ .my.consul_service_name ]]" tags = [[ .my.consul_service_tags | toStringList ]] port = "mysql" connect { sidecar_service { tags = [""] proxy { local_service_port = 3306 <- local.mysql_port …
  • 24. Confidential and Proprietary Wishlist: Meta package support $ cat deploy.sh #!/bin/bash set -e nomad-pack run minio -f vars/minio.hcl -f vars/lab.hcl --registry=attachmentgenie nomad-pack run packs/loki -f vars/loki.hcl -f vars/lab.hcl nomad-pack run packs/mimir -f vars/mimir.hcl -f vars/lab.hcl nomad-pack run packs/phlare -f vars/phlare.hcl -f vars/lab.hcl nomad-pack run packs/tempo -f vars/tempo.hcl -f vars/lab.hcl nomad-pack run packs/grafana -f vars/grafana.hcl -f vars/lab.hcl nomad-pack run redis -f vars/redis.hcl -f vars/lab.hcl --registry=attachmentgenie nomad-pack run packs/grafana_oncall -f vars/grafana_oncall.hcl -f vars/lab.hcl nomad-pack run packs/prometheus -f vars/prometheus.hcl -f vars/lab.hcl nomad-pack run packs/promlens -f vars/promlens.hcl -f vars/lab.hcl
  • 25. Confidential and Proprietary Wishlist: Dependency health checks $ cat deploy.sh #!/bin/bash set -e export NOMAD_ADDR=http://192.168.1.30:4646/ui/jobs wait-for-url() { echo "Testing $1" timeout -s TERM 45 bash -c 'while [[ "$(curl -s -o /dev/null -L -w ''%{http_code}'' ${0})" != "200" ]]; do echo "Waiting for ${0}" && sleep 2; done' ${1} echo "OK!" } nomad-pack run minio -f vars/minio.hcl -f vars/lab.hcl --registry=attachmentgenie wait-for-url https://s3.teambla.dev/minio/health/live nomad-pack run packs/loki -f vars/loki.hcl -f vars/lab.hcl