Code Monkey home page Code Monkey logo

demos's Introduction

#GCP - Storage/Datastore/PubSub image resizing app demo

This is an introductory demo that shows how to leverage GCP services and cloud best practices (decoupling, high availability, Disaster Recovery, Scalability) to create a web application.

This demo has a SOA design, using PHP for the frontend and Python in the backend. The demo web app allows users to fill out a short form with Name, Email, and Picture. The picture is resized, and another page shows the resized picture of all users. The idea is to simulate a social media app, but the concepts can be applied to other examples.

The app has 3 main services:

Front End: hosting the main page, and ingesting the form from users Back End: transforming the picture into thumbnail size Render: displaying all users' thumbnail pictures

Intended app setup, logic, and flow:

  • Global Load Balancer

    • 3 backends
      • frontend
      • render
      • bucket with thumbnail pictures (CDN enabled)
  • Multi Regional GCS bucket

  • Front End

    • 1 or more Instance Groups (in different regions)
    • PHP + GCP APIs (Storage and PubSub)
    • Allows users to upload picture
    • Upload picture into a temp folder in GCS bucket
    • Sends a message to a PubSub topic
      • message content: GCS object location, name, email
  • Back End:

    • 1 or more Instance Groups (in different regions)
    • Python + GCP APIs (Storage, PubSub, Datastore)
    • Subscribe to the PubSub topic, reads the message
    • download temp picture, resizes, uploads to GCS bucket
    • create an entry in Datastore:
      • email (as the index); name; thumbnail url; data uploaded (important for rendering later)
    • if everything suceeds .... acknoledge the message (removing from the PubSub topic, to avoid message to be processed again)
  • Render:

    • 1 or more Instance Groups (in different regions)
    • PHP + GCP API (Datastore)
    • Queries Data store, sort entities by the newest (so we can display the newest picture 1st)
    • creates an array in PHP, loop, and display

Highlights/Teachble points:

  • GCP Global Networking, LB is Global, one single IP (High Availability)
  • Due to global networking, we can have VMs running our services in multiple regions (High Availability / DR / Scalability)
  • PubSub (Decoupling)
  • Datastore (Decoupling / Scalability)
  • Storage (High Availability / DR)
  • GCE with Autoscaling, Templates (Scalability / Repeatable)

NOTE: I am not and do not claim to be a web developer, or a developer at all. The demo serves its purpose of proving a few points. Feedback is more than welcome, but do it in a nicer and non-derrogatory way. I'd love to incorporate feedback and have a more robust and elegant looking app.

demos's People

Contributors

soeirodefaria avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.