2017-02-10 74 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',就像你在目录结构中提到的那样,对吧? –