Upload
sethvoltz
View
90
Download
0
Tags:
Embed Size (px)
Citation preview
D O C K E R I N D E VE LO P M E N T
O B L I G AT O RY D O C K E R I N T R OD O CK E R I S YO U R F R I E N D
W H O U S E S I T ?
W H Y I S I T I M PO RTAN T ?
Standardized
Composable
Reusable
Sandboxed
S A N D BOX E D ?
The processes within the container are unaware of the parent Linux system.
Multiple instances of the same exact image can run side-by-side without conflicting or being aware of each other.
C O M P O S AB L E ?
Link multiple containers explicitly or expose ports to the parent Linux machine which may then be connected to by outside users and services.
Single responsibility for each image, using multiple images and instances in concert to create applications.
H O W D O E S I T D O I T ?
• Reduces duplication
• Containers not Hypervisors
• cgroups, UnionFS, libcontainer
Image credit: http://www.lifeintech.com/blog/2014/7/19/containerisation-is-the-new-virtualisation
A B I T O F H I S T O RYLO C A L D E V E LO P M E N T
V I RT U A L BOX
• Originally by Sun, now Oracle – free and open source
• Like Parallels and VMWare, emulates hardware, requires manual setup
• Fully encapsulate your application in it’s own environment
• Scriptable using CLI tools
VAG RAN T
• Vagrant allowed programmatic creation of VMs without manual intervention
• Integration with Puppet, Chef and shell scripts eased setup
• Re-use existing deployment scripts to install dependencies
BO O T 2 D O C K E R
• Boot2Docker brings Docker to the Mac
• Uses VirtualBox in the background, much like Vagrant
• Very lightweight base Linux image (≈20MB!)
• Manages shell variables to specify the VM as the remote Docker server
• Call `docker` commands locally, transparently sent to VM
F I G
• Originally written by Orchard Labs, a Docker hosting service
• Allowed definition of multiple docker images through a single YAML file
• Handled most of Dockers CLI features – images, volumes, ports, linking
• Acquired by Docker, Inc. in July 2014
D O C K E R- C O M P O S E
• Fig renamed to Docker Compose, transition completed late February 2015
• Extended to work in conjunction with new orchestration tools Docker Machine and Docker Swarm
• Already large user-base gained more traction, increased usage meant more bugs found and fixed.
• Future uses will include managing production resources as well
W H AT AR E W E B U I L D I N G ?T H E P R O J E CT A N D PA RT S
S Q L DATAB AS E – P O S T G R E S Q L• Besides being the db du jour,
PostgreSQL offers a more modern subset of the SQL specification
• Additional column types such as JSON, BSON & HStore
• Much better support for new functionality (PostGIS) through Pg/SQL and other languages (Javascript, Python, Ruby, &c.)
K-V DATAB AS E – R E D I S
• Fast, lightweight, easy to install, no dependencies
• Atomic reads and writes
• Can be clustered and sharded for horizontal scalability
• List data type ideal for queue system
AS Y N C W O R K E R – S I D E K I Q
• Uses Redis’ atomic list reads and writes to manage a reliable queue
• Threaded workers allow for fast spin up and execution, many more can run simultaneously than alternatives
• Integrates nicely with Rails, including Rails 4.2 native ActiveJob workers
P R I M ARY AP P – RA I L S• This is my framework. There are many
like it but this one is mine.
• My framework is my best friend. It is my life. I must master it as I must master my life.
• Seriously, though, I have used Rails since 2.1 and am comfortable using it. You may write your app in any language and framework you like. Honeydocker Don’t Care
P U TT I N G I T AL L T O G E T H E RI N S TA L L AT I O N G A M E
I N S TAL L I N G V I RT U AL BOX• https://www.virtualbox.org/, install using `brew cask install
virtualbox`
I N S TAL L I N G BO O T 2 D O C K E R
• http://boot2docker.io/, install using `brew install boot2docker`
S TA RT I N G BO O T 2 D O C K E R
• Start up the Boot2Docker VM and load environment variables
C O N F I R M I N G D O C K E R R U N S
• Check installation worked correctly
D O C K E R F I L E
}
Build on top of a base image
Each instruction is cached
Create a working directory
Streamline using the caches
Finally, run the app
}
}}
D O C K E R- C O M P O S E . Y M L
Internal name
Docker image name
What to run when it starts
Create a persistent volume
Import a volume
Expose ports (two ways)}
BO O T S T RAP A PP DATA
• Start up the Boot2Docker VM and load environment variables
` D O C K E R- C O M P O S E U P `
• Finally, launch your application, dependencies are booted first
D E M O T I M E !L E T ’ S D O T H I S
Q U E S T I O N S ?W RA P- U P