【发布时间】:2020-10-09 18:03:20
【问题描述】:
我正在尝试将我的应用程序部署到灵活的环境中。 Docker 映像构建良好,但当我认为它试图使服务上线时,该过程失败。我的构建超时设置为 1200 值得。
如何进一步询问此错误?我正在努力寻找日志/GCP 系统中的哪个位置,我可以准确找出卡住的进程。这似乎是一个完全不透明的错误,没有任何迹象表明到底出了什么问题。是不是应用程序中有一些错误(在本地运行良好)?如果是这样,我希望它仍在部署中,但只是在我访问该网站时显示错误。
非常感谢任何帮助。
错误:
OperationError: Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section.
ERROR: (gcloud.app.deploy) Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section.
这是我的 Dockerfile:
FROM gcr.io/google-appengine/python
RUN apt-get update && apt-get install software-properties-common -y
RUN add-apt-repository ppa:ubuntugis/ppa
RUN apt-get install -y gdal-bin
# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
# Use -p python3 or -p python3.7 to select python version. Default is version 2.
RUN virtualenv /env -p python3.7
# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv
COPY requirements.txt /tmp
WORKDIR /tmp
RUN pip install -r requirements.txt
# Add the application source code.
ADD . /
EXPOSE 8080
# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
#CMD gunicorn -b :$PORT main:app
这是我的 app.yaml:
runtime: custom
env: flex
runtime_config:
# You can also specify 2 for Python 2.7
python_version: 3.7
【问题讨论】:
-
您是否尝试增加 app_start_timeout_sec 的值? (最大值为 1800)。这将为您的应用程序启动和准备就绪提供更广泛的时间窗口。详情请参考documentation。
-
是的 - 不幸的是,它仍然失败了。不过谢谢。
-
你评论
entrypoint和CMD正常吗? -
好地方,但不幸的是没有什么不同:(
-
尝试在 app.yaml 中指定 healthchecks,并验证对 healthcheck 端点的调用是否给出了正确的响应(通常是 200):cloud.google.com/appengine/docs/flexible/python/reference/…
标签: docker google-app-engine google-cloud-platform geodjango