2
I'm migrating my standard environment app to flexible environment in GAE and facing issues.

app.yaml snippet

runtime: custom
env: flex
api_version: 1
threadsafe: true

handlers:

- url: /.*
  script: main.app

Dockerfile

FROM gcr.io/google_appengine/python-compat-multicore
RUN apt-get update -y
RUN apt-get install -y python-pip build-essential libssl-dev libffi-dev python-dev libxml2-dev libxslt1-dev xmlsec1

RUN apt-get install -y curl unzip
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
RUN mkdir -p /usr/local/gcloud
RUN tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz
RUN /usr/local/gcloud/google-cloud-sdk/install.sh

RUN curl https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.40.zip > /tmp/google_appengine_1.9.40.zip
RUN unzip /tmp/google_appengine_1.9.40.zip -d /usr/local/gae

ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
ENV PATH $PATH:/usr/local/gae/google_appengine/
COPY . /app
WORKDIR /app

ENV MODULE_YAML_PATH app.yaml

RUN pip install -r requirements.txt

issue while running gcloud app deploy(stack trace)

 File "/env/local/lib/python2.7/site-packages/google/appengine/ext/vmruntime/vmconfig.py", line 63, in BuildVmAppengineEnvConfig
    escaped_appid = appid.replace(':', '_').replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'

Is there anything which I'm missing in dockerfile? What are the other configuration changes which should be done such that there is not much application level code changes. Is it advidsable to use webapp2 in flexible environment

chetan
  • 125
  • 1
  • 12
  • It seems in flexible environment metadata information is not accessible to the app engine so it has to be provided to it through metadata services. Still trying to figure out a working solution. – chetan Nov 29 '16 at 14:09

1 Answers1

0

We're working on a better error message, but this is happening because you're trying to use the python-compat-multicore runtime. That runtime is not supported on env:flex, and has been deprecated. We're asking folks to follow this guide to upgrade to runtime:python:

https://cloud.google.com/appengine/docs/flexible/python/migrating

Justin Beckwith
  • 7,686
  • 1
  • 33
  • 55
  • I can't use runtime:python as I need c libraries mentioned in dockerfile. So I tried building from gcr.io/google_appengine/python instead of gcr.io/google_appengine/python-compat-multicore and it got deployed successfully however when I visited the url for app I got server error. Looking at errors I can see "BadArgumentError: app must not be empty". So I provided entrypoint as gunicorn server in the dockerfile but now ndb library of app engine is not getting imported I read somewhere that it's because of the python image so thats why I'm using python-compat-multicore as base docker image. – chetan Nov 30 '16 at 11:19
  • You can check my other question and its discussion for more details. http://stackoverflow.com/questions/40840855/not-able-to-set-environment-variable-in-dockerfile-for-custom-runtime-environmen – chetan Nov 30 '16 at 11:21