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...
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
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