【问题标题】:Deploying Django channels app on google flex engine在 google flex 引擎上部署 Django 频道应用程序
【发布时间】:2020-04-26 23:19:23
【问题描述】:

我正在研究 django 频道,在 google flex 引擎上部署它们时遇到问题,首先我收到“部署未能在分配的时间内变得健康”的错误,并通过在 app.yaml 中添加 readiness_check 来解决它,现在我收到以下错误:

(gcloud.app.deploy) 操作 [apps/socketapp-263709/operations/65c25731-1e5a-4aa1-83e1-34955ec48c98] 超时。此操作可能仍在进行中。

App.yaml

runtime: python
env: flex
runtime_config:
  python_version: 3
instance_class: F4_HIGHMEM

handlers:
# This configures Google App Engine to serve the files in the app's
# static directory.
- url: /static
  static_dir: static/
- url: /.*
  script: auto
# [END django_app]

readiness_check:
  check_interval_sec: 120
  timeout_sec: 40
  failure_threshold: 5
  success_threshold: 5
  app_start_timeout_sec: 1500

我该如何解决这个问题,有什么建议吗?

【问题讨论】:

    标签: google-cloud-platform django-channels app.yaml google-flexible


    【解决方案1】:

    以下错误是由几个问题引起的:

    1) 您没有正确配置 app.yaml 文件。 App Engine Flexible 中的资源请求不是通过 instance_class 选项,要请求资源,您必须使用resources option,如下所示:

    resources:
      cpu: 2
      memory_gb: 2.3
      disk_size_gb: 10
      volumes:
       - name: ramdisk1
         volume_type: tmpfs
         size_gb: 0.5
    

    2) 您缺少应用的入口点。要部署Django channels,他们建议为 Daphne 服务器设置一个入口点。在您的 app.yaml 中添加以下代码:

    entrypoint: daphne -b 0.0.0.0 -p 8080 mysite.asgi:application
    

    3) 执行上述操作后,如果仍然出现同样的错误,则可能是您的 App Engine Flexible 应用所在区域的 In-use IP 地址配额已达到上限。 要检查此问题,您可以转到项目主页的“活动”选项卡。他们,您可以看到配额限制和虚拟机创建失败的警告。

    默认情况下,App Engine 会保留以前版本的应用,并且运行可能需要 IP 地址。您可以删除以前的版本和/或请求增加您的 IP 地址配额限制。

    同时更新 gcloud 工具和 SDK,可能会解决该问题。

    要检查您正在使用的地址click here,您将能够通过点击 Cloud Console 中的“编辑配额”按钮来增加配额。

    【讨论】:

      猜你喜欢
      • 2011-12-05
      • 1970-01-01
      • 2018-05-25
      • 2020-11-21
      • 1970-01-01
      • 1970-01-01
      • 2020-11-18
      • 2019-11-06
      • 1970-01-01
      相关资源
      最近更新 更多