This blog presents tips and techniques on how to set up environment for deploying Java web app on Google AppEngine using GCloud SDK. Same environment can as well be used for deploying Spring boot web app. Following steps are described later:
- Install Google Cloud SDK
- Install Cloud SDK Appengine Java component
- Create Appengine project in Google Cloud Console
- Authorize GCloud
- Configure Appengine project using GCloud
Install Google Cloud SDK
Download and install Google Cloud SDK. The instructions for downloading and installing Google Cloud SDK can be found on Installing Cloud SDK page. Unzip or Untar the downloaded file and go to the google-cloud-sdk folder. Execute install.sh or install.bat appropriately from google cloud sdk folder based on the OS version for setting up Google Cloud SDK. Once done with installation, initialize GCloud SDK by executing the following command from google-cloud-sdk/bin folder.
Install Cloud SDK Appengine Java Component
Execute following command to install cloud SDK app engine java component
gcloud components install app-engine-java
Create Appengine project in Google Cloud Console
Login to Google Cloud Console. Create new Appengine project as shown in the screenshot given below.
Above represents the Google cloud console dashboard. Menu lists down the already existing projects you may have created. In above diagram, the project such as Tutosphere is displayed. Click on three dots on Menu. This would open up another window listing down all the projects and a + button to add new project as shown in the screemshot show below:
Click on + (plus) button to add new project. Another dialog box will open up as shown in the diagran given below. Give a project name and create the project.
Authorize GCloud to access Google Cloud Platform
Executing following command would take you to the google website and ask you to authorize with one of the accounts. Choose account using which you access the Google Cloud Console.
gcloud auth login
Configure Appengine project
Login to Google Cloud Console, select appengine project and get the appengine project id (Project ID). The following screenshot represents project id, perfect-ray-167007.
Execute following command with the copied project id and set the project. Command such as gcloud config set is used to set Cloud SDK property. In the command given below, Cloud SDK project property is set.
gcloud config set project APPENGINE_PROJECT_ID
Once done with above, you are all set to deploy your Java web app on Google Appengine. In an upcoming article, you will learn about how to deploy Spring boot web app on Google Appengine.