SlideShare a Scribd company logo
1 of 25
Download to read offline
10 things i learned building
Nomad packs
Bram Vogelaar
@attachmentgenie
• Used to be a Molecular Biologist
• Then became a Dev, now an Ops
• Currently Cloud Engineer @ The Factory
• Amsterdam HUG organizer
• Almost author => Workload Orchestration Made Easy With Nomad
$ whoami
l Open-source tool for dynamic workload scheduling
l Batch, containerized, and non-containerized applications.
l Has native Consul and Vault integrations.
l Has token based access setup.
l Jobs written in (H)ashiCorp (C)onfiguration (L)anguage
https://www.nomadproject.io/
Nomad
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"]
}
}
}
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"]
}
}
}
Job configuration includes options for but is not limited to:
• Datacenters
• Region
• Namespace
• Constraints
• Count
• Restart Configuration
• Network
• Volumes
• Service Checks
• Consul Connect
• Resource Limits
• Artifacts
• Templates
• Autoscaler Configuration
Incredibly Dynamic
UX Pyramid
• Levant
• 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!
Nomad Pack
https://github.com/hashicorp/nomad-pack
$ 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
Pack Registries
https://github.com/hashicorp/nomad-pack-o11y-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
Default registry
mkdir –p $HOME/.nomad/packs/default on offline systems!
lorem-ipsum ❯ tree
|-- CHANGELOG.md
|-- README.md
|-- metadata.hcl
|-- outputs.tpl
|-- templates
| |-- _helpers.tpl
| `-- lorem-ipsum.nomad.tpl
`-- variables.hcl
1 directory, 7 files
Pack Structure
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"
}
metadata.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
}
}
variables.hcl
$ cat packs/grafana/templates/grafana.nomad.tpl
….
datacenters = [[ .my.datacenters | toStringList ]]
…
resources {
cpu = [[ .my.grafana_resources.cpu ]]
memory = [[ .my.grafana_resources.memory ]]
}
…
Pack Templates
https://github.com/hashicorp/nomad-pack-community-registry
$ 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
CI-CD
$ nomad-pack render packs/loki --var version=vX.Y.Z -f vars/loki.hcl -o $WORKSPACE/render
$ nomad run $WORKSPACE/render/loki/loki.nomad
CI-CD Paranoid Version
https://github.com/marketplace/actions/setup-hashicorp-nomad-pack
Nomad UI
$ 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 -]]
…
Helper template
$ 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 " . ]]
…
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 " . ]]
…
Abstracting away boring repetitive bits
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" . ]]
…
Currently no clear alternatives/equivalents for:
• Terraform_docs
• Terraform_fmt
• Terraform_tflint
• Terraform_validate
• Terrascan
Wishlist: pre-commit-nomad?
$ 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
Wishlist: Meta package support
$ 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
Wishlist: Dependency health checks
Questions ?
The Floor is yours…
bram@attachmentgenie.com
@attachmentgenie
https://www.slideshare.net/attachmentgenie

More Related Content

What's hot

Scaling Asterisk with Kamailio
Scaling Asterisk with KamailioScaling Asterisk with Kamailio
Scaling Asterisk with KamailioFred Posner
 
Swagger AEM - An OpenAPI Specification for AEM
Swagger AEM - An OpenAPI Specification for AEMSwagger AEM - An OpenAPI Specification for AEM
Swagger AEM - An OpenAPI Specification for AEMCliffano Subagio
 
Kubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on KubernetesKubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on KubernetesJeffrey Holden
 
Cloud native development without the toil
Cloud native development without the toilCloud native development without the toil
Cloud native development without the toilAmbassador Labs
 
FreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of LinuxFreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of LinuxJulian Catrambone
 
eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019Brendan Gregg
 
Cfgmgmtcamp 2023 — eBPF Superpowers
Cfgmgmtcamp 2023 — eBPF SuperpowersCfgmgmtcamp 2023 — eBPF Superpowers
Cfgmgmtcamp 2023 — eBPF SuperpowersRaphaël PINSON
 
Hashicorp Corporate and Product Overview
Hashicorp Corporate and Product OverviewHashicorp Corporate and Product Overview
Hashicorp Corporate and Product OverviewStenio Ferreira
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityThomas Graf
 
Présentation de nagios
Présentation de nagiosPrésentation de nagios
Présentation de nagiosilyassin
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Matt Raible
 
CloudStack and cloud-init
CloudStack and cloud-initCloudStack and cloud-init
CloudStack and cloud-initMarcusS13
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the WebCodeValue
 
Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes smalltown
 
Enterprise Storage NAS - Dual Controller
Enterprise Storage NAS - Dual ControllerEnterprise Storage NAS - Dual Controller
Enterprise Storage NAS - Dual ControllerFernando Barrientos
 
Docker Swarm for Beginner
Docker Swarm for BeginnerDocker Swarm for Beginner
Docker Swarm for BeginnerShahzad Masud
 
Comandos cisco ccna_exploration
Comandos cisco ccna_explorationComandos cisco ccna_exploration
Comandos cisco ccna_explorationWhaleejaa Wha
 

What's hot (20)

Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Scaling Asterisk with Kamailio
Scaling Asterisk with KamailioScaling Asterisk with Kamailio
Scaling Asterisk with Kamailio
 
Breaking Bad CSP
Breaking Bad CSPBreaking Bad CSP
Breaking Bad CSP
 
Swagger AEM - An OpenAPI Specification for AEM
Swagger AEM - An OpenAPI Specification for AEMSwagger AEM - An OpenAPI Specification for AEM
Swagger AEM - An OpenAPI Specification for AEM
 
Kubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on KubernetesKubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on Kubernetes
 
Cloud native development without the toil
Cloud native development without the toilCloud native development without the toil
Cloud native development without the toil
 
FreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of LinuxFreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of Linux
 
eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019
 
Cfgmgmtcamp 2023 — eBPF Superpowers
Cfgmgmtcamp 2023 — eBPF SuperpowersCfgmgmtcamp 2023 — eBPF Superpowers
Cfgmgmtcamp 2023 — eBPF Superpowers
 
Hashicorp Corporate and Product Overview
Hashicorp Corporate and Product OverviewHashicorp Corporate and Product Overview
Hashicorp Corporate and Product Overview
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
 
Présentation de nagios
Présentation de nagiosPrésentation de nagios
Présentation de nagios
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
CloudStack and cloud-init
CloudStack and cloud-initCloudStack and cloud-init
CloudStack and cloud-init
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes
 
Enterprise Storage NAS - Dual Controller
Enterprise Storage NAS - Dual ControllerEnterprise Storage NAS - Dual Controller
Enterprise Storage NAS - Dual Controller
 
Docker Swarm for Beginner
Docker Swarm for BeginnerDocker Swarm for Beginner
Docker Swarm for Beginner
 
Comandos cisco ccna_exploration
Comandos cisco ccna_explorationComandos cisco ccna_exploration
Comandos cisco ccna_exploration
 

Similar to 10 things I learned building Nomad packs

Streamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariStreamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariAlejandro Fernandez
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationSean Chittenden
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Streamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariStreamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariAlejandro Fernandez
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsMykyta Protsenko
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management frameworkGiovanni Bechis
 
Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipelineAnton Babenko
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondNuvole
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloudKyle Rames
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...NETWAYS
 

Similar to 10 things I learned building Nomad packs (20)

Streamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariStreamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache Ambari
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern Automation
 
Puppet
PuppetPuppet
Puppet
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Streamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariStreamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache Ambari
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and Ops
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
Streamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache AmbariStreamline Hadoop DevOps with Apache Ambari
Streamline Hadoop DevOps with Apache Ambari
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Puppet Data Mining
Puppet Data MiningPuppet Data Mining
Puppet Data Mining
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipeline
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
Ansible
AnsibleAnsible
Ansible
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
 

More from Bram Vogelaar

Cost reconciliation in a post CMDB world
Cost reconciliation in a post CMDB worldCost reconciliation in a post CMDB world
Cost reconciliation in a post CMDB worldBram Vogelaar
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsBram Vogelaar
 
Scraping metrics for fun and profit
Scraping metrics for fun and profitScraping metrics for fun and profit
Scraping metrics for fun and profitBram Vogelaar
 
Easy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadEasy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadBram Vogelaar
 
Observability; a gentle introduction
Observability; a gentle introductionObservability; a gentle introduction
Observability; a gentle introductionBram Vogelaar
 
Running Trusted Payload with Nomad and Waypoint
Running Trusted Payload with Nomad and WaypointRunning Trusted Payload with Nomad and Waypoint
Running Trusted Payload with Nomad and WaypointBram Vogelaar
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultBram Vogelaar
 
CICD using jenkins and Nomad
CICD using jenkins and NomadCICD using jenkins and Nomad
CICD using jenkins and NomadBram Vogelaar
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Running trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointRunning trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointBram Vogelaar
 
Gamification of Chaos Testing
Gamification of Chaos TestingGamification of Chaos Testing
Gamification of Chaos TestingBram Vogelaar
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesBram Vogelaar
 
Gamification of Chaos Testing
Gamification of Chaos TestingGamification of Chaos Testing
Gamification of Chaos TestingBram Vogelaar
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadBram Vogelaar
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul ConnectBram Vogelaar
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 
Devops its not about the tooling
Devops its not about the toolingDevops its not about the tooling
Devops its not about the toolingBram Vogelaar
 
High Available Drupal
High Available DrupalHigh Available Drupal
High Available DrupalBram Vogelaar
 

More from Bram Vogelaar (20)

Cost reconciliation in a post CMDB world
Cost reconciliation in a post CMDB worldCost reconciliation in a post CMDB world
Cost reconciliation in a post CMDB world
 
Self scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloadsSelf scaling Multi cloud nomad workloads
Self scaling Multi cloud nomad workloads
 
Scraping metrics for fun and profit
Scraping metrics for fun and profitScraping metrics for fun and profit
Scraping metrics for fun and profit
 
Easy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadEasy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with Nomad
 
Observability; a gentle introduction
Observability; a gentle introductionObservability; a gentle introduction
Observability; a gentle introduction
 
Running Trusted Payload with Nomad and Waypoint
Running Trusted Payload with Nomad and WaypointRunning Trusted Payload with Nomad and Waypoint
Running Trusted Payload with Nomad and Waypoint
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
CICD using jenkins and Nomad
CICD using jenkins and NomadCICD using jenkins and Nomad
CICD using jenkins and Nomad
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Running trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointRunning trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and Waypoint
 
Gamification of Chaos Testing
Gamification of Chaos TestingGamification of Chaos Testing
Gamification of Chaos Testing
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet Profiles
 
Gamification of Chaos Testing
Gamification of Chaos TestingGamification of Chaos Testing
Gamification of Chaos Testing
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomad
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul Connect
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
Devops its not about the tooling
Devops its not about the toolingDevops its not about the tooling
Devops its not about the tooling
 
High Available Drupal
High Available DrupalHigh Available Drupal
High Available Drupal
 

Recently uploaded

Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsUXDXConf
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 

Recently uploaded (20)

Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 

10 things I learned building Nomad packs

  • 1. 10 things i learned building Nomad packs Bram Vogelaar @attachmentgenie
  • 2. • Used to be a Molecular Biologist • Then became a Dev, now an Ops • Currently Cloud Engineer @ The Factory • Amsterdam HUG organizer • Almost author => Workload Orchestration Made Easy With Nomad $ whoami
  • 3. l Open-source tool for dynamic workload scheduling l Batch, containerized, and non-containerized applications. l Has native Consul and Vault integrations. l Has token based access setup. l Jobs written in (H)ashiCorp (C)onfiguration (L)anguage https://www.nomadproject.io/ Nomad
  • 4. 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. 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. Job configuration includes options for but is not limited to: • Datacenters • Region • Namespace • Constraints • Count • Restart Configuration • Network • Volumes • Service Checks • Consul Connect • Resource Limits • Artifacts • Templates • Autoscaler Configuration Incredibly Dynamic
  • 8. • Levant • 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! Nomad Pack https://github.com/hashicorp/nomad-pack
  • 9. $ 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 Pack Registries https://github.com/hashicorp/nomad-pack-o11y-registry
  • 10. $ 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 Default registry mkdir –p $HOME/.nomad/packs/default on offline systems!
  • 11. lorem-ipsum ❯ tree |-- CHANGELOG.md |-- README.md |-- metadata.hcl |-- outputs.tpl |-- templates | |-- _helpers.tpl | `-- lorem-ipsum.nomad.tpl `-- variables.hcl 1 directory, 7 files Pack Structure
  • 12. 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" } metadata.hcl
  • 13. 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 } } variables.hcl
  • 14. $ cat packs/grafana/templates/grafana.nomad.tpl …. datacenters = [[ .my.datacenters | toStringList ]] … resources { cpu = [[ .my.grafana_resources.cpu ]] memory = [[ .my.grafana_resources.memory ]] } … Pack Templates https://github.com/hashicorp/nomad-pack-community-registry
  • 15. $ 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 CI-CD
  • 16. $ nomad-pack render packs/loki --var version=vX.Y.Z -f vars/loki.hcl -o $WORKSPACE/render $ nomad run $WORKSPACE/render/loki/loki.nomad CI-CD Paranoid Version https://github.com/marketplace/actions/setup-hashicorp-nomad-pack
  • 18. $ 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 -]] … Helper template
  • 19. $ 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 " . ]] … Abstracting away boring repetitive bits
  • 20. $ 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 " . ]] … Abstracting away boring repetitive bits
  • 21. 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. Currently no clear alternatives/equivalents for: • Terraform_docs • Terraform_fmt • Terraform_tflint • Terraform_validate • Terrascan Wishlist: pre-commit-nomad?
  • 23. $ 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 Wishlist: Meta package support
  • 24. $ 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 Wishlist: Dependency health checks
  • 25. Questions ? The Floor is yours… bram@attachmentgenie.com @attachmentgenie https://www.slideshare.net/attachmentgenie