SlideShare a Scribd company logo
1 of 28
Download to read offline
Orchestrate  Event-­‐Driven  
Infrastructure  with  SaltStack
Love  Nyberg  
Site  reliability  &  Automa@on  Engineer
SaltStack
SaltStack  is  extremely  fast  and  scalable  systems  and  
configura@on  management  soDware  for  predic@ve  
orchestra@on,  cloud  and  data  center  automa@on,  server  
provisioning,  applica@on  deployment  and  more.
Agenda
  salt  @  bloglovin  
  Terminology  
  Orchestrate  
  Reactor  
  Beacons
salt  @  bloglovin
tens  of  millions  of  monthly  unique  visitors  
hundred  of  millions  requests  per  day  
couple  of  million  stories  parsed  per  day  
hybrid  bare  metal  servers/cloud  vm’s  
2  salt  masters  
~90  salt  minions
salt  @  bloglovin
Parts  we  use!  
States/Pillars/Grains  
Orchestrate  
Reactor  
Salt  Api  
Salt  Cloud
Terminology
Configura)on  
Master/Minion  
Masterless  
Transport  
ZeroMQ  
Raet  
SSH  
Parts  
States  
Modules  
Grains  
Pillars  
Execu@on
salt '<target>' <function> [arguments]
Execu@on  modules
root@master:/# salt minion_love network.interface eth0
minion_love:
|_
----------
address:
172.17.0.9
broadcast:
None
label:
eth0
netmask:
255.255.0.0
Execu@on  modules
root@master:~# salt minion1 cmd.run "ip addr show eth0"
minion1:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc
pfifo_fast state UP group default qlen 1000
link/ether 12:4b:af:05:be:cd brd ff:ff:ff:ff:ff:ff
inet 10.0.0.206/24 brd 10.0.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::104b:afff:fe05:becd/64 scope link
valid_lft forever preferred_lft forever
State
/srv/salt/state/sshd/init.sls
ssh:
pkg.latest
- name: openssh-server
salt test_minion state.sls ssh
State/Execu@on
/srv/salt/state/sshd/init.sls
ssh:
pkg.latest
- name: openssh-server
root@master:/# salt test_minion pkg.latest_version openssh-server
{%- set ips = salt['network.ip_addrs'](None, False, '172.17.0.0/24')
%}
ssh:
pkg.latest
- name: openssh-server
service.running:
- enable: True
- watch:
- file: ssh
- pkg: ssh
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://sshd/files/sshd_config
- template: jinja
- context:
ips: {{ ips }}
Grains
via state
root@mon1:/# salt minion_love grains.get ip_interfaces:eth0
minion_love:
- 172.17.0.9
within a state file



{%- set eth0 = salt['grains.get'](ip_interfaces:eth0, '') %}
Pillar
root@master:/# salt minion_love pillar.item secrets
minion_love:
----------
secrets:
----------
foo:
bar
Apply  state
root@master:/# salt minion_love state.highstate
salt '<target>' <function> [arguments]
Event  system
Event  system  is  a  local  ZeroMQ  PUB  interface  which  fires  salt  events  
Every  event  has  a  tag  and  a  data  structure
Event  chain  `test.ping`
Event fired at Wed May 27 22:00:14 2015
*************************
Tag: new_job
Data:
{'_stamp': '2015-05-27T20:00:14.774445',
'arg': [],
'fun': 'test.ping',
'jid': '20150527220014773556',
'minions': ['minion_love'],
'tgt': 'minion_love',
'tgt_type': 'glob',
'user': 'sudo_love'}
Event  chain  `test.ping`
Event fired at Wed May 27 22:00:14 2015
*************************
Tag: salt/job/20150527220014773556/ret/mon1
Data:
{'_stamp': '2015-05-27T20:00:14.981640',
'cmd': '_return',
'fun': 'test.ping',
'fun_args': [],
'id': ‘minion_love',
'jid': '20150527220014773556',
'retcode': 0,
'return': True,
'success': True}
Reactor
Ability  to  execute  commands  
Allow  events  to  trigger  ac@ons
# This script is to be called from the reactor system
{%- set application = data['data']['application'] %}
{%- set container = data['data']['container'] %}
{%- set node = data['data']['salt-node'] %}
{%- set tag = data['data']['tag'] %}
sync-states:
cmd.saltutil.sync_states:
- tgt: {{ node }}
deploy-containers:
cmd.state.sls:
- tgt: {{ node }}
- arg:
- containers.{{ container }}
- kwarg:
pillar:
containers:
imagetag:
{{ application }}: {{ tag }}
Salt  Api
Yes!  There’s  an  rest-­‐api
curl -sS salt.jacksoncage.se/run 
-H 'Accept: application/x-yaml' 
-d client='local' 
-d tgt='*' 
-d fun='test.ping' 
-d username='saltdev' 
-d password='saltdev' 
-d eauth='pam'
Salt  Api
# Example start creation dev box via curl:
curl -H 'X-Salt-Key: Secret-Key-Here' 
-H 'Content-Type: application/json' 
-d '{"username":"love"}' 
https://salt.jacksoncage.se/hook/api/devbox/create
Orchestrate
Configura@on  order  
Sequenced  applied  states  
Orchestrate  deployment  in  order  on  mul@ple  systems
# Create AWS EC2 instance
create-instance:
salt.state:
- tgt: {{ master }}
- sls: devlovin.cloud.create
- concurrent: True
- pillar:
devlovinreact:
instancename: {{ basename }}{{ username }}
# Run highstate
highstate-run:
salt.state:
- tgt: {{ basename }}{{ username }}
- highstate: True
- pillar:
devlovinreact:
username: {{ username }}
- require:
- salt: create-instance
Beacons
Hook  into  system  processes    
Translate  external  events  into  the  salt  event  bus  
Events  can  then  be  responded  by  Reactor
Beacons
DEMO
Ques@ons?
Love  Nyberg  
@jacksoncage  
love@bloglovin.com
Thanks!
Love  Nyberg  
@jacksoncage  
love@bloglovin.com

More Related Content

What's hot

Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Shuji Watanabe
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 

What's hot (20)

Monitoring Uptime on the NeCTAR Research Cloud - Andy Botting, University of ...
Monitoring Uptime on the NeCTAR Research Cloud - Andy Botting, University of ...Monitoring Uptime on the NeCTAR Research Cloud - Andy Botting, University of ...
Monitoring Uptime on the NeCTAR Research Cloud - Andy Botting, University of ...
 
Automating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStackAutomating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStack
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
 
Migrating the Online’s console with Docker
Migrating the Online’s console with DockerMigrating the Online’s console with Docker
Migrating the Online’s console with Docker
 
NATE-CHEF
NATE-CHEFNATE-CHEF
NATE-CHEF
 
OSCamp #4 on Foreman | Salted Foreman by Bernhard Suttner
OSCamp #4 on Foreman | Salted Foreman by Bernhard SuttnerOSCamp #4 on Foreman | Salted Foreman by Bernhard Suttner
OSCamp #4 on Foreman | Salted Foreman by Bernhard Suttner
 
Quartz to Implement Scheduling Service
Quartz to Implement Scheduling ServiceQuartz to Implement Scheduling Service
Quartz to Implement Scheduling Service
 
Consul administration at scale
Consul administration at scaleConsul administration at scale
Consul administration at scale
 
Quartz Scheduler
Quartz SchedulerQuartz Scheduler
Quartz Scheduler
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with Capistrano
 
Consul in 5 minutes
Consul in 5 minutesConsul in 5 minutes
Consul in 5 minutes
 
Publishing AwsLlambda Logs Into SplunkCloud
Publishing AwsLlambda Logs Into SplunkCloudPublishing AwsLlambda Logs Into SplunkCloud
Publishing AwsLlambda Logs Into SplunkCloud
 
Writing Rust Command Line Applications
Writing Rust Command Line ApplicationsWriting Rust Command Line Applications
Writing Rust Command Line Applications
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
HashiCorp User Group Paris: Consul & Inversion of Control for Infrastructure
HashiCorp User Group Paris: Consul & Inversion of Control for InfrastructureHashiCorp User Group Paris: Consul & Inversion of Control for Infrastructure
HashiCorp User Group Paris: Consul & Inversion of Control for Infrastructure
 
WTF is Sensu and Monitoring
WTF is Sensu and MonitoringWTF is Sensu and Monitoring
WTF is Sensu and Monitoring
 
Nginx维护手册
Nginx维护手册Nginx维护手册
Nginx维护手册
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
 

Viewers also liked

CloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
CloudClustering: Toward an Iterative Data Processing Pattern on the CloudCloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
CloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
Ankur Dave
 

Viewers also liked (17)

Automate your development environment with Jira and Saltstack
Automate your development environment with Jira and SaltstackAutomate your development environment with Jira and Saltstack
Automate your development environment with Jira and Saltstack
 
Saltconf16 - Salt is Not Configuration Management
Saltconf16 - Salt is Not Configuration ManagementSaltconf16 - Salt is Not Configuration Management
Saltconf16 - Salt is Not Configuration Management
 
SaltConf2015: SaltStack at Scale Automating Your Automation
SaltConf2015: SaltStack at Scale Automating Your AutomationSaltConf2015: SaltStack at Scale Automating Your Automation
SaltConf2015: SaltStack at Scale Automating Your Automation
 
CloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
CloudClustering: Toward an Iterative Data Processing Pattern on the CloudCloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
CloudClustering: Toward an Iterative Data Processing Pattern on the Cloud
 
Ship Faster Without Breaking Everything - XebiaLabs + SaltStack Webinar
Ship Faster Without Breaking Everything - XebiaLabs + SaltStack WebinarShip Faster Without Breaking Everything - XebiaLabs + SaltStack Webinar
Ship Faster Without Breaking Everything - XebiaLabs + SaltStack Webinar
 
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
 
Creating SaltStack State data with Pyobjects
Creating SaltStack State data with PyobjectsCreating SaltStack State data with Pyobjects
Creating SaltStack State data with Pyobjects
 
Bitfusion Saltconf16 - Seamless Docker Orchestration with SaltStack
Bitfusion Saltconf16 - Seamless Docker Orchestration with SaltStackBitfusion Saltconf16 - Seamless Docker Orchestration with SaltStack
Bitfusion Saltconf16 - Seamless Docker Orchestration with SaltStack
 
Deploying Foreman in Enterprise Environments
Deploying Foreman in Enterprise EnvironmentsDeploying Foreman in Enterprise Environments
Deploying Foreman in Enterprise Environments
 
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
Event-driven Infrastructure - Mike Place, SaltStack - DevOpsDays Tel Aviv 2016
 
SaltStack For DevOps, Free Sample
SaltStack For DevOps, Free SampleSaltStack For DevOps, Free Sample
SaltStack For DevOps, Free Sample
 
Salt Cloud vmware-orchestration
Salt Cloud vmware-orchestrationSalt Cloud vmware-orchestration
Salt Cloud vmware-orchestration
 
Managing your SaltStack Minions with Foreman
Managing your SaltStack Minions with ForemanManaging your SaltStack Minions with Foreman
Managing your SaltStack Minions with Foreman
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...
DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...
DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...
 
Foreman in Your Data Center :OSDC 2015
Foreman in Your Data Center :OSDC 2015Foreman in Your Data Center :OSDC 2015
Foreman in Your Data Center :OSDC 2015
 
Foreman in your datacenter
Foreman in your datacenterForeman in your datacenter
Foreman in your datacenter
 

Similar to Orchestrate Event-Driven Infrastructure with SaltStack

マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
Toshiaki Maki
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
Ming-Ying Wu
 
Inside neutron 2
Inside neutron 2Inside neutron 2
Inside neutron 2
Robin Gong
 

Similar to Orchestrate Event-Driven Infrastructure with SaltStack (20)

マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
 
Real-time Infrastructure Management with SaltStack - OpenWest 2013
Real-time Infrastructure Management with SaltStack - OpenWest 2013Real-time Infrastructure Management with SaltStack - OpenWest 2013
Real-time Infrastructure Management with SaltStack - OpenWest 2013
 
Divolte collector overview
Divolte collector overviewDivolte collector overview
Divolte collector overview
 
vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
 
PyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonPyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for Python
 
Volta: Logging, Metrics, and Monitoring as a Service
Volta: Logging, Metrics, and Monitoring as a ServiceVolta: Logging, Metrics, and Monitoring as a Service
Volta: Logging, Metrics, and Monitoring as a Service
 
Camille chaudet measure camp-tagguing_mobile_apps_june15_v1.0
Camille chaudet   measure camp-tagguing_mobile_apps_june15_v1.0 Camille chaudet   measure camp-tagguing_mobile_apps_june15_v1.0
Camille chaudet measure camp-tagguing_mobile_apps_june15_v1.0
 
Replication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-finalReplication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-final
 
Inside neutron 2
Inside neutron 2Inside neutron 2
Inside neutron 2
 
Using SaltStack to Auto Triage and Remediate Production Systems
Using SaltStack to Auto Triage and Remediate Production SystemsUsing SaltStack to Auto Triage and Remediate Production Systems
Using SaltStack to Auto Triage and Remediate Production Systems
 
Precision Timing for KPI Measurements
Precision Timing for KPI MeasurementsPrecision Timing for KPI Measurements
Precision Timing for KPI Measurements
 
The SaltStack Pub Crawl - Fosscomm 2016
The SaltStack Pub Crawl - Fosscomm 2016The SaltStack Pub Crawl - Fosscomm 2016
The SaltStack Pub Crawl - Fosscomm 2016
 
Docker on openstack by OpenSource Consulting
Docker on openstack by OpenSource ConsultingDocker on openstack by OpenSource Consulting
Docker on openstack by OpenSource Consulting
 
SaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
SaltConf 2015: Salt stack at web scale: Better, Stronger, FasterSaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
SaltConf 2015: Salt stack at web scale: Better, Stronger, Faster
 
M|18 Scalability via Expendable Resources: Containers at BlaBlaCar
M|18 Scalability via Expendable Resources: Containers at BlaBlaCarM|18 Scalability via Expendable Resources: Containers at BlaBlaCar
M|18 Scalability via Expendable Resources: Containers at BlaBlaCar
 
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupSaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
 
How Netskope Mastered DevOps with Sumo Logic
How Netskope Mastered DevOps with Sumo LogicHow Netskope Mastered DevOps with Sumo Logic
How Netskope Mastered DevOps with Sumo Logic
 
Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014
 
Deploying to Oracle SOA Suite 12c - Everything You Need To Know
Deploying to Oracle SOA Suite 12c - Everything You Need To KnowDeploying to Oracle SOA Suite 12c - Everything You Need To Know
Deploying to Oracle SOA Suite 12c - Everything You Need To Know
 

Recently uploaded

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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Orchestrate Event-Driven Infrastructure with SaltStack

  • 1. Orchestrate  Event-­‐Driven   Infrastructure  with  SaltStack Love  Nyberg   Site  reliability  &  Automa@on  Engineer
  • 2. SaltStack SaltStack  is  extremely  fast  and  scalable  systems  and   configura@on  management  soDware  for  predic@ve   orchestra@on,  cloud  and  data  center  automa@on,  server   provisioning,  applica@on  deployment  and  more.
  • 3. Agenda  salt  @  bloglovin    Terminology    Orchestrate    Reactor    Beacons
  • 4. salt  @  bloglovin tens  of  millions  of  monthly  unique  visitors   hundred  of  millions  requests  per  day   couple  of  million  stories  parsed  per  day   hybrid  bare  metal  servers/cloud  vm’s   2  salt  masters   ~90  salt  minions
  • 5. salt  @  bloglovin Parts  we  use!   States/Pillars/Grains   Orchestrate   Reactor   Salt  Api   Salt  Cloud
  • 6. Terminology Configura)on   Master/Minion   Masterless   Transport   ZeroMQ   Raet   SSH   Parts   States   Modules   Grains   Pillars  
  • 8. Execu@on  modules root@master:/# salt minion_love network.interface eth0 minion_love: |_ ---------- address: 172.17.0.9 broadcast: None label: eth0 netmask: 255.255.0.0
  • 9. Execu@on  modules root@master:~# salt minion1 cmd.run "ip addr show eth0" minion1: 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000 link/ether 12:4b:af:05:be:cd brd ff:ff:ff:ff:ff:ff inet 10.0.0.206/24 brd 10.0.0.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::104b:afff:fe05:becd/64 scope link valid_lft forever preferred_lft forever
  • 12. {%- set ips = salt['network.ip_addrs'](None, False, '172.17.0.0/24') %} ssh: pkg.latest - name: openssh-server service.running: - enable: True - watch: - file: ssh - pkg: ssh file.managed: - name: /etc/ssh/sshd_config - source: salt://sshd/files/sshd_config - template: jinja - context: ips: {{ ips }}
  • 13. Grains via state root@mon1:/# salt minion_love grains.get ip_interfaces:eth0 minion_love: - 172.17.0.9 within a state file
 
 {%- set eth0 = salt['grains.get'](ip_interfaces:eth0, '') %}
  • 14. Pillar root@master:/# salt minion_love pillar.item secrets minion_love: ---------- secrets: ---------- foo: bar
  • 15. Apply  state root@master:/# salt minion_love state.highstate salt '<target>' <function> [arguments]
  • 16. Event  system Event  system  is  a  local  ZeroMQ  PUB  interface  which  fires  salt  events   Every  event  has  a  tag  and  a  data  structure
  • 17. Event  chain  `test.ping` Event fired at Wed May 27 22:00:14 2015 ************************* Tag: new_job Data: {'_stamp': '2015-05-27T20:00:14.774445', 'arg': [], 'fun': 'test.ping', 'jid': '20150527220014773556', 'minions': ['minion_love'], 'tgt': 'minion_love', 'tgt_type': 'glob', 'user': 'sudo_love'}
  • 18. Event  chain  `test.ping` Event fired at Wed May 27 22:00:14 2015 ************************* Tag: salt/job/20150527220014773556/ret/mon1 Data: {'_stamp': '2015-05-27T20:00:14.981640', 'cmd': '_return', 'fun': 'test.ping', 'fun_args': [], 'id': ‘minion_love', 'jid': '20150527220014773556', 'retcode': 0, 'return': True, 'success': True}
  • 19. Reactor Ability  to  execute  commands   Allow  events  to  trigger  ac@ons
  • 20. # This script is to be called from the reactor system {%- set application = data['data']['application'] %} {%- set container = data['data']['container'] %} {%- set node = data['data']['salt-node'] %} {%- set tag = data['data']['tag'] %} sync-states: cmd.saltutil.sync_states: - tgt: {{ node }} deploy-containers: cmd.state.sls: - tgt: {{ node }} - arg: - containers.{{ container }} - kwarg: pillar: containers: imagetag: {{ application }}: {{ tag }}
  • 21. Salt  Api Yes!  There’s  an  rest-­‐api curl -sS salt.jacksoncage.se/run -H 'Accept: application/x-yaml' -d client='local' -d tgt='*' -d fun='test.ping' -d username='saltdev' -d password='saltdev' -d eauth='pam'
  • 22. Salt  Api # Example start creation dev box via curl: curl -H 'X-Salt-Key: Secret-Key-Here' -H 'Content-Type: application/json' -d '{"username":"love"}' https://salt.jacksoncage.se/hook/api/devbox/create
  • 23. Orchestrate Configura@on  order   Sequenced  applied  states   Orchestrate  deployment  in  order  on  mul@ple  systems
  • 24. # Create AWS EC2 instance create-instance: salt.state: - tgt: {{ master }} - sls: devlovin.cloud.create - concurrent: True - pillar: devlovinreact: instancename: {{ basename }}{{ username }} # Run highstate highstate-run: salt.state: - tgt: {{ basename }}{{ username }} - highstate: True - pillar: devlovinreact: username: {{ username }} - require: - salt: create-instance
  • 25. Beacons Hook  into  system  processes     Translate  external  events  into  the  salt  event  bus   Events  can  then  be  responded  by  Reactor
  • 28. Thanks! Love  Nyberg   @jacksoncage   love@bloglovin.com