59
2014 겨울 AWSKRUG Meetup ElasticBeanstalk First-look and Git 2 이성환@AWSKRUG Meetup

빈스톡 첫인상 with Git

Embed Size (px)

Citation preview

Page 1: 빈스톡 첫인상 with Git

2014 겨울 AWSKRUG Meetup

ElasticBeanstalk First-look and Git 2이성환@AWSKRUG Meetup

Page 2: 빈스톡 첫인상 with Git

lethee@{github,twitter,gmail}

sean@weaveus

이성환@LGE SW Platform lab.

Page 3: 빈스톡 첫인상 with Git

Overview

Beanstalk and Beanstalk with Docker

Deploy and Git

Git 2 and Pro Git 2

Page 4: 빈스톡 첫인상 with Git

Beanstalk First-look

Import a Python/Flask WebApp Project

Beanstalk, what is?

Import a Python/Flask with Docker Container

Page 5: 빈스톡 첫인상 with Git

Import existing Python/Flask project

into Beanstalk

Page 6: 빈스톡 첫인상 with Git

pre-configured website template

Flask(-Login, -SQLAlchemy, …), py.test, Sphinx,Modernizr, Bootstrap, Typeplate

https://jackstouffer.github.io/Flask-Foundation/

Page 7: 빈스톡 첫인상 with Git
Page 8: 빈스톡 첫인상 with Git

Demo$ git clone [email protected]:lethee/Flask-Foundation.git

$ cd Flask-Foundation

(optional - cleanup git history make new origin remote)

$ rm -rf .git && git init . && git add --all && git commit -m "initial imports"

$ git remote add origin github.com:lethee/My-Flash-Foundation.git

$ git push -u origin master

$ python application.py server

Demo on http://127.0.0.1:5000/

Page 9: 빈스톡 첫인상 with Git

Import FlaskFoundation Project

into Beanstalk

Page 10: 빈스톡 첫인상 with Git

Demo# AWS key and EC2 key ready ($HOME/.aws)$ pip install awsebcli

# Create Application Interactive/Non-interactive

$ eb init$ eb init My-Quiet-App --region ap-northeast-1 --platform "Python 2.7" --keyname sean-lee-aws-dev

$ eb console

# Create Environment for the Application (Long Time)

$ eb create dev-env ––single

$ eb open

Page 11: 빈스톡 첫인상 with Git

(demo1 - shell)

Page 12: 빈스톡 첫인상 with Git
Page 13: 빈스톡 첫인상 with Git
Page 14: 빈스톡 첫인상 with Git
Page 15: 빈스톡 첫인상 with Git

$ eb console

Page 16: 빈스톡 첫인상 with Git

$ eb open

Page 17: 빈스톡 첫인상 with Git
Page 18: 빈스톡 첫인상 with Git

Demo# Modify Application and Deploy

$ git add . && git commit -m "Update"

$ eb deploy

$ eb open

Page 19: 빈스톡 첫인상 with Git

(demo2 - shell)

Page 20: 빈스톡 첫인상 with Git
Page 21: 빈스톡 첫인상 with Git

$ eb open

Page 22: 빈스톡 첫인상 with Git

Demo# Create Production Environment

$ eb create prod-env

$ eb scale 4 prod-env

$ eb status -v prod-env

# Environement의 환경변수 설정

$ eb printenv

$ eb setenv APPNAME_ENV=prod -e prod-env

Page 23: 빈스톡 첫인상 with Git
Page 24: 빈스톡 첫인상 with Git
Page 25: 빈스톡 첫인상 with Git

(demo3 - shell)

Page 26: 빈스톡 첫인상 with Git

No Sidebar APPNAME_ENV=prod

Page 27: 빈스톡 첫인상 with Git
Page 28: 빈스톡 첫인상 with Git
Page 29: 빈스톡 첫인상 with Git
Page 30: 빈스톡 첫인상 with Git

ElasticBeanstalk

Page 31: 빈스톡 첫인상 with Git

Build & Deploy an Web-app

EC2 (IaaS) Beanstalk (PaaS)

서버 수동 - EC2 Instance 생성 자동 (eb create)

dev,prod 환경 수동 - EC2 Instance 생성 자동 (eb create)

프레임워크 수동 - Instance에서 설치 자동

웹서버설정 수동 - Instance에서 설정 자동

배포 수동 - rsync, scp, git pull, CI 자동 (eb deploy)

로드밸런싱오토 스케일링

설정필요 - EC2에서 설정 자동(?) - (1~4 conf)

웹앱코딩 수동 수동

Page 32: 빈스톡 첫인상 with Git

ElasticBeanstalk creates and manages everything else

‘Focus on building your application’

Page 33: 빈스톡 첫인상 with Git

Elastic Beanstalk

Application (type:python)

Environment:Load-balanced (URL)

Environment:Single (URL)

EC2 Instance EC2 Instance EC2 Instance

EC2 Instance

WebAppDeploy

WebApp WebApp WebApp

WebApp

Application (type:node.js)

Load Balance Auto Scale

Page 34: 빈스톡 첫인상 with Git

AWS Elastic Beanstalk (EB)

Page 35: 빈스톡 첫인상 with Git

On-instance configuration

Your code

HTTP server

Application server

Language interpreter

Operating system

Host

Focus on building your application

Page 36: 빈스톡 첫인상 with Git

Application versions and saved configurations

Saved configurationsSave these for easy duplication for A/B testing or non-disruptive deployments

Application versionsAll versions are stored durably in Amazon S3. Code can also be pushed from a Git repository!

Page 37: 빈스톡 첫인상 with Git

Import Python/Flask into

Beanstalk with Docker

Page 38: 빈스톡 첫인상 with Git

Demo$ git clone [email protected]:lethee/Flask-Foundation.git Docker-Flask-Foundation

$ cd Docker-Flask-Foundation

$ git checkout docker

# write Dockerfile

$ docker build -t docker-flask-foundation .

$ docker run -d -p 5000:5000 docker-flask-foundation

$ open "http://$(boot2docker ip 2> /dev/null):5000" # for Mac/boot2docker

Page 39: 빈스톡 첫인상 with Git
Page 40: 빈스톡 첫인상 with Git

Demo

# Create Application

$ eb init

# Create Environment

$ eb create-env docker-prod-env

# confirm the docker process

$ ssh -i ~/.ssh/aws-eb ec2-user@{host}.compute.amazonaws.com

[ec2-user@ip-10-231-35-48 ~]$ sudo docker ps

Page 41: 빈스톡 첫인상 with Git

(demo4 - shell)

Page 42: 빈스톡 첫인상 with Git
Page 43: 빈스톡 첫인상 with Git
Page 44: 빈스톡 첫인상 with Git
Page 45: 빈스톡 첫인상 with Git

Beanstalk Deployeb deploy

eb deploy (CLI 3.0)

git aws.push (CLI 2.6)

Internal Process

make a zip file (git archive —format=zip)

upload the zip file into S3 bucket (API)

call Beanstalk API to deploy a new version (API)

Page 46: 빈스톡 첫인상 with Git

And Git 2

1.x

Pro Git - Open Source Git Book in Multi-language

With GitHub

clone, checkout, merge, push, cherry-pick, rebase

2.0 (2014)

Page 47: 빈스톡 첫인상 with Git

Git 2Additional Version 2 & Tips

'git push’ strategy: matching to simple

simple: push the current branch to its upstream

matching: all branch existed on remote (1.x)

'git add' added removed file

git add -u (1.x)

tag list

git tag --list —sort=version:refname

git tag --list | sort -V (can’t on OS X) (1.x)

Page 48: 빈스톡 첫인상 with Git

Git 2

2.0..2.1

git config --global tag.sort version:refname

2.1..2.2

git archive -o docs.zip v2.2.0 'Docs/*.html'

git help everyday

Page 49: 빈스톡 첫인상 with Git

Pro Git 2nd - Updates

Server Env.

GitHub

Merge/Rebase

with Editors

Library

http://git-scm.com/book/

Page 50: 빈스톡 첫인상 with Git

Introduction

Page 51: 빈스톡 첫인상 with Git

lethee@{github,twitter,gmail}

sean@weaveus

이성환@LGE SW Platform lab.

Page 52: 빈스톡 첫인상 with Git

Team Weaveus

@pismute & Jr Changwoo

@lnyarl aka mage Yongjae

Page 53: 빈스톡 첫인상 with Git

Team Weaveus{pismute, lethee, mage}@weaveus

Coding and Living

Study and Translations

dogfeet.github.io

Grails Doc., Meteor Doc., …

관심사 - Docker, Ansible

Pro Git (and Pro Git 2 soon)

Page 54: 빈스톡 첫인상 with Git

Team Weaveus{pismute, lethee, mage}@weaveus

Coding and Living

Study and Translations

dogfeet.github.io

Grails Doc., Meteor Doc., …

Docker, Ansible

Pro Git (and Pro Git 2 soon) - require(구입)

Page 55: 빈스톡 첫인상 with Git

Refs. and See-also

re:Invent

APP201 - Going Zero to Sixty with AWS Elastic Beanstalk

APP202 - Deploy, Manage, Scale Apps w/ AWS OpsWorks & AWS Elastic Beanstalk

APP303 - Lightning Fast Deploys with Docker Containers and AWS

APP313 - NEW LAUNCH: Amazon EC2 Container Service in Action

Page 56: 빈스톡 첫인상 with Git

Refs. and See-also아마존 웹 서비스를 다루는 기술 by pyrasis

http://pyrasis.com/book/TheArtOfAmazonWebServices/Chapter23

AWS lab

http://github.com/awslabs

• AWS 서비스 연동 예제http://github.com/awslabs/eb-py-flask-signup

Page 57: 빈스톡 첫인상 with Git

Demo Project

Flask Foundation

https://github.com/lethee/Flask-Foundation

Docker 프로젝트는 docker 브랜치

Page 58: 빈스톡 첫인상 with Git

2014 겨울 AWSKRUG Meetup

묻고 답하기http://aws.amazon.com/ko/elasticbeanstalk/faqs/

Page 59: 빈스톡 첫인상 with Git

2014 겨울 AWSKRUG Meetup

ElasticBeanstalk First-look and Git 2이성환@AWSKRUG Meetup