An intro to docker, terraform, and amazon ECS

98 35 0
An intro to docker, terraform, and amazon ECS

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

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 "/" "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:

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 resource "aws_ecs_service" "sinatra_backend" { ( ) load_balancer { elb_name = "${aws_elb.sinatra_backend.id}" container_name = "sinatra-backend" container_port = 4567 } } Associate the ELB with the Sinatra Backend ECS Service { "name": "example", "image": "foo/example", "cpu": 1024, "memory": 2048, "essential": true, } { "cluster": "example", "serviceName": ”foo", "taskDefinition": "", "desiredCount": } ECS Agent ECS Tasks ECS Task Definition ECS Service Definition EC2 Instance ECS Cluster Set up service discovery between the ECS Services resource "aws_ecs_task_definition" "rails_frontend" { family = "rails-frontend" container_definitions =

Ngày đăng: 30/11/2018, 18:21

Tài liệu cùng người dùng

Tài liệu liên quan