Publishing Sample Application At Google Cloud Platform

Introduction

This document describes the installation of the Google App Engine Software Development Kit (SDK) on a Microsoft Windows 10 PC and how to deploy a simple “soundexcal” application. The App Engine SDK allows you to run and deploy the application and host a static website on Google App Engine through your local computer. Anyone can create their own project with preferred languages and publish it free of cost through the Google cloud platform.

Registration in Google Cloud Platform Project

Step 1

First, go to this link https://console.cloud.google.com for initial registration for the application. Before this, make sure you have a google mail account. To register in the Google cloud I am using XXXXXX@gmal.com account.


Figure 1:Google Cloud Platform Creating App

Project Name: soundexcal

Project ID: soundexcal

During the registration process, we need to give the bling information of the user,and they need to pay a minimum of 1 Rs.

Download and Install Google Cloud SDK

The Cloud SDK is a set of tools for Cloud Platform. It contains gcloud, gsutil, and bq command-line tools, which you can use to access Google Compute Engine, Google Cloud Storage, Google BigQuery, and other products and services from the command line. You can run these tools interactively or in your automated scripts.

Create a sample application that we will deploy into Google Clouds.

  1. Create a local folder name “soundexcal”.
  2. Add “app.yaml” file.
  3. Add “www” folder.
  4. Under www folder and add my project work.

 
Figure 3 : Project Structure


Figure 4: app.yaml File

Project Development

This project is related to Soundex, one of several phonetic algorithms.

Here I created one HTML file ‘index.html’, added one js folder, and added a related JavaScript file. Write Soundex also in JavaScript in js file and add the reference of that js file in index.html. After that I added some basic HTML to calculate the output from input.


Figure 5: Project Html

In the soundex.js file,

var calculate = function () {
    var name=document.getElementById("txtName").value;

    var ret=soundex(name);
    document.getElementById("output").innerHTML=ret;
}
var soundex = function (s) {
    var a = s.toLowerCase().split(''),
        f = a.shift(),
        r = '',
        codes = {
            a: '', e: '', i: '', o: '', u: '',
            b: 1, f: 1, p: 1, v: 1,
            c: 2, g: 2, j: 2, k: 2, q: 2, s: 2, x: 2, z: 2,
            d: 3, t: 3,
            l: 4,
            m: 5, n: 5,
            r: 6
        };

    r = f +
        a
        .map(function (v, i, a) { return codes[v] })
        .filter(function (v, i, a) {
            return ((i === 0) ? v !== codes[f] : v !== a[i - 1]);
        })
        .join('');

    return (r + '000').slice(0, 4).toUpperCase();
};

Deploy the Application with Google Cloud SDK

Just ensure that the internet is connected before publishing.

Step 1

Open the Google Cloud SDK from the local PC under the Programs.

Then use this Command - gcloud init


Figure 6: Init

Step 2

Then select the link account which is XXXX@gmail.com for mine.

Step 3

Then select the project which was previously created in Google Cloud console.

Step 4

Then use the gcloud app to deploy --project soundexcal command to deploy the application.

Step 5

The project was successfully published at the following link,

[https://soundexcal.appspot.com]


Figure 7: soundexcal.appspot.com

It creates a dashboard where we can see the report as needed,


Figure 8: dashboard