非灵活环境应用程序的自定义运行时间? [英] Custom runtime for non-flexible environment app?

查看:124
本文介绍了非灵活环境应用程序的自定义运行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不认为我的gae python应用程序有一个灵活的环境,因为我创建了许多年前。现在我想尝试创建一个具有比python更多的运行时间的模块,并保持python应用程序在新的运行时,自定义或另一个运行时运行python。也许混合PHP和python或类似的。我不需要它,但我想学习和探索的可能性。我也有兴趣学习Erlang并使用appengine部署Erlang代码。我看到有问题已经有了



erlang在谷歌应用程序引擎?



在跟踪器中发布125。



但是我们该怎么做呢?如果我们使自己的运行时提供允许的话。



我的app.yaml看起来像

 应用程序:montaoproject 
版本:newsearch
运行时:python27
api_version:1
线程安全:true
模块:默认
instance_class:F1
automatic_scaling:
min_idle_instances:5
max_idle_instances:automatic
min_pending_latency:automatic
max_pending_latency:30ms
max_concurrent_requests:50

default_expiration:14d 5h

env_variables:
GAE_USE_MONTAO:'anyvalue'
KOOL_VERSION:'17a'

包括:
- br.yaml#Br​​azil
- in。 yaml#印度
- us.yaml#美国
- pk.yaml
- search.yaml#搜索页
- admin.yaml#管理页
- 提供者。 yaml#auth providers
- statics.yaml#static content

处理程序:
- url:/(business|ai|newindia|insert-ad.html)
脚本:montao.app

- url:/blobview.*
脚本:kool_update.app
登录:admin

- url:/market.*
脚本:main.app

- url:/
脚本:montao.app

- url:/( index.html | sign-up.html | login.html)
脚本:montao.app

- url:/(login.*|login|googlogin|googlogout|create/)
脚本:login.app

- url:/(customer_service.htm|contactfileupload|support.html|faq.html)
脚本:customer_service.app

- url:/stats.*
脚本:google.appengine.ext.appstats.ui.app

#所有其他URL使用main.app
- url:/ *
脚本:main.app

inbound_services:
- mail

内置:
- remote_api:on
- deferred:on
# - appstats:on

error_handlers:
- file:default_error.html

库:
- 名称:webapp2
版本:最新
- 名称:jinja2
版本:最新
- 名称:setuptools
版本:最新
- 名称:markupsafe
版本:最新
- 名称:django
版本:最新
- 名称:PIL
版本:最新
- 名称:webob
版本:最新
- 名称:lxml
版本:最新
- 名称:ssl
版本:最新


解决方案

是的,您的 app.yaml 文件是一个标准的env文件(它没有 vm:true env:flex 是的,可以混用和匹配不同语言的服务/模块以及同一应用程序中的不同环境。您甚至可以在该模块的不同的版本中切换相同的模块的语言和环境。这是因为模块提供完整的代码隔离,请参见比较的服务隔离和项目隔离。相关文章:上传一个Java和node.js项目到Google AppEngine一次



我总是尝试构建一个多服务/模块应用程序,每个服务在自己的子目录,如 Google App Engine应用程序中的默认服务/模块可以在文件夹结构方面是非默认服务/模块吗?



首先,我将创建一个默认您的应用程序目录的子目录,并移动所有现有的默认值模块特定的文件到它,除了应用程序级别的配置,我将保持在顶层和符号链接里面的默认目录,如那个帖子然后,我将验证默认模块仍然按预期工作。



然后我将创建一个新的子目录对于每个新模块,我需要添加并根据需要添加代码。



旁注:通过符号链接共享代码,如上述文章中所述,适用于标准的env模块,但它可能无法使用灵活的,请参阅在GAE项目中共享模块之间的代码


I don't think that my gae python app has a flexible environment because I created it many years ago. Now I want to try and create a module that has another runtime than python and keep the python app running python alongside a new runtime, custom or just another. Maybe mix PHP and python or similar. I don't need it but I want to learn and explore the possibilities. I'm also interested in learning Erlang and deploy Erlang code with appengine. I see there is questions about it already

erlang on google app engine?

And issue 125 in the tracker.

But how should we actually do it? If we make our own runtime provided that is allowed.

My app.yaml looks like

application: montaoproject
version: newsearch
runtime: python27
api_version: 1
threadsafe: true
module: default
instance_class: F1
automatic_scaling:
  min_idle_instances: 5
  max_idle_instances: automatic
  min_pending_latency: automatic
  max_pending_latency: 30ms
  max_concurrent_requests: 50

default_expiration: "14d 5h"

env_variables:
  GAE_USE_MONTAO : 'anyvalue'
  KOOL_VERSION : '17a'

includes:
- br.yaml # Brazil
- in.yaml # India
- us.yaml # USA
- pk.yaml
- search.yaml # search pages
- admin.yaml # admin pages
- providers.yaml # auth providers
- statics.yaml # static content

handlers:
- url: /(business|ai|newindia|insert-ad.html)
  script: montao.app

- url: /blobview.*
  script: kool_update.app
  login: admin

- url: /market.*
  script: main.app

- url: /
  script: montao.app

- url: /(index.html|sign-up.html|login.html)
  script: montao.app

- url: /(login.*|login|googlogin|googlogout|create/)
  script: login.app

- url: /(customer_service.htm|contactfileupload|support.html|faq.html)
  script: customer_service.app

- url: /stats.*
  script: google.appengine.ext.appstats.ui.app

# All other URLs use main.app
- url: /.*
  script: main.app

inbound_services:
- mail

builtins:
- remote_api: on
- deferred: on
#- appstats: on

error_handlers:
  - file: default_error.html

libraries:
- name: webapp2
  version: latest
- name: jinja2
  version: latest
- name: setuptools
  version: latest
- name: markupsafe
  version: latest
- name: django
  version: latest
- name: PIL
  version: latest
- name: webob
  version: latest
- name: lxml
  version: latest
- name: ssl
  version: latest

解决方案

Yes, your app.yaml file is a standard env one (it doesn't have vm:true or env:flex in it).

Yes, it's possible to mix and match services/modules in different languages and with different environments inside the same app. You can even switch the language and environment of the same module in a different version of that module. That's because modules offer complete code isolation, see Comparison of service isolation and project isolation. Related post: Upload a Java and node.js project to Google AppEngine at once

I always try to structure a multi-service/module app with each service in its own subdir, as described in Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?

So first I'd create a default subdirectory of your app dir and move all your existing default module specific files into it, with the exception of the app-level config, which I'd keep at the top level and symlink inside the default dir as described in that post. Then I'd verify that the default module still works as expected.

Then I'd create a new subdirectory for every new module I need to add and add the code for it as needed.

Side note: sharing code via symlinks as described in the post mentioned above works for standard env modules, but it probably doesn't work with flexible ones, see Sharing code between modules in a GAE project

这篇关于非灵活环境应用程序的自定义运行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆