Many users fear to test serverless because of unknown cost. Serverless is just hacked form of hosting HTML pages on Cloud Storage or CDN. This is an introductory guide to give the idea how we can test serverless with GitHub pages, PHP functions with OpenWhisk. IBM Cloud Serverless uses the same OpenWhisk. IBM Cloud provides many services for free of cost for testing. As OpenWhisk is a Free Software with Apache License, there is not much risk as you can actually run OpenWhisk on own server. Presently, Serverless has not been too smart to call with HTML or simple JS. In other words, you are reading the plan of upgrading our 9 years old things with Cloud Storage, like Music Player on Cloud Storage. At that time, we used Rackspace as Guinea pig for our tests. Now we use IBM Cloud as Guinea pig. The basic reason of shift is cost and more development probabilities.
GitHub Pages & OpenWhisk/IBM Cloud
The original idea came from this person :
1 | https://medium.com/@raphaelvigee/serverless-hosting-with-github-pages-aws-lambda-3c19e55d2cc4 |
He used AWS Lambda, but we will use OpenWhisk, IBM Cloud Functions. The thing essentially the same. We need two more tools :
---
1 2 | https://github.com/ReactTraining/react-router https://github.com/ReactTraining/react-router |
Github Pages only serves static content, he is using a bash script with React Router to generate the structure of his website. We already pointed on another the discussion on serverless framework that serverless
is a framework too which has plugins for IBM Cloud Functions, OpenWhisk etc. CircleCI is cloning the repo, create an out folder, build all the static content in out, generate the hacky structure, committing and pushing the out folder the the gh-pages orphan branch etc.
The total set of automation requiring so many steps as we still lack some “static website generator” for OpenWhisk. When we will have something like OctoPress, we have to do little works. Present efforts has built up to this : github.com/sirceljm/aws-lambda-blog
. OpenWhisk, IBM Cloud Functions are safer as changing pricing not going to totally destroy – you have to shift to own infrastructure.