Installing the Google Cloud SDK

If you've ever deployed a website before you probably did something like ssh into the remote machine to copy its files over a secure connection, or maybe used an FTP app like FileZilla. That's not how it works on Google App Engine (GAE) .

As you probably remember, Google App Engine is a managed environment, which restricts what kind of files you can use and the implementation details about where they go. Uploading a set of files, for example, web2py itself or your web2py application, happens through an intermediary: utilities provided by the Google App Engine SDK.

Prerequisites

  • First, make sure you have some version of python 2.7 running on your machine. At the time of writing, Python version 3 isnot supported) even though it's been out for the better part of a decade.
$ python -V
Python 2.7.10

Installing Google Cloud SDK manually on OSX

::: TODO: VERIFY /// :::

Some App Engine features are (apparently) available only when manually installing the Google App Engine SDK from source. Here's how to do it.

  • You can install it to any directory, but first note where it is. For example, ~/Downloads

  • Unzip the file. For example, if the filename is google-cloud-sdk-199.0.0-darwin-x86_64.tar.gz then you'd do something like this:

$ gunzip -c google-cloud-sdk-199.0.0-darwin-x86_64.tar.gz | tar xopf -

This creates the directory google-cloud-sdk.

  • Now run the included shell script to update your environment:
$ ./google-cloud-sdk/install.sh

TODO: SHRINK THIS SECTION

This output results:


To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  y


Your current Cloud SDK version is: 199.0.0
The latest available version is: 199.0.0

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                  Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│     Status    │                         Name                         │            ID            │    Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions                             │ app-engine-go            │ 151.3 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.6 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │   3.8 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.9 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed │ Google Container Local Builder                       │ container-builder-local  │   4.3 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   2.5 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 118.9 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  12.2 MiB │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │   7.8 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.4 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [199.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [199.0.0], run:
  $ gcloud components update


Modify profile to update your $PATH and enable shell command 
completion?

Do you want to continue (Y/n)?  y

The Google Cloud SDK installer will now prompt you to update an rc 
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use 
[/Users/tom/.bash_profile]:  
Backing up [/Users/tom/.bash_profile] to [/Users/tom/.bash_profile.backup].
[/Users/tom/.bash_profile] has been updated.

==> Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

Note that you were instructed to start a new shell. That's because changes to the environment won't update until it restarts.

  • If you don't want to bother stopping and restarting your terminal, on most versions of bash you can simply run this command line:
# Restart the shell to get new environment settings.
$ exec -l $SHELL

Installing App Engine componens for Python

Download the App Engine Python extension:

$ gcloud components install app-engine-python

You may be asked a few questions. The output looks something like this:

Your current Cloud SDK version is: 199.0.0
Installing components from version: 199.0.0

┌──────────────────────────────────────────────────┐
│       These components will be installed.        │
├──────────────────────────────┬─────────┬─────────┤
│             Name             │ Version │   Size  │
├──────────────────────────────┼─────────┼─────────┤
│ gRPC python library          │   1.9.1 │ 7.6 MiB │
│ gRPC python library          │         │         │
│ gcloud app Python Extensions │  1.9.69 │ 6.1 MiB │
└──────────────────────────────┴─────────┴─────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud app Python Extensions                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                   

Update done!

Always follow the release notes

Before continuing, read the release notes

In the previous section release notes were referred to. Read them. At the time of writing you can find them at https://cloud.google.com/sdk/release_notes

TODO: Note changes regarding app.yaml

OLD I THINK

Confirming the installation works

You should now have utilities such as appcfg.py on your path. Let's make sure that's the case.

Confirming appcfg.py is on your path: OSX/Linux version

  • To confirm that the App Engine SDK was installed properly, use the which utility against appcfg.py:
$ which appcfg.py

Its location should be displayed:

/usr/local/bin/google_appengine//appcfg.py

results matching ""

    No results matching ""