简体   繁体   English

Google App Engine-找不到调度配置

[英]Google App Engine - Could not find dispatch configuration

I want to create very standard setup for GAE (php runtime): 2 modules with specific URLs (routings): 我想为GAE(PHP运行时)创建非常标准的设置:2个具有特定URL(路由)的模块:

  • module-api for REST API REST API的module-api
  • module-app for web base application 用于Web基础应用程序的module-app

I've created 4 .yaml config files: 我已经创建了4个.yaml配置文件:
app.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 dispatch.yaml

application: ABC

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

- url: "*/*"
  module: default

web_based.yaml 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 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  

Directory structure: 目录结构:

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

When I try update_dispatch, I get dispatch configuration file is not found. 当我尝试update_dispatch时,我找不到调度配置文件。 Can someone help me? 有人能帮我吗?

In a multi-module app there is no app-level app.yaml anymore, there is only one .yaml file for each module and that's it. 在多模块应用程序中,不再有应用程序级别的app.yaml ,每个模块只有一个.yaml文件,仅此而已。

So get rid of the top-level app.yaml (if needed merge its relevant content into the api.yaml file, which is the one for your default module). 因此,摆脱顶级app.yaml (如果需要,将其相关内容合并到api.yaml文件中,这是您的default模块之一)。 The 2 files collide and can confuse the update_dispatch operation. 这两个文件冲突,可能会使update_dispatch操作混乱。 Then deploy the default module - often it needs to be deployed before app-level configs (like the dispatch.yaml file) and the other modules can be deployed. 然后部署默认模块-通常需要先部署它,然后才能部署应用程序级配置(例如dispatch.yaml文件)和其他模块。

Maybe peek at Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure? 就文件夹结构而言,Google App Engine应用程序中的默认服务/模块是否可以成为非默认服务的同级产品? , it's for a python app but many things in there like app dir structure, app-level configs (dispatching for example) and deployment are applicable to php as well. ,它适用于python应用程序,但其中的许多内容(例如应用程序目录结构,应用程序级配置(例如调度)和部署)也适用于php。

Side notes: 旁注:

  • you're also missing a dynamic handler inside web_based.yaml . 您还缺少web_based.yaml的动态处理程序。
  • you don't need a dispatch rule for the default module - that's where the requests with no routes are dispatched to anyways 不需要的调度规则default模块-这就是没有路由请求被分派到反正
  • personally I'd make the web app the default module and the REST one a non-default one - I wouldn't like all garbage coming in hitting the REST module by default... 我个人将Web应用程序设置为默认模块,而将REST应用程序设置为非默认模块-我不希望所有垃圾默认进入REST模块...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM