Trouble with service account's json stored in Google Secret Manager (Only when deployed)

58 Views Asked by At

I've got a problem that I just can't seem to work out. I am running a django project, deploying via GCP App Engine. I have taken all my sensitive key/token data from my settings file and placed them in my Google Secret Manager. That works fine, both locally and deployed. HOWEVER... When I try to do the same from my service account json, the project only runs locally. When I deploy, there is no error in deployment, but the site times out. The error log reads a bunch of:

"Process terminated because the request deadline was exceeded. Please ensure that your HTTP server is listening for requests on 0.0.0.0 and on the port defined by the PORT environment variable. (Error code 123)"

My app.yaml is configured as:

runtime: python39

instance_class: F2

entrypoint: gunicorn -b :$PORT gondolaProject.wsgi:application

automatic_scaling:
 target_cpu_utilization: 0.65

env_variables:
 DJANGO_SETTINGS_MODULE: "gondolaProject.settings"
 CLOUD_SQL_CONNECTION_NAME: "placeholder-401815:us-central1:to-be-announced"

beta_settings:
 cloud_sql_instances: "placeholder-401815:us-central1:to-be-announced"

Any ideas what might be causing this behavior??? Thanks in advance :)

1

There are 1 best solutions below

0
Chanpols On

Posting this as a community for the benefits of others.


As mentioned by @guillaume blaquiere:

On Google Cloud (and even on your local computer and many other cloud vendor) you do not need a service account key file. Use ADC, and the App Engine service account (default one or you can override it), and it will work fine. And solve your issue in the same time. And increase your security posture as bonus!