Teams
> ~60 people on #devops
> 85 on GitHub
> PHP, Go, Haskell, Python,
Ruby, Nix, Java, Objective-C
> PHP monolith going
microservice-ish
Slide 4
Slide 4 text
DISTRIBUTED
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
THE ZALORA
PLATFORM
FORK NOW >
Slide 7
Slide 7 text
> Implement true DevOps
> Ease PagerDuty burden
> Decrease MTTR
> Managed environment to move fast and
break things
Slide 8
Slide 8 text
EVERYTHING AS CODE
democratisation requires
automation
Slide 9
Slide 9 text
THE MODEL
Applying Conway's law up front
Slide 10
Slide 10 text
APP STORE
Slide 11
Slide 11 text
API
CMS
SEARCH
FRONTEND
EIN DATABASS
QUEUES
Slide 12
Slide 12 text
ENVIRONMENT
Slide 13
Slide 13 text
LIVE
Slide 14
Slide 14 text
DEV57
Slide 15
Slide 15 text
PERF_TEST 99
Slide 16
Slide 16 text
No content
Slide 17
Slide 17 text
INFRASTRUCTURE
COMPONENTS
Slide 18
Slide 18 text
INSTANCES
Slide 19
Slide 19 text
SOFTWARE PACKAGES / AMIs
SDK
Slide 20
Slide 20 text
MONITORING SYSTEM
Slide 21
Slide 21 text
No content
Slide 22
Slide 22 text
FAST TOOLS
Slide 23
Slide 23 text
waiting kills productivity
Slide 24
Slide 24 text
Tools
> Compile-time verification
> CI as a first-class citizen
> First-class identities & auth
> Ship early
> Proto implementation doesn't
matter
> Easily swappable
Slide 25
Slide 25 text
Dev envs
> Zero-config bootstrap
> I want to hack on a plane
> I have no internet access
> I hate waiting for stuff to compile
> I should run whatever there is in
production
> I want to communicate my
changes
> It has to work
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
DECLARATIVE
SPECS
Slide 28
Slide 28 text
> puppet language is not expressive enough
> YAML? LOL
> ansible, salt, etc
> languages with effects are too much
> our model is country-
centric
> countries can share
servers
> mariadb channels
are server-centric
Slide 32
Slide 32 text
> rewrite by hand?
> use some other script to translate models?
> write a puppet plugin to do that?
> find a better template engine
> like, embed python into your tags
> why not use an expressive language in the
first place?
Slide 33
Slide 33 text
db-slave-channels =
let mapper = _: { db-name, masterhost, ... }:
nameValuePair (to-key master-host) {
inherit master-host;
databases = [ db-name ];
};
reducer = { name, value }: all: all // {
${name} = value // {
databases = all.${name}.databases or []
++ value.databases;
};
};
in fold reducer {} (mapAttrsToList mapper conf);
Slide 34
Slide 34 text
db-slave-channels =
let mapper = _: { db-name, masterhost, ... }:
nameValuePair (to-key master-host) {
inherit master-host;
databases = [ db-name ];
};
reducer = { name, value }: all: all // {
${name} = value // {
databases = all.${name}.databases or []
++ value.databases;
};
};
in fold reducer {} (mapAttrsToList mapper conf);
BIG DATA-compatible
Slide 35
Slide 35 text
CASE STUDY:
Configuring Jenkins
Slide 36
Slide 36 text
Jenkins
> Click through all the forms?
> XML LOL
> Only operation-oriented API
> String templates?
> Can build a DSL!
http-ok = mkOption {
type = types.nullOr types.str;
description = "HTTP URL that is supposed to return a 2xx or a 3xx
response.";
};
mysql-metric = mkOption {
type = types.nullOr types.str;
description = "MySQL query that returns one row with a single
column which is a numeric value.";
};
mysql-status = mkOption {
type = types.nullOr types.str;
description = "MySQL variable from SHOW STATUS that returns a
numeric value.";
};
Specs
> Evaluation expands specs by
substituting variables
> beta-reduced term
> You can print it and hand out
to your cloud procurement
manager
Slide 52
Slide 52 text
NIX
Slide 53
Slide 53 text
Nix
> pure
> structured data goes in
> data goes out
> no I/O
> uni-typed
> terms are isomorphic to JSON
Slide 54
Slide 54 text
Nix
> lazy
> expression-oriented
> HOFs, closures
> data structures
> map/filter/fold/...
> runtime type-checking support
> via libraries
Slide 55
Slide 55 text
Nix
> single side effect
> allows writing data to CAS
> allows running programs in CAS
context (aka derivations) —
> used to build a package manager
> immutable
> can't write a different thing
under the same key
Upcast
> compiles expanded Nix specs
into AWS API calls
> handles interactive/partial
deployments
Slide 63
Slide 63 text
No content
Slide 64
Slide 64 text
Platform
> data (configs)
> Linux defaults
> the SDK (software collection)
> infra evaluation (upcast)
> integration evaluation (jenkins,
pagerduty, etc)
> autoscaling-ready
> internal part is called "Eris"
Slide 65
Slide 65 text
GAINS
Slide 66
Slide 66 text
> strict separation of control plane vs data
plane
> semantics first, implementation second
> multi-cloud
> multi-OS
> etc
Slide 67
Slide 67 text
> taking irrelevant details out of the equation
> moving them to another teams or
subprojects
Slide 68
Slide 68 text
> simplify doing business in the real world
without going into tech details too much
> perfect for wrapping stringly-typed Linux
world and unifying interfaces
Slide 69
Slide 69 text
TEMPTATIONS
Slide 70
Slide 70 text
> over-generalising
> nix is pragmatic enough
Slide 71
Slide 71 text
> adding effectful computations into the
language (IO monad)
> better take a proper language instead
> haven't found one yet
Slide 72
Slide 72 text
No content
Slide 73
Slide 73 text
No content
Slide 74
Slide 74 text
More related talks: speakerdeck.com/proger
Code: github.com/proger github.com/zalora