Cloud Run: todavía no se pudo iniciar después de la siguiente documentación

Tengo una instancia de ejecución en la nube a la que intento llamar.

En mi cliente de insomnio, recibo el siguiente mensaje de error: upstream connect error or disconnect/reset before headers. reset reason: connection termination

Entonces, naturalmente, miré los registros:

2022-01-15T12:45:14.129703772Zterminated: Application failed to start: not available
Default
2022-01-15T12:45:15.827887Z[2022-01-15 12:45:15 +0000] [1] [INFO] Handling signal: term
Default
2022-01-15T12:45:16.153302Z[2022-01-15 12:45:16 +0000] [9] [INFO] Worker exiting (pid: 9)
Default
2022-01-15T12:45:16.329549Z[2022-01-15 12:45:16 +0000] [1] [INFO] Shutting down: Master
Error
2022-01-15T12:45:17.155309ZPOST503746 B12 sinsomnia/2021.7.2 https://scrape-handler-xxxx-lz.a.run.app/start
Default
2022-01-15T12:45:17.172900Z 0%| | 0/4909 [00:00<?, ?it/s]

(lo que es raro, es que la última línea viene de la aplicación...)

2022-01-15T12:45:17.172900Z 0%| | 0/4909 [00:00<?, ?it/s]

for _ in tqdm.tqdm(pool.imap_unordered(makereq, [[_, start_date, end_date] for _ in res]), total=len(res)):
   pass

Veo un Application failed to starterror, que empiezo a investigar. Intenté solucionar el error siguiendo la documentación: docs

Python developers need to update Gunicorn's default timeout.

Entonces, naturalmente, hice eso, agregué la bandera -t 0, para mayor claridad, le mostraré todo mi dockerfile:

# Use the official Python image.
# https://hub.docker.com/_/python
FROM python:3.8-buster

# Install manually all the missing libraries
RUN apt-get update
RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

# Install Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install

# Install Python dependencies.
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .

# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
CMD exec gunicorn --bind :$PORT --workers 1 -t 0 --threads 8 main:app

Sin embargo; Todavía Application failed to startrecibo

Entonces comencé a "desbordar la pila" del problema, encontré los siguientes hilos:

Los seguí y mi transmisión HTTP está deshabilitada: La transmisión HTTP2 está deshabilitada

Mi gunicorn está escuchando en el mismo puerto que la instancia de docker de ejecución en la nube:

Escuchando en 808

2022-01-15T12:43:55.300122Z[2022-01-15 12:43:55 +0000] [1] [INFO] Starting gunicorn 20.1.0
Default
2022-01-15T12:43:55.300716Z[2022-01-15 12:43:55 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
Default
2022-01-15T12:43:55.300727Z[2022-01-15 12:43:55 +0000] [1] [INFO] Using worker: gthread
Default
2022-01-15T12:43:55.304602Z[2022-01-15 12:43:55 +0000] [9] [INFO] Booting worker with pid: 9

Solo en aras de la exhaustividad, aquí está mi completo deploy.sh:

echo "Stop developing pls"
source venv/bin/activate
rm requirements.txt
pip freeze > requirements.txt
docker build -t scrape-handler . --platform linux/amd64
gcloud builds submit --tag gcr.io/xxxxx/scrape-handler
gcloud beta run deploy scrape-handler --image gcr.io/xxxxx/scrape-handler --region europe-north1 --platform managed 
echo "Deployed"
Answer