Custom runtime for non-flexible environment app?

2020-05-06 12:26发布

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

1条回答
The star\"
2楼-- · 2020-05-06 13:04

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

查看更多
登录 后发表回答