RubyFlow The Ruby and Rails community linklog

Hosting microservice SPAs on Azure Storage Account blobs proxied by Nginx [prototype]

As you may know simmilar to AWS S3, with Azure Storage Account blobs you can host static website on these service. (so you pay few cent per month hosting)

Over Christmas holiday 2018 I had some spare time so I was fiddling around with a proof of concept of hosting microservice SPAs on Azure Storage Account Blobs proxied by Nginx.

So imagine you would have website: https://mywebsite.com running Nginx proxy server that would load:

  • `https://mywebsite.com/` -> one SPA hosted on `https;//my-website-root.azure-storage...com/`
  • `https://mywebsite.com/marketing` -> one SPA hosted on `https;//my-website-marketing.azure-storage...com/`
  • `https://mywebsite.com/admin -> one SPA hosted on `https;//my-website-admin.azure-storage...com/`

All what the developer/s would have to do is to do JS changes is individual SPA folders. Compile the the static files. Deploy the static code to the azure storage blob. All that would be needed is a VM running Nginx that would proxy the request from `https://mywebsite.com/*` to a proper Azure storage blob (where the content is already compiled)

And boom you have production ready microservice SPAs for for less than a dollar a month. + the cost of that one Nginx VM

If you would need to host several different enviraments (E.g. staging, or each developer would have own Environment). That can easily be done by just creating other Azure storage accounts and compile the SPAs with different ENV variables, push to different Azure Storage Account :

  • `https://staging-mywebsite.com/` -> one SPA hosted on `https;//staging-my-website-root.azure-storage...com/`
  • `https://staging-mywebsite.com/marketing` -> one SPA hosted on `https;//staging-my-website-marketing.azure-storage...com/`
  • `https://staging-mywebsite.com/admin -> one SPA hosted on `https;//staging-my-website-admin.azure-storage...com/`
So my prototype worked and source code can be found: I had it up and running for some time but due to cost reduction of the bill I turn it off. I no longer work on it as I really just wanted to see if this is possible for myself.
Anyway if anyone find this useful and would like to carry on with the project (or looking for inspiration how to do this) here it is ;)

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in