Google-App Engine

Google App Engine (GAE) is a web framework and cloud computing platform used for developing and hosting web application in Google managed environment. GAE is fully managed platform that completely abstract away infrastructure so developer can focus on code.

Compared to other scalable hosting services such as Amazon EC2, App Engine provides more infrastructure which makes it easy to write scalable applications.

App Engine’s infrastructure removes many system administration and development challenges of building applications to scale as per hundreds of requests per second and beyond.

GAE Provide us two app engine environments:

  • Flexible Environment:
    • Flexible Environment means that your application will run on docker container on Google Compute Engine VM.
    • Generally good for applications that receive consistent traffic, experience regular traffic fluctuation, or meet the parameters (CPU, Memory utilization) for scaling up and down gradually.
    • Flexible environment fully support(Any version of) :
      • Python
      • Java
      • Node.js
      • Go
      • Ruby
      • PHP
      • .NET
    • We can add support for any language by spinning container which support custom language
    • Flexible environment also manage your VM, ensuring that:
      • Instance health check and reporting
      • Critical, backwards compatible updates are automatically applied to the underlying operating system
      • GAE automatically located by geographical region according to the settings in your project, it also ensure all of project’s VM instances are co-located for good performance.
      • Instance restart on weekly basis. During restart Google Management Service will apply any necessary update for OS or security
  • Standard Environment:
    • Standard environment is a like a sandbox. A sandbox typically provides a tightly controlled set of resources for guest programs to run in it.
    • Standard environment supports below languages for development:
      • Python 2.7
      • Java 7, Java 8
      • PHP 5.5
      • Go 1.6
    • Since it is sandbox we cannot include and custom language.
    • Standard environment is good for testing and development. It is better if we use it in controlled environment.
    • Standard environment includes following features:
      • Persistent storage with queries, sorting, and transactions.
      • Automatic scaling and load balancing.
      • Asynchronous task queues for performing work outside the scope of a request.
      • Scheduled tasks for triggering events at specified times or regular intervals.
      • Integration with other Google cloud services and APIs.

Step-by-Step procedure to Create and Deploy Google App Engine Project in PyCharm (Standard Environment)

  • Install Python-2.7.14:
    • Standard environment only support Python 2.7, So Make sure we use Python 2.7 development.
  • Install and initialize Google Cloud SDK for your distribution.
  • Run the following command to install the gcloud component that includes the App Engine extension for Python:
    • # gcloud components install app-engine-python
    • # gcloud components install app-engine-python-extras
    • for help : # gcloud –help
    • for updating components : # gcloud components update
  • For PyCharm we need Original App engine SDK for Python:
    • Unzip downloaded zip file
    • Add google_appengine directory to path
      • export PATH=$PATH:DIRECTORY_PATH/google_appengine_1.9.64/
  • Open PyCharm(Professional)
  • Create new project:
    • Enter Project name
    • Set existing path : python 2.7
    • Set App engine SDK directory to google_appengine directory. If PATH is set then PyCharm will auto select path.

    • Click create to create your GAE(Google App Engine).

Now deploy created project on Google Cloud Platform:

  • In order to deploy project we need to create project in google cloud platform
  • Now go to project directory and upload your project to GCP
    • Execute below command configure your account
      • gcloud init
        • Select Account to login with

        • Select Project


        • Configure Compute engine and specify zone where you want your project

        • After this we are ready to deploy our project on GCP
    • After initialization we need to deploy our project
      • gcloud app deploy
        • This will show us out Application configuration, if you want to make any change execute gcloud init and change configuration.

        • After this application upload will start

        • You can stream logs from the command line by running:
          • $ gcloud app logs tail -s default
        • To view your application in the web browser run:
          • $ gcloud app browse

Then you can access you project with target url of your application configuration.

Conclusion :

We can setup Django/Flask project by adding external lib while creating project in PyCharm and deploy project on GAE.

Since GAE provides us debugging, logging, monitoring and community support, it is very useful for debugging issues in production environment.




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Reload Image