Google App Engine CLI - list project directory - google-app-engine

Is there a way to print the contents of my project directory using the google app engine cloud shell?
In my local terminal that would look like typing 'ls'
What command would I use in the shell?

The cloud shell is fundamentally just a shell running on a generic virtual machine in the cloud.
That machine does NOT have any special attributes (compared to your local machine) except maybe that it comes with some tools (like the google cloud SDK) already installed. It has no implicit knowledge about or access to your cloud products/projects themselves.
So, by default, the cloud shell doesn't know which/where your GAE project is. You'd have to pull a copy of your project repository/code on that instance and, when in that project's directory, you could list the project's content using ls, just like on your local machine. See also the somehow related Google Cloud: How to deploy mirrored Repository
The machine on which the cloud shell runs is also unrelated to the instances on which GAE apps are running, so you can't directly list on it the directory content of the actually deployed GAE project. If that's what you're after see Where are appengine projects located normally in the file system of the server via ssh?

Related

Why does writing to GCS bucket result in local dev blob store entries instead?

I use the Google App Engine Standard environment to develop my Python app using Development SDK 1.9.61.
I'm trying to learn to use Google Cloud Storage in my app by following these instructions. I verified that my default and staging buckets do exist via the cloud console, and manually uploaded a sample file to each bucket using my browser.
Next, I programmatically uploaded some files to a bucket (so I thought) via my local development app instance per Google's instructions.
However, when I checked my cloud storage buckets via my GCP Console in my browser, I could not find the files. After searching my local development SDK console, I eventually found the files located in the local "Blobstore Viewer".
I'm confused, based on Google's instructions I expected to find the files in my project's cloud storage bucket.
I searched the App Engine Python Release Notes for some potential SDK version changes to explain this behavior, but couldn't find anything relevant.
Is this the way it's supposed to work? Are Google's instructions in error?
If you upload files to a local development server, those exist in-memory on your machine. The GCP Console doesn't interact with your local development server, it interacts with the public (production) Google Cloud Storage API.
So in essence, the files on your local dev server are in a completely different namespace. If you want to interact with the production version of Google Cloud Storage and see the results in the GCP console, you'll need to use a non-dev-server deployment of your application.

Google Cloud Shell unable to display files present in Google Storage

Image1 available clearly shows that the bucket contains a folder namely cloudml-samples-master and a file namely setup.py
However on entering the command ls in Google Cloud Shell, it is giving no output. I am stuck at this problem and I have tried almost everything but I am unable to find the reason behind this.
Also when I am trying to access these files through my API, I get an error displaying that these files could not be found.
Both the files present in the directory were uploaded using WebUI.
To add my opinion, what I understood till now is that the files being uploaded using WebUI and those uploaded using command line are acting independently. Because I have seen that the files which I am uploading using command line are not showing in UI. Is there some error from my side or is it an issue related with Cloud Google Storage?
As you can see below from https://cloud.google.com/shell/docs/features, Google Cloud Shell is not connected directly with Google Cloud Storage. It gives you possibility to connect with that storage eg. via gsutil
When you start Cloud Shell, it provisions a g1-small Google Compute
Engine virtual machine running a Debian-based Linux operating system.
Cloud Shell instances are provisioned on a per-user, per-session
basis.
Also:
Cloud Shell provides the following:
A temporary Compute Engine virtual machine instance Command-line
access to the instance from a web browser Built-in code editor BETA
5 GB of persistent disk storage Pre-installed Google Cloud SDK and other tools Language support for Java, Go, Python, Node.js, PHP, Ruby
and .NET Web preview functionality Built-in authorization for access
to GCP Console projects and resources

Deploy small change to google app engine

I want to deploy a change in my app.yaml file to google app engine. Is there a simple way to do this without redeploying the whole app? Is there a way of changing the app.yaml file on the google cloud directly? Or just deploying one file from my Windows directory?
My app is working fine in the virtual environment but I'm having some issues on the google cloud platform. The whole deploying process takes quite a while so I'm looking for a faster way to make a change and test it.
You can use appcfg.py update app.yaml from AppEngine Python SDK:
https://cloud.google.com/appengine/docs/standard/python/tools/appcfg-arguments#update
Use the files argument to upload one or more YAML files that define
modules. No other types of YAML files can appear in the command line.
Only the specified modules will be updated.
You can try using gcloud app deploy inside the directory where your application is located in order to upload the file you need.
Specifying no files with the command deploys only the app.yaml file of a given service.
This command will only upload to the cloud the files where there are changes, so if you have only modified the app.yaml file, it should not take too much time for the upload. However, as that is the configuration file of your application, it might need to be re-deployed completely, as the changes made in that file might affect the behaviour of the whole app. That is the reason why it might be taking longer than expected.
On the other side, you may want to know that if you are using App Engine Flexible environment, the deployment will always be slower than in a Standard environment, as resources have to be deployed before launching the application itself.

Using Google app Engine for the first time to create a Guestbook using Python

I'm having a frustrating issue with using google app engine for the first time. I'm trying to follow the beginner's tutorial offered on google page to create a Guestbook application using python on google cloud.
this is the link for the tutorial Creating a Guestbook Application
And this what I get after running this line dev_appserver.py ./ in the Git Shell:
Go back to the directions for the guestbook and make sure you completed step #2 properly. It looks like you have not properly installed the App Engine SDK.
Also, after installation, you need to make sure that the App Engine SDK is in your system PATH. To do this:
Right click on My Computer
Click on Advanced System Settings on the left
Under the "Advanced" tab, click on Environment Variables
Edit the "PATH" environment variable
Make sure the Google SDK directory is listed there (it should probably be set to C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin, but it may differ depending on your installation).

Where are Node apps deployed using gcloud SDK?

I've deployed a Node app to Google Cloud. It works beautifully.
However, where is the app running? Where in the directory structure of my instance is it stored?
I'd also like to identify where stdout is on that process. The logging solution in the GAE console is powerful but excessive for some of the simple debugging tasks I have.
Your application runs inside a Docker container and hosted on one or more instances that AppEngine provisioned for you when you deployed your application. AppEngine is managed runtime environment and thus you are not supposed to access the instance/container directly. The internal directory structure is exactly the same as you've built it during the development process.
The stdout is redirected to Google Cloud Logging. You can filter the log by severity (debug, errors, everything etc..) to reduce the amount of data you need to read.

Resources