The objective of this project is to migrate the NUS Money app 1.0 from localhost environment to cloud based.
Netlify will be hosting the static web assets. In addition, it will provide serverless functions that act as APIs for the frontend client to obtain data from the source. Serverless function FaaS model is more cost effective and scalable. Cloud based Fauna database will replace the local MySQL. It has native integration suport with Netlify.
Since we already have the code for NUS Money 1.0, we can create a Github repository and deploy to Netlify.
Make the NUS Money app 1.0 the current folder and execute the git commands:
git init
git add .
git commit -m "v1.0 NUS Money"
git remote add origin your Repo URL
git remote -v # (to verify that the correct repo URL is entered)
git push origin main # (may need to input your email and username for configuration first )
To deploy the code in your Github repo to Netlify, follow the guide below or use the deploy button.
https://www.netlify.com/blog/2016/09/29/a-step-by-step-guide-deploying-on-netlify/
After deployment, NUS Money App 1.0 is live in the link:
https://nusmoney.netlify.app
Netlify will general your own link that will differ from above
Github Action can provide the necessary automation to notify team members of a push/pull event, test, build and deploy the new code into Netlify.
The workflows are listed in the yml file found under .github\workflows
Once the workflow is ready, we can disable the auto deploy function in Netlify. Head to your site in Netlify: Deploys > Stop auto publishing
In order for Github Action to trigger the workflow in Netlify and Slack, you need to get the Secrets(bearer token) for the formal or use webhook for the later. Keep the tokens in a safe location.
for NETLIFY_AUTH_TOKEN go to your account by clicking on top right corner icon User settings > Appications > Personal access tokens
for NETLIFY_SITE_ID Site overview > General > Site details > API ID
for SLACK_WEBHOOK
go to beginning of your channel
Connect an app > Incoming WebHooks > Add to Slack >
Under Post to Channel Choose a channel as your target to post
Add Incoming Webhooks Integration > Webhook URL
To set up your repository environment with the above keys, go to your Github repo: Settings > Secrets > New repository secret
Screenshots of the Github Actions and Slack Notifications are shown below:
While we have chosen serverless functions for this project, there are other services we could explore based on different scenarios.
Finally, the selection of various services are not mutually exclusive. A hybrid model can be used. For example, an enterprise application may use Kubernetes primarily while fanning out ancillary lightweight features to serverless functions or containers.