SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
Jsonnet, Terraform & Packer
Dave Cunningham
Software Engineer, Google Cloud
Devops Days Denver
2015-04-23
Overview
1. Intro to Terraform
2. Intro to Packer
3. Intro to Jsonnet
4. Cloud App Management
Methodology
(Fractal Demo)
}
myservice.tf
apply
Resources
Forwarding
Rule
Forwarding
Rule
Address
Disk
Route Firewall
Health
Check
Target
Pool
Network
Address
Instance
Target
Pool
Address
Instance
Instance
InstanceInstanceInstance
Address
The first time:
1. Builds plan
○ Ordered by
Dependency
○ Parallelized
2. Executes plan
3. Writes local state file
Subsequent changes:
1. Examine & refresh state
2. Diff, build plan
○ Ordered by
Dependency
○ Parallelized
○ Minimally disruptive
3. Executes plan
4. Updates local state file
Terraform By Hashicorp
http://www.terraform.io/
Provider & credentials
Provider & credentials
Build images, content defined by a JSON configuration file:
{
"builders": [{
"type": "googlecompute",
"source_image": "debian-7-wheezy-v20140718",
.. credentials ..
}],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo apt-get update",
"sudo apt-get install -y redis-server"
]
},
...
]
}
Packer By Mitchell Hashimoto (Hashicorp founder)
http://www.packer.io
Jsonnet https://google.github.io/jsonnet/doc/
Addresses the config
language problem:
Write
application
Simple
config file
+ Comments + vars
+ String arith
+ conditionals+ repetition
+ int arith
Turing
completeness!!1
+ templates
+ closures
+ user def.
functions
Typical config
language
Hazards of ad-hoc language design:
Jsonnet https://google.github.io/jsonnet/doc/
Complex / surprising
behaviorNo specification:
difficult to develop
tools
Feature creep
(overlapping
features)
Ugly implementation
Hard to improve /
replace
implementation with
same semantics
Hard to port
implementation (e.g.
to Javascript)
Use existing general purpose
scripting language?
Write
application
Simple
config file
Python / Go /
Ruby / Lua /
etc.
Jsonnet https://google.github.io/jsonnet/doc/
Not hermetic: Can yield
different config in
different environment
Designed for
specifying
behavior, not
data
Code cannot be
substituted with data
(side effects)
Heavyweight
implementations
Jsonnet https://google.github.io/jsonnet/doc/
// Trivial Example
{
person1: {
name: "Alice",
welcome: "Hello " + self.name + "!",
},
person2: self.person1 { name: "Bob" },
}
{
"person1": {
"name": "Alice",
"welcome": "Hello Alice!"
},
"person2": {
"name": "Bob",
"welcome": "Hello Bob!"
}
}
➡
A configuration language designed like a programming language
● Simple: Just 9 features, (3 are from JSON)
○ Literals, arrays, objects, variables, conditionals, arithmetic, closures, mixins, errors
● Powerful: Multi-paradigm (supports OO and functional)
● Hermetic: Repeatable evaluation, code/data interchangeable
● Familiar: All syntax and semantics compatible with JSON / Python
● Concise: Code / data interleaving, prototype inheritance
● Formal: Complete operational semantics
Application Server
Application Server
Application Server
Application Server
Application ServerTile Generation
Service
Cassandra
Cassandra
Cassandra
HTTP
HTTP
Cassandra protocol
Live version
Fractal Application Architecture
Jsonnet
configuration
Jsonnet
configuration
Jsonnet
configuration
One logical configuration,
perhaps broken into several files
by import constructs.
appserv.packer.json
cassandra.packer.json
tilegen.packer.json
{
"appserv.packer.json": ...,
"cassandra.packer.json": ...,
"tilegen.packer.json": ...,
"terraform.tf": ...
}
Multiple output mode:
Configuration defines
several files
terraform.tf
Jsonnet evaluation
Centralize ALL configuration
Use a makefile: Invoke Jsonnet, run Packer and Terraform on JSON output:
● Build multiple images in parallel, only if config changed
● Just run make -j to build images and deploy / update cloud application
infrastructure, system, daemons, databases, builds, ...
● Abstraction - say less
○ Build template libraries, factor out repetitive code
■ Both tilegen and appserv use Nginx + uWSGI + Flask
○ Override bits of default Nginx / uWSGI / Cassandra configs as needed
○ Higher level templates allow listing of apt packages, repos, keys, etc
● Synchronize details
○ Backend endpoints / credentials feature in
■ frontend / backend application config (packer configs)
■ infrastructure (metadata, firewalls, health checks, load balancer...)
Advantages of this methodology
Packer + Terraform + Jsonnet methodology:
● Simple, powerful, centralized, unopinionated
● Straightforward combination of tools
● Arbitrarily complex use cases
Conclusion
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Docker.io
Docker.ioDocker.io
Docker.io
 
Improving the ZFS Userland-Kernel API with Channel Programs - BSDCAN 2017 - M...
Improving the ZFS Userland-Kernel API with Channel Programs - BSDCAN 2017 - M...Improving the ZFS Userland-Kernel API with Channel Programs - BSDCAN 2017 - M...
Improving the ZFS Userland-Kernel API with Channel Programs - BSDCAN 2017 - M...
 
Fluentd unified logging layer
Fluentd   unified logging layerFluentd   unified logging layer
Fluentd unified logging layer
 
GlusterFS As an Object Storage
GlusterFS As an Object StorageGlusterFS As an Object Storage
GlusterFS As an Object Storage
 
Fluentd vs. Logstash for OpenStack Log Management
Fluentd vs. Logstash for OpenStack Log ManagementFluentd vs. Logstash for OpenStack Log Management
Fluentd vs. Logstash for OpenStack Log Management
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
 
Docker Intro
Docker IntroDocker Intro
Docker Intro
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
NoSQL and SQL Anti Patterns
NoSQL and SQL Anti PatternsNoSQL and SQL Anti Patterns
NoSQL and SQL Anti Patterns
 
mesos-devoxx14
mesos-devoxx14mesos-devoxx14
mesos-devoxx14
 
Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...
Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...
Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::Client
 
Fluentd and WebHDFS
Fluentd and WebHDFSFluentd and WebHDFS
Fluentd and WebHDFS
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshell
 
Fluentd introduction at ipros
Fluentd introduction at iprosFluentd introduction at ipros
Fluentd introduction at ipros
 
The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
 
Flink Forward Berlin 2017: Stefan Richter - A look at Flink's internal data s...
Flink Forward Berlin 2017: Stefan Richter - A look at Flink's internal data s...Flink Forward Berlin 2017: Stefan Richter - A look at Flink's internal data s...
Flink Forward Berlin 2017: Stefan Richter - A look at Flink's internal data s...
 
Resource planning on the (Amazon) cloud
Resource planning on the (Amazon) cloudResource planning on the (Amazon) cloud
Resource planning on the (Amazon) cloud
 
gRPC in Go
gRPC in GogRPC in Go
gRPC in Go
 
An Updated Performance Comparison of Virtual Machines and Linux Containers
An Updated Performance Comparison of Virtual Machines and Linux ContainersAn Updated Performance Comparison of Virtual Machines and Linux Containers
An Updated Performance Comparison of Virtual Machines and Linux Containers
 

Andere mochten auch

Infrastructure as code with Terraform
Infrastructure as code with TerraformInfrastructure as code with Terraform
Infrastructure as code with Terraform
Sam Bashton
 

Andere mochten auch (20)

Packer
PackerPacker
Packer
 
Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure Provisioning
 
Terraform
TerraformTerraform
Terraform
 
Terraform and cloud.ca
Terraform and cloud.caTerraform and cloud.ca
Terraform and cloud.ca
 
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
Introduction to Packer and Suitcase: A Packer-based OS Image Build SystemIntroduction to Packer and Suitcase: A Packer-based OS Image Build System
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
 
Infrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to TerraformInfrastructure as Code: Introduction to Terraform
Infrastructure as Code: Introduction to Terraform
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-TannerDevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
 
Terraform at Scale
Terraform at ScaleTerraform at Scale
Terraform at Scale
 
Etcd terraform by Alex Somesan
Etcd terraform by Alex SomesanEtcd terraform by Alex Somesan
Etcd terraform by Alex Somesan
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)
 
Terraform Introduction
Terraform IntroductionTerraform Introduction
Terraform Introduction
 
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
2016 - IGNITE - Terraform to go from Zero to Prod in less than 1 month and TH...
 
Refactoring terraform
Refactoring terraformRefactoring terraform
Refactoring terraform
 
TerraformでECS+ECRする話
TerraformでECS+ECRする話TerraformでECS+ECRする話
TerraformでECS+ECRする話
 
Rediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred TshidimbaRediscovering Developer Opportunities in the Philippines by Fred Tshidimba
Rediscovering Developer Opportunities in the Philippines by Fred Tshidimba
 
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and AnsibleService Delivery Assembly Line with Vagrant, Packer, and Ansible
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
 
Infrastructure as code with Terraform
Infrastructure as code with TerraformInfrastructure as code with Terraform
Infrastructure as code with Terraform
 
London Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in ProductionLondon Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in Production
 

Ähnlich wie Jsonnet, terraform & packer

Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
Akshaya Mahapatra
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
WalaSidhom1
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 

Ähnlich wie Jsonnet, terraform & packer (20)

Serve Meals, Not Ingredients (ChefConf 2015)
Serve Meals, Not Ingredients (ChefConf 2015)Serve Meals, Not Ingredients (ChefConf 2015)
Serve Meals, Not Ingredients (ChefConf 2015)
 
Serve Meals, Not Ingredients - ChefConf 2015
Serve Meals, Not Ingredients - ChefConf 2015Serve Meals, Not Ingredients - ChefConf 2015
Serve Meals, Not Ingredients - ChefConf 2015
 
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
 
React october2017
React october2017React october2017
React october2017
 
Learn Cloud-Native .NET: Core Configuration Fundamentals with Steeltoe
Learn Cloud-Native .NET: Core Configuration Fundamentals with SteeltoeLearn Cloud-Native .NET: Core Configuration Fundamentals with Steeltoe
Learn Cloud-Native .NET: Core Configuration Fundamentals with Steeltoe
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with Express
 
Hadoop institutes in Bangalore
Hadoop institutes in BangaloreHadoop institutes in Bangalore
Hadoop institutes in Bangalore
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
 
Новый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныНовый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоны
 
London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 12/4
 
What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Monitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusMonitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheus
 
Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh
 
MeteorJS Meetup
MeteorJS MeetupMeteorJS Meetup
MeteorJS Meetup
 
Exploring Node.jS
Exploring Node.jSExploring Node.jS
Exploring Node.jS
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

Jsonnet, terraform & packer

  • 1. Jsonnet, Terraform & Packer Dave Cunningham Software Engineer, Google Cloud Devops Days Denver 2015-04-23
  • 2. Overview 1. Intro to Terraform 2. Intro to Packer 3. Intro to Jsonnet 4. Cloud App Management Methodology (Fractal Demo) }
  • 3. myservice.tf apply Resources Forwarding Rule Forwarding Rule Address Disk Route Firewall Health Check Target Pool Network Address Instance Target Pool Address Instance Instance InstanceInstanceInstance Address The first time: 1. Builds plan ○ Ordered by Dependency ○ Parallelized 2. Executes plan 3. Writes local state file Subsequent changes: 1. Examine & refresh state 2. Diff, build plan ○ Ordered by Dependency ○ Parallelized ○ Minimally disruptive 3. Executes plan 4. Updates local state file Terraform By Hashicorp http://www.terraform.io/ Provider & credentials Provider & credentials
  • 4. Build images, content defined by a JSON configuration file: { "builders": [{ "type": "googlecompute", "source_image": "debian-7-wheezy-v20140718", .. credentials .. }], "provisioners": [ { "type": "shell", "inline": [ "sudo apt-get update", "sudo apt-get install -y redis-server" ] }, ... ] } Packer By Mitchell Hashimoto (Hashicorp founder) http://www.packer.io
  • 5. Jsonnet https://google.github.io/jsonnet/doc/ Addresses the config language problem: Write application Simple config file + Comments + vars + String arith + conditionals+ repetition + int arith Turing completeness!!1 + templates + closures + user def. functions Typical config language
  • 6. Hazards of ad-hoc language design: Jsonnet https://google.github.io/jsonnet/doc/ Complex / surprising behaviorNo specification: difficult to develop tools Feature creep (overlapping features) Ugly implementation Hard to improve / replace implementation with same semantics Hard to port implementation (e.g. to Javascript)
  • 7. Use existing general purpose scripting language? Write application Simple config file Python / Go / Ruby / Lua / etc. Jsonnet https://google.github.io/jsonnet/doc/ Not hermetic: Can yield different config in different environment Designed for specifying behavior, not data Code cannot be substituted with data (side effects) Heavyweight implementations
  • 8. Jsonnet https://google.github.io/jsonnet/doc/ // Trivial Example { person1: { name: "Alice", welcome: "Hello " + self.name + "!", }, person2: self.person1 { name: "Bob" }, } { "person1": { "name": "Alice", "welcome": "Hello Alice!" }, "person2": { "name": "Bob", "welcome": "Hello Bob!" } } ➡ A configuration language designed like a programming language ● Simple: Just 9 features, (3 are from JSON) ○ Literals, arrays, objects, variables, conditionals, arithmetic, closures, mixins, errors ● Powerful: Multi-paradigm (supports OO and functional) ● Hermetic: Repeatable evaluation, code/data interchangeable ● Familiar: All syntax and semantics compatible with JSON / Python ● Concise: Code / data interleaving, prototype inheritance ● Formal: Complete operational semantics
  • 9. Application Server Application Server Application Server Application Server Application ServerTile Generation Service Cassandra Cassandra Cassandra HTTP HTTP Cassandra protocol Live version Fractal Application Architecture
  • 10. Jsonnet configuration Jsonnet configuration Jsonnet configuration One logical configuration, perhaps broken into several files by import constructs. appserv.packer.json cassandra.packer.json tilegen.packer.json { "appserv.packer.json": ..., "cassandra.packer.json": ..., "tilegen.packer.json": ..., "terraform.tf": ... } Multiple output mode: Configuration defines several files terraform.tf Jsonnet evaluation Centralize ALL configuration Use a makefile: Invoke Jsonnet, run Packer and Terraform on JSON output: ● Build multiple images in parallel, only if config changed ● Just run make -j to build images and deploy / update cloud application infrastructure, system, daemons, databases, builds, ...
  • 11. ● Abstraction - say less ○ Build template libraries, factor out repetitive code ■ Both tilegen and appserv use Nginx + uWSGI + Flask ○ Override bits of default Nginx / uWSGI / Cassandra configs as needed ○ Higher level templates allow listing of apt packages, repos, keys, etc ● Synchronize details ○ Backend endpoints / credentials feature in ■ frontend / backend application config (packer configs) ■ infrastructure (metadata, firewalls, health checks, load balancer...) Advantages of this methodology
  • 12. Packer + Terraform + Jsonnet methodology: ● Simple, powerful, centralized, unopinionated ● Straightforward combination of tools ● Arbitrarily complex use cases Conclusion Questions?