Tải bản đầy đủ (.pdf) (98 trang)

An intro to docker, terraform, and amazon ECS

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.76 MB, 98 trang )

A quick intro to

Docker,
Terraform, and
Amazon ECS

TERRAFORM

Amazon ECS


In this talk, we’ll show how to
deploy two apps:


A Rails Frontend and a
Sinatra Backend


Slides and code from this talk:
ybrikman.com/speaking


require 'sinatra'
get "/" do
"Hello, World!"
end

The sinatra backend just returns
“Hello, World”.



class ApplicationController < ActionController::Base
def index
url = URI.parse(backend_addr)
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
@text = res.body
end
end

The rails frontend calls the sinatra
backend…


Rails Frontend



Response from the backend: <strong><%= @text %></strong>



And renders the response as
HTML.


We’ll package the two apps as
Docker containers…


Amazon ECS


Deploy those Docker containers
using Amazon ECS…


TERRAFORM

And define our infrastructure-ascode using Terraform.


I’m
Yevgeniy
Brikman
ybrikman.com


Co-founder of
Gruntwork

gruntwork.io


We offer DevOps
as a Service

gruntwork.io


And DevOps
as a Library


gruntwork.io


PAST LIVES


Author of
Hello,
Startup
hello-startup.net


And
Terraform:
Up & Running
terraformupandrunning.com


Outline
1.
2.
3.
4.

Docker
Terraform
ECS
Recap



Outline
1.
2.
3.
4.

Docker
Terraform
ECS
Recap


Docker allows you to build and
run code in containers


Containers are like lightweight
Virtual Machines (VMs)


Like an isolated process that
happens to be an entire OS


> docker run –it ubuntu bash
root@12345:/# echo "I'm in $(cat /etc/issue)”
I'm in Ubuntu 14.04.4 LTS

Running an Ubuntu image in a

Docker container


> time docker run ubuntu echo "Hello, World"
Hello, World

real 0m0.183s
user 0m0.009s
sys 0m0.014s

Containers boot quickly, with
minimal CPU/memory overhead


You can define a Docker image
as code in a Dockerfile


×