Slide 1

Slide 1 text

Containers @ Google App Engine Minku Lee CTO

Slide 2

Slide 2 text

!

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Shakr Infrastructure

Slide 11

Slide 11 text

Shakr Infrastructure • 2014 • 2015 GCP • 2016 Google Kubernetes Engine • 2017 GKE

Slide 12

Slide 12 text

੉੹ Harder, better, faster, stronger with Google Container Engine ҳӖஶప੉ցূ૓ਸࢎਊೠࡅܰҊউ੿੸ੋࢲ࠺झѐߊ߂ߓನ CTO MINKU LEE 2016.12 2017.07

Slide 13

Slide 13 text

Containers @ Google App Engine Minku Lee CTO

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Google Cloud

Slide 16

Slide 16 text

Kubernetes Engine Containers on Compute Engine App Engine Flex

Slide 17

Slide 17 text

Kubernetes Engine Containers on Compute Engine App Engine Flex

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

GKE

Slide 27

Slide 27 text

DaemonSet Deployment Job Pod ReplicaSet StatefulSet Ingress Service ConfigMap Secret PersistentVolumeClaim

Slide 28

Slide 28 text

" " Express Django Phoenix Play Rails

Slide 29

Slide 29 text

Kubernetes Engine Containers on Compute Engine App Engine Flex

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Kubernetes Engine Containers on Compute Engine App Engine Flex

Slide 33

Slide 33 text

App Engine Flexible Environment

Slide 34

Slide 34 text

App Engine

Slide 35

Slide 35 text

App Engine

Slide 36

Slide 36 text

Flexible Environment • Docker ! • SSH • VM vCPU, ,

Slide 37

Slide 37 text

Standard • Health check • Autoscaling • Traffic split

Slide 38

Slide 38 text

Rails

Slide 39

Slide 39 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 40

Slide 40 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 41

Slide 41 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 42

Slide 42 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 43

Slide 43 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 44

Slide 44 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 45

Slide 45 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 46

Slide 46 text

Dockerfile FROM ruby:2.4.1 ENV RAILS_ENV production ENV RAILS_LOG_TO_STDOUT true ENV RAILS_SERVE_STATIC_FILES true ENV PORT 8080 ADD . /opt/translator WORKDIR /opt/translator # Install Ruby dependencies RUN bundle install # Precompile assets RUN rake assets:precompile EXPOSE 8080 CMD ["./bin/rails", "server"]

Slide 47

Slide 47 text

Dockerfile • App Engine 
 Docker Kubernetes 


Slide 48

Slide 48 text

$ docker build -t translator . Sending build context to Docker daemon 3.723MB Step 1/16 : FROM ruby:2.4.1 ---> 3630c02d3d1b Step 2/16 : ENV RAILS_ENV production ---> 2a12ea7c6eef (઺ۚ) Step 13/16 : RUN bundle install ---> Running in f2a52936b83d Fetching gem metadata from https://rubygems.org/......... (઺ۚ) ---> 1f57192986de Step 16/16 : CMD ./bin/rails server ---> Running in b8b2bab7504c ---> dc51ead245a0 Removing intermediate container b8b2bab7504c Successfully built dc51ead245a0 Successfully tagged translator:latest

Slide 49

Slide 49 text

$ docker run \ -p 8080:8080 \ -e SECRET_KEY_BASE=XXX \ translator:latest => Booting Puma => Rails 5.1.3 application starting in production on http://0.0.0.0:8080 => Run `rails server -h` for more startup options Puma starting in single mode...

Slide 50

Slide 50 text

$ docker run \ -p 8080:8080 \ -e SECRET_KEY_BASE=XXX \ translator:latest => Booting Puma => Rails 5.1.3 application starting in production on http://0.0.0.0:8080 => Run `rails server -h` for more startup options Puma starting in single mode...

Slide 51

Slide 51 text

App Engine

Slide 52

Slide 52 text

app.yaml Google Cloud SDK gcloud app deploy

Slide 53

Slide 53 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 54

Slide 54 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 55

Slide 55 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 56

Slide 56 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 57

Slide 57 text

Memory calculation

Slide 58

Slide 58 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 59

Slide 59 text

Health check health_check 
 7 liveness readiness check • Liveness check 
 • Readiness check 


Slide 60

Slide 60 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 61

Slide 61 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 62

Slide 62 text

app.yaml (manual scaling) runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 manual_scaling: instances: 10 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 63

Slide 63 text

app.yaml runtime: custom env: flex skip_files: - .env - tmp/ - node_modules resources: cpu: 1 memory_gb: 1 disk_size_gb: 10 liveness_check: path: '/_internal/checks/health' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 readiness_check: path: '/_internal/checks/ready' check_interval_sec: 5 timeout_sec: 5 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 automatic_scaling: min_num_instances: 1 max_num_instances: 10 cool_down_period_sec: 120 cpu_utilization: target_utilization: 0.6 env_variables: SECRET_KEY_BASE: 'XXX'

Slide 64

Slide 64 text

app.yaml Google Cloud SDK gcloud app deploy

Slide 65

Slide 65 text

app.yaml Google Cloud SDK gcloud app deploy

Slide 66

Slide 66 text

App Engine $ gcloud app create You are creating an app for project [project-id]. WARNING: Creating an App Engine application for a project is irreversible and the region cannot be changed. More information about regions is at https://cloud.google.com/appengine/docs/locations. Please choose the region where you want your App Engine application located: [1] us-central (supports standard and flexible) (઺ۚ) [6] asia-northeast1 (supports standard and flexible) (઺ۚ) [9] cancel Please enter your numeric choice: 6 Creating App Engine application in project [project-id] and region [asia-northeast1]....done. Success! The app is now created. Please use `gcloud app deploy` to deploy your first app.

Slide 67

Slide 67 text

$ gcloud app deploy Services to deploy: descriptor: [/Users/premist/dev/translator/app.yaml] source: [/Users/premist/dev/translator] target project: [sample-project-id] target service: [default] target version: [20170822t013314] target url: [https://sample-project-id.appspot.com] Do you want to continue (Y/n)? y If this is your first deployment, this may take a while...done. Beginning deployment of service [default]... Updating service [default]...done. Deployed service [default] to [https://sample-project-id.appspot.com] You can stream logs from the command line by running: $ gcloud app logs tail -s default To view your application in the web browser run: $ gcloud app browse

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

Under the hood

Slide 70

Slide 70 text

Cloud SDK User's Computer Google Cloud Cloud Storage Cloud Container Builder App Engine Source upload

Slide 71

Slide 71 text

Cloud SDK User's Computer Google Cloud Cloud Storage Cloud Container Builder App Engine Source upload Trigger build

Slide 72

Slide 72 text

Cloud SDK User's Computer Google Cloud Cloud Storage Cloud Container Builder App Engine Source upload Trigger build Create new version

Slide 73

Slide 73 text

Cloud SDK User's Computer Google Cloud Cloud Storage Cloud Container Builder App Engine Source upload Trigger build Create new version Wait for version to be ready

Slide 74

Slide 74 text

Cloud SDK User's Computer Google Cloud Cloud Storage Cloud Container Builder App Engine Source upload Trigger build Create new version Wait for version to be ready Update traffic split

Slide 75

Slide 75 text

$ gcloud app deploy

Slide 76

Slide 76 text

Monitoring

Slide 77

Slide 77 text

App Engine

Slide 78

Slide 78 text

Stackdriver Monitoring

Slide 79

Slide 79 text

$ gcloud app logs tail

Slide 80

Slide 80 text

Cloud Console

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

?

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

App Engine Flexible Environment

Slide 86

Slide 86 text

Ruby on Rails

Slide 87

Slide 87 text

Ruby on Rails App Engine Flex 30

Slide 88

Slide 88 text

Ruby on Rails App Engine Flex 30 Cloud IAP

Slide 89

Slide 89 text

Ruby on Rails App Engine Flex 30 Cloud IAP

Slide 90

Slide 90 text

Cloud IAP

Slide 91

Slide 91 text

G Suite

Slide 92

Slide 92 text

Cloud IAP

Slide 93

Slide 93 text

Cloud IAP

Slide 94

Slide 94 text

Ruby on Rails App Engine Flex 30 Cloud IAP

Slide 95

Slide 95 text

... (Cloud Security Scanner) canary SSL • Stackdriver Tracing, Debugger, Error Reporting, …

Slide 96

Slide 96 text

canary

Slide 97

Slide 97 text

Stackdriver Trace

Slide 98

Slide 98 text

Stackdriver Trace

Slide 99

Slide 99 text

TL;DR 
 
 App Engine App Engine Standard 
 Flexible Environment

Slide 100

Slide 100 text

gRPC 
 Non-HTTP 
 Kubernetes Engine Standard ജ҃ীח ੓ח ૑୹ ೠب ӝמ੉ হ׮ Compute Engine

Slide 101

Slide 101 text

Iowa Compute Engine: 1 App Engine Compute Engine Standard Sustained $42.984/mo $96.192/mo $223.056/mo Memory vCPU 1GB 2 4GB 4 14GB Preemptible $27.0864/mo $60.57504/mo $140.3568/mo $19.3/mo $43.3/mo $100.7/mo $6.79/mo $14.89/mo $35.09/mo

Slide 102

Slide 102 text

Iowa Heroku: Standard-2X, P-M, P-L 1 App Engine $42.984/mo $88.524/mo $223.056/mo Memory vCPU 1GB 2 2.5GB 4 14GB $50/mo $250/mo $500/mo Heroku

Slide 103

Slide 103 text

Thank you! . bit.ly/shakr-gae-flex Shakr . careers.shakr.com