app.yaml로 앱 구성

App Engine 앱은 CPU, 메모리, 네트워크 및 디스크 리소스, 확장, 환경 변수를 비롯한 기타 일반 설정이 포함된 app.yaml 파일을 사용하여 구성됩니다.

app.yaml 파일 정보

버전과 URL이 포함된 Go 앱의 런타임 구성을 app.yaml 파일에 지정할 수 있습니다. 이 파일은 특정 서비스 버전의 배포 설명자 역할을 합니다.

추가 서비스를 위해 app.yaml 파일을 만들고 배포하려면 먼저 default 서비스의 app.yaml 파일을 만들어야 합니다.

다음 app.yaml에서는 Go 1.15 이하 및 1.18 이상에 대해 앱을 구성하는 방법을 보여줍니다. 참고로 새 버전을 사용하려면 app.yaml 파일을 업데이트해야 합니다. 새 버전 사용에 대한 자세한 내용은 Go 런타임을 참조하세요.

v1.18 이상

# Copyright 2019 Google LLC
#
# 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
#
#     https://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.

runtime: go
env: flex

runtime_config:
  operating_system: 'ubuntu22'
  runtime_version: '1.18'

# 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/python/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

v1.15 이하

# Copyright 2023 Google LLC
#
# 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
#
#     https://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.

runtime: go
env: flex

# 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/python/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

앱 서비스의 복잡성에 따라 해당 app.yaml 파일에 몇 가지 요소만 정의해야 할 수 있습니다. 다음 예에서는 가변형 환경에 필요한 간단한 Go 앱을 보여줍니다.

app.yaml 파일에 고유한 이름을 지정할 수 있습니다. 하지만 이렇게 하면 배포 명령어에도 파일 이름을 지정해야 합니다. 예를 들어 app.yaml 파일의 이름을 service-name-app.yaml이나 app.flexible.yaml로 지정한 후 다음 중 하나를 사용하여 앱을 배포해야 합니다.

gcloud app deploy service-name-app.yaml
gcloud app deploy app.flexible.yaml
앱에서 여러 서비스와 app.yaml 파일을 구조화하는 방법에 대한 자세한 내용은 웹 서비스 구조화를 참조하세요.

모든 구성 요소

이 구성 파일에서 지원되는 모든 요소의 전체 목록은 app.yaml 참조를 확인하세요.