Unable to start the Google App Engine user-managed virtual machine: - an error must be set at the user point

DESCRIPTION OF THE PROBLEM

I am trying to create a custom managed virtual machine for Google App Engine that behaves the same way with the standard python27 managed virtual machine provided by Google. (I am doing this as a first step towards adding a C ++ library at runtime).

From the google documentation, the following Docker file indicates the standard python27 runtime:

FROM gcr.io/google_appengine/python-compat
ADD . /app

I checked that this is the correct Docker file by examining the file generated gcloud preview app runwhen using the standard python27 runtime. He is identical to this.

But when I run my application with this Docker file using dev_appserver.pyor with gcloud preview app run, I get an error message:

The --custom_entrypoint flag must be set for custom runtimes

I use the latest versions of gcloud (1.9.86, with app-engine-python component version 1.9.28) and the standalone application SDK for python applications (1.9.28). I had the same problem with earlier versions, so I upgraded to the latest version.

THINGS RECEIVED:

gcloud preview app run --helpmatters --custom-entrypoint:

 --custom-entrypoint CUSTOM_ENTRYPOINT
    Specify an entrypoint for custom runtime modules. This is required when
    such modules are present. Include "{port}" in the string (without
    quotes) to pass the port number in as an argument. For instance:
    --custom_entrypoint="gunicorn -b localhost:{port} mymodule:application"

I'm not sure what to do with this. If the docker image no longer contains ENTRYPOINT? Why should I provide this extra? Also, what should be the entry point for the image gcr.io/google_appengine/python-compat? Google does not provide documentation for this.

I tried a meaningless --custom-entrypoint="echo"one that suppresses the error, but the application does not respond to any HTTP requests.

stackoverflow, , . , , , SDK, . SDK, , .

:

, , . :

app.yaml:

module: default
version: 1
runtime: custom
api_version: 1
threadsafe: true
vm: true

handlers:
- url: /.*
  script: wsgi.app

Dockerfile:

FROM gcr.io/google_appengine/python-compat
ADD . /app

Dockerfile , python27 ( Docker, gcloud preview app run python27), runtime: python27.

wsgi.py:

import webapp2

class Hello(webapp2.RequestHandler):
    def get(self):
        self.response.write(u'Hello')

app = webapp2.WSGIApplication([('/Hello', Hello)], debug=True)

dev_appserver.py app.yaml , , :

Traceback (most recent call last):
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in <module>
    main()
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1026, in main
    dev_server.start(options)
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 818, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
    _module.start()
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1555, in start
    self._add_instance()
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1707, in _add_instance
    expect_ready_request=True)
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/custom_runtime.py", line 73, in new_instance
    assert self._runtime_config_getter().custom_config.custom_entrypoint
  File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 383, in _get_runtime_config
    raise ValueError('The --custom_entrypoint flag must be set for '
ValueError: The --custom_entrypoint flag must be set for custom runtimes
+4
3

UPDATE

. .

( , )


, w.r.t. :

!

, , , dev_appserver.py dev_appserver.py, Google .

, - , Readme appengine-java-vm-guestbook-extras demo github ():

Cloud SDK , . Engine

Google :

  • .
  • , .
  • , .

, , - .

+10

1. , user862857, Docker Docker . Runtimes .


. GIDUB README -. runtime: custom dev, Dockerfile, OP,

FROM gcr.io/google_appengine/python-compat
ADD . /app

--runtime=python-compat. , /_ah/start /_ah/health. , :

devserver command

$ dev_appserver.py app.yaml --runtime=python-compat

app.yaml

runtime: custom
vm: true
api_version: 1
threadsafe: true

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

Dockerfile

FROM gcr.io/google_appengine/python-compat

RUN apt-get update

RUN apt-get install -y gwhois

ADD . /app

main.py

import logging
import webapp2
from subprocess import Popen, PIPE

class OkHandler (webapp2.RequestHandler):
    def get (self): 
        self.response.write ('ok')

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        domain = self.request.get ('domain')
        cmd = ["gwhois", domain]
        process = Popen (cmd, stdout=PIPE, stderr=PIPE)
        output, err = process.communicate()
        exit_code = process.wait()
        self.response.write('stdout: %s' % output)
        logging.info ('stderr: %s' % err)

app = webapp2.WSGIApplication([
    ('/', MainPage),
    ('/_ah/start', OkHandler),
    ('/_ah/health', OkHandler)
], debug=True)

/?domain=stackoverflow.com, .


N.B.

python-compat / WSGI python, --custom_entrypoint, , WSGI ( uwsgi gunicorn).

+6

, dev_appserver, , . , dev- , , , Docker.

, , , . , , . , Docker App Engine ( App Engine, ), , , , .

, python, Compute Engine, , VM (, , webapp2, ). , .

, , , :

  • : ( ) .

    • , , gunicorn requirements.txt. , , pip install -t ..., . gunicorn , PATH.
  • : pip install gunicorn


  • : google.appengine.* Docker App Engine APA (AFAICT).
    • , google.appengine.ext.vendor - App Engine.
  • : , Google App Engine .

script

The script to create and deploy the VM dock image into the docker container works locally here .

In a working example, check out my project .

Let me know if you have a comment, request for a function, or if you write a more beautiful bash than me (I feel like I set the bar comfortably on this account).

0
source

Source: https://habr.com/ru/post/1616265/


All Articles