BAKING WINS @brightfulton
Aug 19, 2014
B A K I N G W I N S
@brightfulton
The bake vs. fry debate is over
and baking wins
THEORYRESOLUTIO
NPRACTICE
THEORYRESOLUTIO
NPRACTICE
Baking makes deployment better
GOALS
reliability
scalability
availability
GOALS
reliability
scalability
availability
HURDLES
mutable state
startup latency
dependencies
GOALS
reliability
scalability
availability
HURDLES
mutable state
startup latency
dependencies
SOLUTION
baking
The bake vs. fry debate is over
and baking wins
*
* for some the debate was over long ago
The bake vs. fry debate is over
and baking wins
*
* for some the debate was over long ago
THEORYRESOLUTIO
NPRACTICE
Baking improves deployment
reliability, scalability, availability
THEORYRESOLUTIO
NPRACTICE
But, baking isn’t very fun
http://techblog.netflix.com/2013/03/ami-creation-with-aminator.html
B A K IN G TOOLS
P R E S U ME A N A R C H ITE C TU R E
Bakery
Aminator
(Asgard)
B A K ING TOOLS
ARE SLOW AND FRAGILE
umount: /sysroot/proc: device is busy.
THEORYRESOLUTIO
NPRACTICE
Baking proved to be
demanding, slow, messy
THEORYRESOLUTIO
NPRACTICE
We use Docker to make baking better
D O C K E R R E D U C E S
T H E O R Y T O
P R A C T I C E
• single dependency
• isolated containers
• improved dev / ops interface
• fast
SWIPELY’S ESSENTIAL
INGREDIENTS
docker-api: programmatic docker control
dockly: declarative package definition
aerosol: functional deployment orchestration
swipely/docker-api
Docker::Image.allGet all images
Create an image Docker::Image.create(
'repo' => ‘ubuntu',
'tag' => ‘latest'
)
Add file to existing
image
image.insert_local(
'localPath' => ‘/some/file',
'outputPath' => ‘/other/path'
)
Ruby wrapper for Docker Remote API
swipely/dockly
deb :my_package do
package_name 'my_app'
docker do
name 'my_image'
import 's3://.../base-image.tar.gz'
git_archive '/app'
build <<-EOF
run cd /app && ./configure && make
EOF
end
foreman do
name 'my_app'
log_dir '/data/logs'
user 'appuser'
end
end
Declarative DSL for packaging
Orchestrates instance-based-deploys
swipely/aerosol
deploy :production_myapp do
ssh :production_myapp
auto_scaling :production_myapp
stop_command 'sudo stop myapp'
live_check '/version'
app_port 14000
post_deploy_command 'bundle exec rake honeybadger:deploy TO=production'
end
auto_scaling :production_myapp do
availability_zones ['us-east-1a', 'us-east-1b']
min_size 2
max_size 2
launch_configuration :production_myapp
tag 'Name' => 'prod-myapp'
end
D O C K E R R U N I S F A S T
container
docker do
name :my_app
import 's3://.../base-image.tar.gz'
git_archive '/app'
build_cache do
s3_bucket "my-build-cache-bucket"
s3_object_prefix "make/"
hash_command "md5deep /app/src”
build_command "cd /app && ./configure && make”
output_dir "/app/build"
use_latest true
end
end
D O C K L Y I S F A S T
Granular build caching
A E R O S O L I S
F A S T
v1 v2
THEORYRESOLUTIO
NPRACTICE
Docker makes baking
clean, simple, fast
github.com/swipely
careers.swipely.com
@swipelyeng
T H A N K Y O U