Skip to content

Instantly share code, notes, and snippets.

@akndmr
Last active December 1, 2018 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akndmr/7ae416bc7488ecde565ca9754fa37a85 to your computer and use it in GitHub Desktop.
Save akndmr/7ae416bc7488ecde565ca9754fa37a85 to your computer and use it in GitHub Desktop.

Setting up local GCE Server

Reference links:

https://cloud.google.com/sdk/docs/quickstarts

https://cloud.google.com/endpoints/docs/frameworks/java/migrating-android#cloudsdk

 

 

  1. Download the Cloud SDK depending on your operating system from this link - https://cloud.google.com/sdk/docs/quickstarts

 

  1. Save google-cloud-sdk folder downloaded from the above link to a directory of your choice.

 

  1. Open Terminal and navigate to the directory that contains google-cloud-sdk

 

  1. At command prompt, run the folllowing: $ gcloud init.

This will launch a web browser, and prompt to login to Google console.

 

Note: If you do not want to launch a web browser, use this command - $ gcloud init --console-only.

For more info on how to progress with this option, check out this page - https://cloud.google.com/sdk/docs/quickstart-macos

 

  1. If you have used $ gcloud init command, then it will display the following:

To continue, you must log in. Would you like to log in (Y/n)?

Enter Y to continue.

 

  1. Log in to Google account using the browser; it will prompt to grant permissions to access Google Cloud Platform resources.

Click Allow.

 

  1. Once logged in, return to the Terminal. It will now show a list of projects to select from or create a new project.

Pick cloud project to use:

 [1] linear-elf-192315

 [2] pacific-aurora-192315

 [3] squawker-73bc4

 [4] Create a new project

Please enter numeric choice or text value (must exactly match list item):

 

Enter 4 here (the number can be different; basically choose option to create a new project).

 

  1. It will now prompt to enter a Project ID. Choose an ID that is
    • of length 6 to 30
    • contains lowercase letters, digits and hyphens only
    • starts with a lowercase letter.

 

Example – jokeapp-udacity-project4. (it does not have to be same name as app or package)

 

  1. It will now set up the project using the ID provided. The Google console opened in the browser should show the new project.

 

  1. Return to Terminal, and run the following command - $ gcloud auth application-default login. This tells Cloud SDK to use application default credentials. Once this command is run, it will show the Json file name that has the credentials saved.

 

  1. Now it's time to install the app-engine-java

Return to Terminal and run this command - $ gcloud components install app-engine-java.
It may prompt once to continue, enter Y to allow it continue with the installation.

 

  1. If the installation is successful, open the project that will use GCE server Android Studio, and expand the Gradle tab.

From there, select :backend > app engine standard environment > appengineStart.

This should start the Google App Engine.

Open this link in your browser - http://localhost:8080/

 

If all has gone OK, so far then this link should have a display like this:

 

 

  1. To stop the engine, select :backend > app engine standard environment > appengineStop.

 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment