Accessing Google App Engine Python App code in production

后端 未结 2 857
梦如初夏
梦如初夏 2021-01-21 09:35

(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.

相关标签:
2条回答
  • 2021-01-21 10:13

    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.

    0 讨论(0)
  • 2021-01-21 10:25

    If you are using the standard environment, the answer is no, you can't really inspect or see the code directly. You've mentioned looking at it via Stackdriver Debugger, which is one way to see a representation of it.

    It sounds like if you have a reason to be looking at the code, then someone in your organization should grant you the appropriate level of access to your source code management system. I'd imagine if you're deployment practices are mature, then they'd likely branch the code to map to your deployed versions and you could inspect in detail locally.

    0 讨论(0)
提交回复
热议问题