In this article, we are going to discuss how to use blob storage as static page for cheap while keeping security and integrity.
First of all you have your Database of customer and an application that can call the DB and receive request to update the DB.
If you do not have your application, you can use mine which is located here : https://github.com/MourIdri/flaskgattling .
1 – You will have to create your own Data Base and add you credentials details in the credentials.jon files.
2 – You create virtual machine and and start the script : sh_bootstrap_gattling_server_ub16.sh
This script will prepare the VM for you and start the application that will now be available at : http://<YourPublicIP>:877/
You can use the script for your docker file if you want to make it even cheaper !
In my case, I use a container which is easy to deploy and My application is already containerized !
Now that the application is running, you can try the client @ sh_bootstrap_gattling_client_ub16.sh This client is a Gatling that will test the performance of your server and will provide some indicators like the type of request ( Read or Write the DB), the time it tooks and the Status code the server sent.
Now every element of the backend is working, let’s use the front end.
There is no more need to create a frond end for marketing event, blob storage is enough !
You just need to create a container and put the pages that will be involved in it on azure blob storage. Make sure you setup access policy as read only. You can copy past the content of this https://github.com/MourIdri/flaskgattling/tree/master/frontmarket
And then Adjust the policies using Storage explorer or Azure portal.
The demo is running @ https://rgcloudmouradgeneraleuro.blob.core.windows.net/mouraddevcont/frontmarket/index.html
So now the workflow is this one :
1 – User reach the first blob
The HTML and the pictures ( also CSS) are stored in the container :
2 – The user register and the application does the following
The page can contain a JS script of a PHP script to do operation like Post for example. In my case this is a very small and simple use-case were it does a post to the flask application server :
3 – the Database is updated and Flask API uses the redirect feature to redirect to the last blob.
Optionally put a back up in the Blob archive feature with a time stamp or snapshot.