Not able to deploy on app engine flexible environment with python-postgresql

4,779 views
Skip to first unread message

Ignacio Bonilla

unread,
Jun 29, 2017, 8:59:58 AM6/29/17
to Google App Engine

Hi all, 

for some reason (I know it's somehow my fault :) ), I am not able anymore (I did it several times in the last few days) to deploy on App Engine standard with the command gcloud app deploy. In particular see below the traceback I can get from the log. Any idea on what is causing this ?

Thanks,
Ignacio

Log detail:

DEBUG: (gcloud.app.deploy) Error Response: [9]
Application startup error:/bin/sh: 1: exec: gunicorn: not found
Traceback (most recent call last):
File "/google/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 804,
in Execute resources = args.calliope_command.Run(cli=self, args=args)
File "/google/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 871,
in Run resources = command_instance.Run(args)
File "/google/google-cloud-sdk/lib/surface/app/deploy.py",
 line 61, in Run args, runtime_builder_strategy=runtime_builder_strategy)
File "/google/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py",
line 425, in RunDeploy all_services, app.gcrDomain)
 File "/google/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py",
line 254, in Deploy endpoints_info)
File "/google/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py",
line 144, in DeployService operation)
File "/google/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py",
line 144, in WaitForOperation encoding.MessageToPyValue(completed_operation.error))) OperationError:
Error Response: [9]
Application startup error:/bin/sh: 1: exec: gunicorn: not found

ERROR:
(gcloud.app.deploy) Error Response: [9] Application startup error:/bin/sh: 1: exec: gunicorn: not found

George (Cloud Platform Support)

unread,
Jun 29, 2017, 1:32:09 PM6/29/17
to Google App Engine
Hello Ignacio, 

You might have been affected randomly by a temporary outage in the flex environment. 

It may be worthwhile checking in your system if gunicorn is there and its path correct. 

If you run gcloud components update and then gcloud info, what is the (edited) output from these commands? 

For more related information you may consider checking the "why gunicorn command not found with gunicorn installed?" question on stackoverflow. [1]

Ignacio Bonilla

unread,
Jun 29, 2017, 5:37:44 PM6/29/17
to Google App Engine
Thanks for the response, I have followed the steps aforementioned. Now my Sdk version is 161.0.0 and i have created the gunicorn file in /usr/bin but the deploy remains failing with the same error. For the app.yaml file generation and the databases settings i am following this guide https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/flexible/django_cloudsql/
Also, I want to include the content of these files in order to help to resolve this issue.

settings.py
DATABASES = {
    'default': {
        # If you are using Cloud SQL for MySQL rather than PostgreSQL, set
        # 'ENGINE': 'django.db.backends.mysql' instead of the following.
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': '<db_name>',
        'USER': '<db_user>',
        'PASSWORD': '<db_pass>',
    }
}
# In the flexible environment, you connect to CloudSQL using a unix socket.
# Locally, you can use the CloudSQL proxy to proxy a localhost connection
# to the instance
DATABASES['default']['HOST'] = '/cloudsql/<instance_name>'
if os.getenv('GAE_INSTANCE'):
    pass
else:
    DATABASES['default']['HOST'] = '127.0.0.1'
# [END dbconfig]

app.yaml
# [START runtime]
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT wsgi:application # my wsgi.py file is in the same path than manage.py

beta_settings:
    cloud_sql_instances: curriculum-ibonilla:us-central1:curriculum-ibonilla

runtime_config:
  python_version: 3
# [END runtime]

requirements.txt
Django==1.11.2
wheel==0.29.0
gunicorn==19.7.1
psycopg2==2.7.1

George (Cloud Platform Support)

unread,
Jul 3, 2017, 3:26:36 PM7/3/17
to Google App Engine
Hi Ignacio, 

It may be worthwhile checking the installation page for gunicorn, install it as advised on that page, and then check if it is in your path. What happens if you run the "gunicorn" command? 

Bruce Zhang

unread,
Dec 15, 2017, 12:51:26 PM12/15/17
to Google App Engine

Hello, I have the same problem with sdk version 183 and gunicorn version 19.7.1, any idea about this?  Thanks.
Reply all
Reply to author
Forward
0 new messages