注意:Go 1.11 已於 2024 年 1 月 30 日
停止支援。現有的 Go 1.11 應用程式將繼續執行並接收流量。不過,App Engine 可能會阻擋
支援期限過後使用執行階段的應用程式重新部署。建議您
改用最新的 Go 支援版本。
定義執行階段設定
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
App Engine 中的 Go 1.11 應用程式是使用 app.yaml
檔案進行設定,當中包含執行階段、處理常式、資源調度,以及包含環境變數在內的其他一般設定。
app.yaml
檔案簡介
您可以在
app.yaml
檔案中指定 Go 1.11 應用程式的執行階段設定,包括版本和網址。這個檔案可做為特定
服務版本的部署作業描述元。
您必須先為應用程式的 default
服務建立 app.yaml
檔案,才能為其他服務建立及部署 app.yaml
檔案。
一般來說,app.yaml
檔案只需要 runtime
元素,即可在標準環境中執行簡易的 Go 1.11 應用程式,例如:
runtime: go111
如要進一步瞭解如何建構應用程式中的多項服務和
app.yaml
檔案,請參閱
為網路服務建立結構。
App Engine 會為所有其他設定提供預設值,包括用於決定應用程式可用的記憶體和 CPU 資源的 F1 執行個體類別,以及用於控制建立應用程式新執行個體的方式和時機的自動調整。
如果您需要覆寫預設設定,請建立 app.yaml
檔案並指定所需設定。詳情請參閱 app.yaml
檔案參考資料。
您可以為 app.yaml
檔案指定不重複的名稱,但稍後必須一併使用部署指令指定檔案名稱。舉例來說,如果您將 app.yaml
檔案命名為 service-name-app.yaml
或 app.standard.yaml
,就必須使用下列其中一種方式來部署應用程式:
gcloud app deploy service-name-app.yaml
gcloud app deploy app.standard.yaml
所有設定元素
如需這個設定檔中支援元素的完整清單,請參閱 app.yaml
參考資料。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-08 (世界標準時間)。"],[[["A Go 1.11 app in App Engine uses an `app.yaml` file to configure its runtime, handlers, scaling, environment variables, and other settings."],["The `app.yaml` file is essential for deploying a specific service version and must be created for the default service before adding others."],["A simple Go 1.11 app generally only needs the `runtime` element specified in its `app.yaml` file, with other settings defaulting to App Engine's configurations."],["You can customize the default settings of your app by creating an `app.yaml` file and overriding the desired settings."],["While `app.yaml` can be named uniquely, doing so requires you to specify the file's name in the deployment command."]]],[]]