GAE ERROR :- /bin/sh: 1: exec: gunicorn: not found

I trying to deploy my app on GAE using their trial version. I was so far successful in creating an app.yaml with a custom settings for flexible environment with python 3.6.

However, while deploying the app, the app builds successfully, however, I keep getting the following error

Updating service [default] (this may take several minutes)...failed. ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error: /bin/sh: 1: exec: gunicorn: not found

Following is the folder hierarchy of files in my project:

enter image description here

Following the code for app.yaml

env: flex runtime: custom api_version: 1 entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3.6 #handlers: #- url: /SmsResponse # script: Twilio_Routing.RecivedSms # #- url: /CallResponse # script: Twilio_Routing.ReceivedCall 

I am surely missing out on something and I would really appreciate some help here. Link to git repo

requirements.txt

Flask==0.10.1 gunicorn==19.3.0 twilio==6.8.4 

DockerFile

FROM LABEL python_version=python3.6 RUN virtualenv --no-download /env -p python3.6 # Set virtualenv environment variables. This is equivalent to running # source /env/bin/activate ENV VIRTUAL_ENV /env ENV PATH /env/bin:$PATH # Copy the application's requirements.txt and run pip to install all # dependencies into the virtualenv. ADD requirements.txt requirements.txt RUN pip install -r requirements.txt ADD . /app/ #CMD gunicorn -b :$PORT main:app ENTRYPOINT [ "python", "Twilio_Routing.py" ] 

P.S. After the changes for the requirements.txt, I am getting error 502 Bad Gateway.

Logs showing that the service was executed successfully.

017-12-25 01:29:03 default[20171224t212610] * Running on (Press CTRL+C to quit) 2017-12-25 01:29:03 default[20171224t212610] * Restarting with stat 2017-12-25 01:29:03 default[20171224t212610] * Debugger is active! 2017-12-25 01:29:03 default[20171224t212610] * Debugger PIN: 134-103-452 2017-12-25 01:29:17 default[20171224t212610] * Running on (Press CTRL+C to quit) 2017-12-25 01:29:17 default[20171224t212610] * Restarting with stat 2017-12-25 01:29:17 default[20171224t212610] * Debugger is active! 2017-12-25 01:29:17 default[20171224t212610] * Debugger PIN: 134-103-452 

Can someone look at my code in git and tell me what is it that I am missing here?

5

3 Answers

for me the error was as simple as making sure gunicorn was in requirements.txt

Flask==1.0.2 gunicorn==19.9.0 

Note:

I see the OP had added this flag; this is to help others that may be running into exec: gunicorn: not found

A few changes and I was able to run your app in docker.

  1. In Twilio_Routing.py , change host to listen on 0.0.0.0 instead of 127.0.0.1.This is needed to to have the server available externally as well.
  2. Since your app.yaml is already configured, you don't need to customize your Dockerfile as Google App Engine requires. Keep it as your own custom one.Here's what I used:

    #Python's Alpine Base Image FROM python:3.6-alpine3.6 #Installing all python modules specified ADD requirements.txt requirements.txt RUN pip install -r requirements.txt #Copy App Contents ADD . /app WORKDIR /app #Start Flask Server CMD [ "python","Twilio_Routing.py"] #Expose server port EXPOSE 8080 
1

Considering the example shown in the GoogleCloudPlatform/python-runtime page, consider changing your CMD line from:

CMD exec gunicorn -b :$PORT main:app 

To:

CMD gunicorn -b :$PORT main:app 

I see exec used here only when the base image is the python one, not .

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like