Accessing Google App Engine Python App code in pro

2019-03-01 00:10发布

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

2条回答
萌系小妹纸
2楼-- · 2019-03-01 00:25

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.

查看更多
一纸荒年 Trace。
3楼-- · 2019-03-01 00:44

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.

查看更多
登录 后发表回答