3. 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
4 salt masters
~90 salt minions
4. salt @ bloglovin
Parts we use!
States/Pillars/Grains
Pillarstack*
Orchestrate
Reactor
Beacons
Engines
5. Parallel execu=on
to run all the resources concurrently
Event driven
to monitor and react dynamically only to changes
Next genera=on
11. Goals
Monitoring - How can salt react to monitoring events and adjust
system without any manual interference
Minions - When a new device is connected get it’s data and no=fy
me, chat Vw!
Containers - When a new container starts, update load balancer
for that cluster and start sending traffic. Also when a container
stops, get logs and restart and send logs to team
14. State events
Enabling state events causes the Salt minion to send progress events as
each func5on in a state run completes execu5on.
state_events: True
minion
15. State events
Which can become an over load, let’s fire only on specific states
installed/vim:
pkg.installed:
- name: vim
- fire_event: installed/vim
minion
16. Custom event
Enabling state events causes the Salt minion to send progress events as
each func5on in a state run completes execu5on.
salt-call event.send /deploy/test/case '{"data": "Ready"}'
/deploy/test/case {
"_stamp": "2016-04-13T11:01:24.553140",
"cmd": "_minion_event",
"data": {
"__pub_fun": "event.send",
"__pub_jid": "20160413070124500641",
"__pub_pid": 17046,
"__pub_tgt": "salt-call",
"data": "Ready"
…
minion
20. Reactor
Salt’s Reactor system gives you the ability to trigger ac5ons in response to any event.
reactor: # Master config section "reactor"
- 'salt/minion/*/start': # Match tag "salt/minion/*/start"
- /srv/reactor/start.sls # Things to do when a minion starts
- 'deploy/containers': # Match tag "deploy/containers"
- /srv/reactor/deploy-containers.sls # Things to do when a container is deployed
- 'salt/netapi/hook/api/devlovin/create': # Listing on salt api for /devlovin/create
- /srv/reactor/devlovin-create.sls # Things to do when a create request is sent
master
21. Reactor
Salt’s Reactor system gives you the ability to trigger ac5ons in response to any event.
Remote execu=on: run an execu=on module on the targeted
minions.
Runners: These are tasks you would start using salt-run.
Wheel: Wheel commands manage your Salt environment.
master
22. Reactor
Salt’s Reactor system gives you the ability to trigger ac5ons in response to any event.
<section id>:
local.<function>:
- tgt: <target>
- arg:
<arguments>
master
23. # This script is to be called from the reactor system
{%- set application = data['data']['application'] %}
{%- set container = data['data']['container'] %}
{%- set target = data['data']['target'] %}
{%- set tag = data['data']['tag'] %}
sync-states:
local.saltutil.sync_states:
- tgt: {{ target }}
deploy-containers:
local.state.sls:
- tgt: {{ target }}
- arg:
- containers.{{ container }}
- kwarg:
pillar:
containers:
imagetag:
{{ application }}: {{ tag }}
master
27. Demo
Monitoring - How can salt react to monitoring events and adjust
system without any manual interference
28. Demo
Minions - When a new device is connected get it’s data and no=fy
me, chat Vw!
29. Demo
Containers - When a new container starts, update load balancer
for that cluster and start sending traffic. Also when a container
stops, get logs and restart and send logs to team