健康检查在GAE自定义运行时失败

时间:2017-09-09 16:04:17

标签: google-app-engine google-cloud-platform

我们正在关注this documentation使用自定义运行时启动我们的django应用。由于这需要我们的应用程序处理运行状况检查,我们将这行代码添加到urls.py:

url(r"/_ah/health", lambda r: HttpResponse()),

唉,我们仍然从健康检查中得到502错误。我们在这里做错了什么?

修改

我包含了一些部署文件/命令

部署命令
gcloud app deploy dispatch.yaml app_staging.yml

Dockerfile

FROM gcr.io/google-appengine/python

# Use python 3 version of GAE base image
LABEL python_version python3.5
RUN virtualenv --no-download /env -p python3.5
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH

# Install all dependencies in requirements.txt
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

# Add the application source code.
ADD . /app

# Run staging migrations then tests. Then run the gunicorn server
WORKDIR /app
EXPOSE 8080
CMD python manage.py migrate --settings app.settings.staging && \ 
    gunicorn -b :8080 app.wsgi

app_staging.yml

runtime: custom
env: flex
entrypoint: gunicorn -b :$8080 app.wsgi

beta_settings:
    cloud_sql_instances: <CONNECTION>

runtime_config:
  python_version: 3

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 1

resources:
  cpu: 1
  memory_gb: 0.90
  disk_size_gb: 10

liveness_check:
  path: '/_ah/health'
  timeout_sec: 4
  check_interval_sec: 30
  failure_threshold: 4
  success_threshold: 2
  initial_delay_sec: 3600

readiness_check:
  path: '/_ah/health'
  timeout_sec: 4
  check_interval_sec: 5
  failure_threshold: 2
  success_threshold: 2
  app_start_timeout_sec: 3600

env_variables:
  PROJECT_VARIABLES

dispatch.yaml

dispatch:
- url: "staging.app.io/*"
  service: frontend

- url: "staging-backend.app.io/*"
  service: default

0 个答案:

没有答案