2017-02-10 129 views
0

我想爲GAE(PHP運行時)創建非常標準設置:2個模塊將特定的URL(路線):谷歌應用程序引擎 - 無法找到調度配置

  • 模塊的API,用於REST API
  • 模塊應用的網絡基礎應用

我創建4 .yaml配置文件:
的app.yaml

application: ABC 
version: 1 
runtime: php55 
api_version: 1 
threadsafe: yes 

automatic_scaling: 
    max_idle_instances: 20 

handlers: 
- url: /.* 
    script: api/web/index.php 

dispatch.yaml

application: ABC 

dispatch: 
- url: "*/app/*" 
    module: web-based 

- url: "*/*" 
    module: default 

web_based.yaml

application: ABC 
module: web-based 
version: 1 
runtime: php55 
api_version: 1 
threadsafe: yes 

automatic_scaling: 
    min_idle_instances: 2 
    max_pending_latency: 1s 

handlers: 
- url: /(.*\.(gif|png|jpg|css|js|otf)) 
    static_files: /\1 
    upload: /(.*\.(gif|png|jpg|js|css|otf)) 

api.yaml

application: ABC 
module: default 
version: 1 
runtime: php55 
api_version: 1 
threadsafe: yes 

manual_scaling: 
    instances: 1 

handlers: 
- url: /(.*\.(gif|png|jpg|css|js|otf)) 
    static_files: web/\1 
    upload: web/(.*\.(gif|png|jpg|js|css|otf)) 

- url: /assets/(.+) 
    static_files: web/assets/\1 
    upload: web/assets/(.+) 

- url: /.* 
    script: web/index.php 

目錄結構:

- api/api.yaml 
- app/web_base.yaml 
- app.yaml 
- dispatch 

當我嘗試update_dispatch,我得到調度配置文件沒有找到。有人能幫我嗎?

回答

0

在多模塊應用程序中,不再有應用程序級別app.yaml,每個模塊只有一個.yaml文件,就是這樣。

所以擺脫頂層app.yaml(如果需要將其相關內容合併到api.yaml文件,這是您的default模塊的文件)。這兩個文件相撞並可能會混淆update_dispatch操作。然後部署默認模塊 - 通常需要在應用級配置之前部署(例如dispatch.yaml文件),並且可以部署其他模塊。

也許偷看Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?,它是一個python應用程序,但是像app目錄結構,應用程序級配置(例如調度)和部署等許多事情都適用於php。

旁註:

  • 你還缺少內web_based.yaml動態處理函數。
  • 你不需要default模塊調度規則 - 這就是沒有路由請求被分派到反正
  • 我個人倒使Web應用程序的默認模塊,其餘的一個非默認的一個 - 我不喜歡所有的垃圾默認打到REST模塊...
+0

謝謝你的回覆。我已經從根文件夾中刪除了app.yaml並更新了這兩個模塊。仍然收到該錯誤。有任何想法嗎? –

+0

這是你使用的確切的cmd和哪個目錄? –

+0

順便說一句,你的文件實際上叫做'dispatch.yaml',而不是'dispatch',就像你在目錄結構中提到的那樣,對吧? –