Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit the NGINX configuration on Google App Engine flexible environment?

How can I edit the Google App Engine NGINX configuration?

There doesn't seem to be much support in the Google docs in regards to the NGINX configuration for apps running in the Google App Engine flexible environment.

My app is running fine, but I get this 413 error when I try and upload an audio file (.wav or .mp3).

413 Request Entity Too Large -- nginx

My app is running Django (python 3), with Cloud Postgres SQL and Cloud Storage enabled.

I researched the error, and it seems I can set a nginx.config file so that it includes "client_max_body_size 80M" - but like I said, there is no documentation regarding how to manually config NGINX on deploy.

Any suggestions?

like image 408
scottc11 Avatar asked Oct 31 '17 15:10

scottc11


People also ask

Which option is correct for the flexible environment of App Engine is ---?

"That's correct! App Engine offers NoSQL databases, in-memory caching, load balancing, health checks, logging, and user authentication to applications running in it." 1. Which of these criteria would make you choose App Engine Flexible Environment, rather than Standard Environment, for your application?

What is an advantage of using a flexible environment with App Engine?

Customizable infrastructure - App Engine flexible environment instances are Compute Engine virtual machines, which means that you can take advantage of custom libraries, use SSH for debugging, and deploy your own Docker containers. Performance options - Take advantage of a wide array of CPU and memory configurations.

What is Yaml file in GCP?

yaml file defines your configuration settings for your Python runtime as well as general app, network, and other resource settings.

How to set up Nginx for Google App Engine?

# The standard nginx container just runs nginx. The configuration file added # below will be used by nginx. # Copy the nginx configuration file. This sets up the behavior of nginx. Most # important, it ensures that nginx listens on port 8080. Google App Engine expects # the runtime to respond to HTTP requests at port 8080.

What is the nginx configuration file in Hello World?

The Hello World sample app also includes an nginx.conf file, which contains the basic nginx configuration information, as well was the index.html file, which serves as the root page for the nginx web server. Learn more about Dockerfiles at the Dockerfile reference.

What is an App Engine flexible environment instance?

Customizable infrastructure - App Engine flexible environment instances are Compute Engine virtual machines, which means that you can take advantage of custom libraries, use SSH for debugging, and deploy your own Docker containers. Performance options - Take advantage of a wide array of CPU and memory configurations.

How do I set up Nginx in Docker?

Create an nginx-hosting folder and copy the dist folder into it. Add a Dockerfile file in the nginx-hosting folder, and copy the following code into the file: # The standard nginx container just runs nginx. The configuration file added # below will be used by nginx. # Copy the nginx configuration file. This sets up the behavior of nginx. Most


2 Answers

You should be able to create a nginx-app.conf file in the same directory as your app.yaml file. There is an example of using the nginx configuration file in a Flex environment located here: https://github.com/GoogleCloudPlatform/getting-started-php/tree/master/4-auth .

This same file is referenced in Google's documentation here: https://cloud.google.com/appengine/docs/flexible/php/runtime#customizing_nginx

Once you have that file created, you should be able to add any property you need and then rebuild your project to see the changes take effect.

like image 110
dwelling Avatar answered Sep 22 '22 15:09

dwelling


So upon contacting Google Support, the suggested solution for uploading files larger than 32MB is as follows:

"The way to circumvent App Engine's 32MB limit is to send the requests directly to Cloud Storage, for instance using the resumable upload process. You can still use App Engine to serve your app, but the clientside portion of the app would be the one handling the upload to Google Cloud Storage. For this you would have your application generate a signed URL which the client can use to gain access to your Cloud Storage bucket for the purpose of uploading an image."

I went with this solution. It saves money in the end.

like image 29
scottc11 Avatar answered Sep 22 '22 15:09

scottc11