Deploying an App Engine Application

Hands-On Lab

 

Photo of Joseph Lowery

Joseph Lowery

Google Cloud Training Architect II in Content

Length

00:30:00

Difficulty

Beginner

Google Cloud App Engine provides a solid, easy-to-access platform for a wide range of web apps. Its interoperability with other Google Cloud services, such as Cloud Datastore, enhances its effectiveness. In this hands-on lab, we’ll deploy an app to App Engine that allows users to enter details into a NoSQL database, Cloud Datastore, and displays the proper HTML template and CSS. The process requires that we customize the config.py file before deploying the app.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Deploying an App Engine Application

Introduction

In this hands-on lab, we’ll deploy an app to App Engine that allows users to enter details into a NoSQL database, Cloud Datastore, and displays the proper HTML template and CSS. The process requires that we customize the config.py file before deploying the app.

How to Log in to Google Lab Accounts

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Deploying an App Engine Application

Now, on to the lab!

Enable APIs and clone GitHub repository.

  1. Navigate to APIs & Services > Library, and search for "Datastore".

  2. Select the Cloud Datastore API card.

  3. Click Enable.

  4. Head back to APIs & Services > Library.

  5. Search for "Storage".

  6. Select the Cloud Storage card.

  7. We should see it's already enabled. (If it isn't, click Enable.)

  8. Click the icon in the upper right navigation menu to Activate Cloud Shell.

  9. From the Cloud Shell, create the necessary bucket:

    gsutil mb -c regional -l us-east1 gs://<BUCKET NAME>
  10. In order to make the objects publicly viewable, we need to add a couple roles:

    gsutil iam ch allUsers:objectViewer gs://<BUCKET NAME>
  11. Clone the GitHub repo to bring in all the files we need:

    git clone https://github.com/linuxacademy/content-gc-essentials
  12. Change directory to the content-gc-essentials/app-engine-lab folder:

    cd content-gc-essentials/app-engine-lab

Configure config.py file.

  1. Click the pencil icon to launch the Cloud Shell Editor.
  2. From the Cloud Shell Editor, open config.py in the app-engine-lab folder.
  3. Change PROJECT_ID to the current project, as shown in the Cloud Shell.
  4. Change CLOUD_STORAGE_BUCKET to your bucket name.
  5. Click File > Save.

Deploy the app.

  1. In the Cloud Shell, enter the following code:

    gcloud app deploy
  2. When prompted, choose the nearest region.

Test the app.

  1. In the Cloud Shell, enter the following code:

    gcloud app browse
  2. If the browser window does not open, click the generated link.

Conclusion

Congratulations on completing this lab!