customer sharing: icook - continuous deployment with aws

20
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Richard Lee, iCook 愛料理 2016/5/20 Continuous Deployment with AWS From one server to clusters

Upload: amazon-web-services

Post on 06-Jan-2017

320 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Customer Sharing: iCook - Continuous Deployment with AWS

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Richard Lee, iCook 愛料理

2016/5/20

Continuous Deployment with AWS

From one server to clusters

Page 2: Customer Sharing: iCook - Continuous Deployment with AWS

iCook 愛料理

• Leading recipe sharing platform in Taiwan

• People share & view recipes from web / native apps

• 5M+ monthly visitors

• 3M+ app downloads

Page 3: Customer Sharing: iCook - Continuous Deployment with AWS

Business Challenges

Every business needs monetization

Our core businesses:

• VIP premium service

• User insights for brand customers

• E-commerce of selected items

Page 4: Customer Sharing: iCook - Continuous Deployment with AWS

Several Small Apps

Beyond our main site, we have several related sites,

prototypes and internal tools.

• iCook Market

• iCook TV

• iCook Blog

• Internal dashboards & BI tools

Page 5: Customer Sharing: iCook - Continuous Deployment with AWS

Why is this a trouble?

We had limited ops, and most of us are developers.

But we want to make it easy and fast to deploy as well.

Page 6: Customer Sharing: iCook - Continuous Deployment with AWS

Common Use Case

To deploy a new app to instances, we need:

1. Set up Linux environment

2. Install required runtime (Ruby / Node.js)

3. Deploy apps via Git

4. Set up monitoring & permissions and many others

Page 7: Customer Sharing: iCook - Continuous Deployment with AWS

Why AWS?

Page 8: Customer Sharing: iCook - Continuous Deployment with AWS

AWS Beyond EC2

EC2 + AMI Elastic Beanstalk OpsWorks ECS

Page 9: Customer Sharing: iCook - Continuous Deployment with AWS

Building AMI using Packer

There’re several ways to build AMI. We use Packer

1. Dev, test & production using same tool

2. Integration for different provisioning tools (e.g. Chef)

3. Simple CLI to make it run on your CI system

Page 10: Customer Sharing: iCook - Continuous Deployment with AWS

Sample Packer config for EC2

{

"variables": { "aws_access_key": "", "aws_secret_key": "” },

"builders": [{

"type": "amazon-ebs",

"access_key": "{{user `aws_access_key`}}",

"secret_key": "{{user `aws_secret_key`}}",

"region": "us-east-1",

"source_ami": "ami-fce3c696",

"instance_type": "t2.micro",

"ssh_username": "ubuntu",

"ami_name": "packer-example {{timestamp}}”

}],

"provisioners": [{

"type": "shell",

"inline": [ "sleep 30", "sudo apt-get update", "sudo apt-get install -y redis-server" ]

}]

}

Page 11: Customer Sharing: iCook - Continuous Deployment with AWS

Pros

• Simple and straight forward

• Tons of resources online

Pros & Cons of AMI

Cons

• Slow

• Not quite suitable for app

deployment

Page 12: Customer Sharing: iCook - Continuous Deployment with AWS

Elastic Beanstalk

AWS’s PaaS solution with several common app stacks.

1. Deployment from Git

2. Easy UIs for tweaking everything

3. However, do use ECS for Docker

Page 13: Customer Sharing: iCook - Continuous Deployment with AWS

Pros

• Prebuilt stacks

• Integrated deployment system

Pros & Cons of Elastic Beanstalk

Cons

• Hard to customize

• e.g. Want to use latest runtime

or OS version

• Limited options

Page 14: Customer Sharing: iCook - Continuous Deployment with AWS

OpsWorks

Hosted Chef integration for AWS

1. Infrastructure as code

2. Different scaling workflow

3. Hard to start but really powerful

Page 15: Customer Sharing: iCook - Continuous Deployment with AWS

Pros

• Good community

• e.g. Many official recipes

• Scaling is easier than ASG

• Customizable but with some

prebuilt stacks

Pros & Cons of OpsWorks

Cons

• Provisioning is slow

• OpsWorks server failures

• Invest time to learn & build

own cookbooks

Page 16: Customer Sharing: iCook - Continuous Deployment with AWS

ECS

AWS’s answer to container revolution.

1. Based on Docker

2. ECS as a container scheduler & sets of APIs

Page 17: Customer Sharing: iCook - Continuous Deployment with AWS

Pros

• Prebuilt Docker host AMIs

• Easily add instances to cluster

• Rolling updates

Pros & Cons of ECS

Cons

• Invest time to learn & build

Docker images

• No automatically task scaling

• Random bugs in ecs-agent

Page 18: Customer Sharing: iCook - Continuous Deployment with AWS

How to choose?

1. Use Elastic Beanstalk if you just want to set it up fast

2. Use custom AMI otherwise

3. If you know or want to learn Chef, use OpsWorks

4. If you use Docker, use ECS

You can use combo, our stack: AMI + OpsWorks + ECS

Page 19: Customer Sharing: iCook - Continuous Deployment with AWS

Learning resources beyond docs & guides

1. AWS official blogs (I love Ruby / Compute blogs)

2. Jeff Barr or other AWS staffs’ Twitter or posts

3. GitHub’s repos (aws / awslabs)

4. AWS account managers & official partners

Page 20: Customer Sharing: iCook - Continuous Deployment with AWS