在生产环境中访问Google App Engine Python App代码 [英] Accessing Google App Engine Python App code in production

查看:132
本文介绍了在生产环境中访问Google App Engine Python App代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(背景:我是Google App Engine的新手,熟悉其他云提供商的服务)



我正在寻找类似于shell访问权限的访问/查看节点。



使用基于Python / Django的Google App Engine应用程序,我想查看生产中的代码。

我能找到的一个视图是StackDriver'调试'视图。
然而,显然调试视图中显示的代码并不反映更新后的生产代码(根据生产站点显示的内容,例如主页上的文本不同)。 b
$ b

Google App Engine是否允许我将ssh放入运行应用程序/代码的虚拟机中?
如果没有,如何检查生产中运行的代码?

谢谢。

解决方案

根据 SSH调试行-appengine-environments#比较环境rel =nofollow noreferrer>比较环境表适用于Flex环境应用程序的SSH访问,但不适用于标准环境应用程序。



连接到实例


如果虚拟机实例处于调试模式,您可以在控制台中使用SSH连接到其主机
,或使用 gcloud



连接到控制台中的实例:


  1. 访问您项目的Cloud Platform Console实例页面:
    进入实例页面


  2. 点击包含要访问的实例的行最右侧的 SSH



    这会将实例置于调试模式,并打开您可以从下拉列表中选择不同的选项来启动SSH会话。

  3. >
  4. 此时,您位于实例主机中,该主机有几个容器在其中运行。请参阅了解常见的
    容器
    下一步获得更多关于这些信息的信息。


  5. 在终端窗口中,列出在实例中运行的容器:

      sudo docker ps 


  6. sudo docker ps 命令按行列出每个容器;找到包含项目ID的行:这是运行代码的
    容器。注意这个容器的名称。


  7. 可选地,通过调用:列出应用程序的日志记录信息。 p $ p $ sudo docker logs [CONTAINER-NAME]


  8. 在运行代码的容器中启动一个shell:

      container_exec [CONTAINER-NAME] / bin / bash 


  9. 完成调试后,输入exit退出容器,然后再次退出以退出SSH会话。


  10. 禁用您的实例的调试以允许其恢复正常操作。 / blockquote>

    (Background: I am new to Google App Engine, familiar with other cloud providers' services)

    I am looking for access/view similar to shell access to production node.

    With a Python/Django based Google App Engine App, I would like to view the code in production.

    One view I could find is the StackDriver 'Debug' view. However, apparently the code shown in the Debug view doesn't reflect the updated production code (based on what is showing on the production site, for example, the text on the home page different).

    Does Google App Engine allow me to ssh into the VM where the application/code is running? If not, how can check the code that's running in production?

    Thanks.

    解决方案

    According to the SSH debugging row in the Comparing environments table SSH access is supported for flex environment apps but not for standard environment apps.

    From Connecting to the instance:

    If a VM instance is in debug mode, you can connect to its host by using SSH in the console or with gcloud.

    To connect to an instance in the console:

    1. Visit the Cloud Platform Console instances page for your project: Go to the instances page

    2. Click SSH in the far right of the row containing the instance you want to access:

      This puts the instance into debug mode, and opens an SSH session for the instance in a terminal window.

      You can also select different options to start an SSH session from the drop-down list.

    3. At this point you are in the instance host, which has several containers running in it. See Understanding common containers next for more information about these.

    4. In the terminal window, list the containers running in the instance:

      sudo docker ps
      

    5. The output of the sudo docker ps command lists each container by row; locate the row that contains your project ID: this is the container running your code. Note the NAME of this container.

    6. Optionally, list logging information for your application by invoking:

      sudo docker logs [CONTAINER-NAME]
      

    7. Start a shell in the container that is running your code:

      container_exec [CONTAINER-NAME] /bin/bash
      

    8. When finished debugging, enter exit to exit the container, then exit again to exit the SSH session.

    9. Disable debugging for your instance to allow it to resume normal operation.

    这篇关于在生产环境中访问Google App Engine Python App代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆