[PYTHON] Easily realize microservices with Cloud Run x Flask

Introduction

I'm creating an app for personal development, but I made the backend with rails. One day. .. .. I saw this article. App development without back-end engineer on Firebase: Benefits and issues experienced by Cookpad

Firebase allows you to develop without the need for a backend engineer </ b>

(゚ д ゚) ... Magica

Inspired by this, I made a backend with Cloud Function.

But

For some reason it quit.

Why didn't you adopt Cloud Function?

This time I adopted microservices as an architecture, and I don't want to create each function myself, so I was angry to define BaaS as a service and create only BFF.

In that case, it would be easier to create a common library file for each BaaS when launching other projects </ b>, right? Then, I learned that cloud functions have such a common function and tried to adopt them.

However. ..

It's troublesome (; ´Д `)

In the first place, I'm disgusted that it can only be executed locally in function units Isn't it possible to run a framework that can be executed locally without a server like a cloud function? The idea.

Build serverless with Docker called cloud run, and charge for each request (data cannot be persisted) Is it just the top of the cloud function? I learned that there is a compatible service and adopted it this time.

After all, what do you want to say?

--Microservices --Serverless --Request unit billing --Low price - I don't want to create my own functions </ b> - I don't want to build an environment </ b>

I made a sample (base) for those who want to realize these, so please use it! I want to say that.

What I made

It is less than.

https://github.com/taiseiotsuka/Flask-On-CloudRun

I wrote all the construction procedures in the readme, so please use it if you like.

  • It is assumed that the Docker repository uses Google Container Registry.
  • Deployment is assumed to be done from the GCP mannequin.
  • The part corresponding to BaaS uses Google Firestore (Nosql DB) as a sample this time.

If you don't know how to use it, ask a question!

Bye