I'm trying to host my laravel application in GCP cloud run and everything works just fine but for some reason whenever I run a POST
request with lots of data (100+ rows of data - 64Mb) saving to the database, it always throw an error. I'm using nginx with docker by the way. Please see the details below.
ERROR
Cloud Run Logs
The request has been terminated because it has reached the maximum request timeout.
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
sendfile on;
keepalive_timeout 65;
server {
listen LISTEN_PORT default_server;
server_name _;
root /app/public;
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /dev/stdout;
error_log /dev/stderr;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#include /etc/nginx/sites-enabled/*;
}
daemon off;
Dockerfile
FROM php:8.0-fpm-alpine
RUN apk add --no-cache nginx wget
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN mkdir -p /run/nginx
COPY docker/nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /app
COPY . /app
RUN sh -c "wget http://getcomposer.org/composer.phar && chmod a+x composer.phar && mv composer.phar /usr/local/bin/composer"
RUN cd /app && \
/usr/local/bin/composer install --no-dev
RUN chown -R www-data: /app
CMD sh /app/docker/startup.sh
Laravel version:
v9
Please let me know if you need some data that is not indicated yet on my post.