1

We wanted to make a quick change to a running GAE application to enable logging of queries to trace a bug.

SSH'ing into a running instance it can be hard to find where the app code is stored due to the use of docker.

While these instructions allow you to start a shell in the container instance, vim or similar isn't available in the container, so it's not possible to modify the code.

Below is how we figured out where to find the app.

ChrisJ
  • 295
  • 1
  • 10

1 Answers1

1

In GAE console, go to the side menu and choose App Engine -> Instances

If you're not trying to connect to your default app, change the drop down on the top left.

Then click on the SSH button.

Docker images are stored in /var/lib/docker/overlay2 but there's a lot of them.

To find the one that contains your app, choose a file name that is unique to your project, for example we chose messageProcessor.js then search all the images for it.

(The SSH user doesn't have permission, so you'll need to sudo to run find on that folder)

sudo find /var/lib/docker/overlay2 -name messageProcessor.js

Hopefully you get just one result, something like this:

/var/lib/docker/overlay2/14b22c856283a3231a55c79f54d298acb9750fc886037533ef830acf55a10116/merged/app/jobs/messageProcessor.js

Now you know where to find your app, you can edit a file:

sudo vi /var/lib/docker/overlay2/14b22c856283a3231a55c79f54d298acb9750fc886037533ef830acf55a10116/merged/app/some/file/in/my/app.js

Then restart your app for the change to take effect

# ps -ef | grep node
root     11152 11151  0 Sep13 ?        00:00:00 node /app/index.js
# sudo kill <the pid of your process>
ChrisJ
  • 295
  • 1
  • 10