App Engine SDK 獨立版已於 2019 年 7 月 30 日淘汰,並已關閉。下表列出功能和建議的替代方案:
已淘汰 | 建議做法 |
---|---|
App Engine SDK 獨立版 | 下載 Google Cloud CLI |
使用 App Engine SDK 存取 App Engine 舊版 API | 遷移至未套裝組合的 Google Cloud 或第三方服務,或使用 App Engine 服務 SDK 存取套裝組合服務 (如果您使用的是第二代執行階段) |
appcfg 指令 |
從 AppCfg 遷移至 gcloud 指令列 |
dev_appserver.sh 指令 |
如要進行本機開發,請從 gcloud CLI 的 bin 目錄執行 java_dev_appserver.sh 指令 |
Maven 適用且以 Java App Engine SDK 為基礎的外掛程式 (com.google.appengine.appengine-maven ) |
遷移至以 gcloud CLI 為基礎的 Maven 外掛程式 |
Gradle 適用且以 Java App Engine SDK 為基礎的外掛程式 (com.google.appengine.appengine-gradle ) |
遷移至以 gcloud CLI 為基礎的 Gradle 外掛程式 |
cron.xml 、datastore-index.xml 、dispatch.xml 和 queue.xml 檔案格式 |
使用 gcloud beta app migrate-config 工具自動進行遷移,或是手動將 xml 遷移至 yaml 檔案。 |
遷移時間表
2019 年 7 月 30 日:淘汰以 App Engine SDK 獨立版為基礎的工具。
2020 年 8 月 30 日:App Engine SDK 獨立版將不再開放下載,並且可能無法正常運作。
2020 年 8 月 30 日:Google 關閉並移除對 App Engine SDK 獨立版的支援。
回溯不相容的功能
隨著 appcfg
工具和 App Engine SDK 獨立版的關閉,gcloud CLI 目前不支援下列功能:
- 使用 AppCfg 下載應用程式的檔案。
將 XML 轉換成 YAML 檔案格式
gcloud CLI 不支援下列檔案格式:
cron.xml
datastore-index.xml
dispatch.xml
queue.xml
以下範例說明如何將 xml
檔案轉換成 yaml
檔案。
自動遷移檔案
如何自動遷移 xml
檔案:
您必須具備 gcloud CLI 226.0.0 以上版本。如要更新至最新版本:
gcloud components update
對您要遷移的每個檔案,指定下列其中一個子指令 (
cron-xml-to-yaml
、datastore-indexes-xml-to-yaml
、dispatch-xml-to-yaml
、queue-xml-to-yaml
) 和檔案名稱:gcloud beta app migrate-config queue-xml-to-yaml MY-QUEUE-XML-FILE.xml
在部署到實際工作環境之前,先手動再次檢查已轉換的檔案。
如需
xml
到yaml
的檔案成功轉換範例,請參閱「手動遷移檔案」分頁。
手動遷移檔案
如何手動將 xml
檔案轉換成 yaml
檔案:
cron.yaml
使用包含物件清單的 cron
物件建立 cron.yaml
檔案,每個物件都包含與 cron.xml
檔案中每個 <cron>
標記屬性對應的欄位,如下所示。
轉換後的 cron.yaml
檔案:
cron:
- url: '/recache'
schedule: 'every 2 minutes'
description: 'Repopulate the cache every 2 minutes'
- url: '/weeklyreport'
schedule: 'every monday 08:30'
target: 'version-2'
timezone: 'America/New_York'
description: 'Mail out a weekly report'
原始 cron.xml
檔案:
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/recache</url>
<description>Repopulate the cache every 2 minutes</description>
<schedule>every 2 minutes</schedule>
</cron>
<cron>
<url>/weeklyreport</url>
<description>Mail out a weekly report</description>
<schedule>every monday 08:30</schedule>
<timezone>America/New_York</timezone>
<target>version-2</target>
</cron>
</cronentries>
詳情請參閱 cron.yaml
參考資料說明文件。
dispatch.yaml
使用包含物件清單的 dispatch
物件的 dispatch.yaml
檔案,每個物件都包含與 dispatch.xml
檔案中每個 <dispatch>
標記屬性對應的欄位,如下所示。
轉換後的 dispatch.yaml
檔案:
dispatch:
- url: '*/favicon.ico'
module: default
- url: 'simple-sample.uc.r.appspot.com/'
module: default
- url: '*/mobile/*'
module: mobile-frontend
原始 dispatch.xml
檔案
<?xml version="1.0" encoding="UTF-8"?>
<dispatch-entries>
<dispatch>
<url>*/favicon.ico</url>
<module>default</module>
</dispatch>
<dispatch>
<url>simple-sample.uc.r.appspot.com/</url>
<module>default</module>
</dispatch>
<dispatch>
<url>*/mobile/*</url>
<module>mobile-frontend</module>
</dispatch>
</dispatch-entries>
詳情請參閱 dispatch.yaml
參考說明文件
index.yaml
使用包含物件清單的 indexes
物件建立 index.yaml
檔案,每個物件都包含與 datastore-indexes.xml
檔案中每個 <datastore-index>
標記屬性對應的欄位,如下所示。
轉換後的 index.yaml
檔案:
indexes:
- ancestor: false
kind: Employee
properties:
- direction: asc
name: lastName
- direction: desc
name: hireDate
- ancestor: false
kind: Project
properties:
- direction: asc
name: dueDate
- direction: desc
name: cost
原始 datastore-index.xml
檔案:
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
autoGenerate="true">
<datastore-index kind="Employee" ancestor="false">
<property name="lastName" direction="asc" />
<property name="hireDate" direction="desc" />
</datastore-index>
<datastore-index kind="Project" ancestor="false">
<property name="dueDate" direction="asc" />
<property name="cost" direction="desc" />
</datastore-index>
</datastore-indexes>
詳情請參閱 index.yaml
參考資料說明文件。
queue.yaml
使用包含物件清單的 queue
物件的 queue.yaml
檔案,每個物件都包含與 queue.xml
檔案中每個 <queue>
標記屬性對應的欄位,如下所示。
轉換後的 queue.yaml
檔案:
queue:
- name: fooqueue
mode: push
rate: 1/s
retry_parameters:
task_retry_limit: 7
task_age_limit: 2d
- name: barqueue
mode: push
rate: 1/s
retry_parameters:
min_backoff_seconds: 10
max_backoff_seconds: 200
max_doublings: 0
原始 queue.xml
檔案:
<queue-entries>
<queue>
<name>fooqueue</name>
<rate>1/s</rate>
<retry-parameters>
<task-retry-limit>7</task-retry-limit>
<task-age-limit>2d</task-age-limit>
</retry-parameters>
</queue>
<queue>
<name>barqueue</name>
<rate>1/s</rate>
<retry-parameters>
<min-backoff-seconds>10</min-backoff-seconds>
<max-backoff-seconds>200</max-backoff-seconds>
<max-doublings>0</max-doublings>
</retry-parameters>
</queue>
<queue-entries>