반응형
google app engine 사용하기 ][ python hello world 출력 및 배포하기
https://cloud.google.com/appengine/
■ app engine 선택
■ ruby 선택
■ 리소스에 "documentation"과 github 샘플 참조
■ 샘플 소스 다운로드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/GoogleCloudPlatform/ruby-docs-samples | |
cd ruby-docs-samples/appengine/hello_world |
■ app.rb 소스 확인
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2015 Google, Inc | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# [START gae_flex_quickstart] | |
require "sinatra" | |
get "/" do | |
"Hello world!" | |
end | |
# [END gae_flex_quickstart] |
■ app.yaml 확인
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2015 Google, Inc | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# [START gae_flex_quickstart_yaml] | |
runtime: ruby | |
env: flex | |
entrypoint: bundle exec ruby app.rb | |
# This sample incurs costs to run on the App Engine flexible environment. | |
# The settings below are to reduce costs during testing and are not appropriate | |
# for production use. For more information, see: | |
# https://cloud.google.com/appengine/docs/flexible/ruby/configuring-your-app-with-app-yaml | |
manual_scaling: | |
instances: 1 | |
resources: | |
cpu: 1 | |
memory_gb: 0.5 | |
disk_size_gb: 10 | |
# [END gae_flex_quickstart_yaml] |
■ cloud shell에서 app테스트
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle install | |
bundle exec ruby app.rb -p 8080 |
■ 배포
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud app create | |
gcloud app deploy |
■ 결과 확인
반응형
'Google Cloud > 0x01-app engine' 카테고리의 다른 글
google app engine 사용하기 ][ go hello world 출력 및 배포하기 (0) | 2019.02.19 |
---|---|
google app engine 사용하기 ][ python으로 google otp 사용하기 (0) | 2019.02.18 |
google app engine 사용하기 ][ nodejs hello world 출력 및 배포하기 (0) | 2019.02.14 |
google app engine 사용하기 ][ python hello world 출력 및 배포하기 (0) | 2019.02.14 |