You have statically rendered your web app and want to trigger your build pipeline whenever there is any publish/unpublish action in the Content Management System (CMS) using a webhook. It will be more than just triggering a pipeline using a webhook. We will require the following things before we move on to create our automation workflow.
1. CMS (we will be using Contentful)
2. A serverless function (Azure Function Apps/ Google Cloud Functions / AWS lambda)
3. DevOps pipeline to be triggered.
4. CI tool REST API token to securely trigger the build pipeline (we’ll be using Personal Access Token of Azure DevOps)
5. Code Repository
6. Queue storage (we’ll be using Azure Queue Storage)
7. Target server (App service/EC2 etc. to view published content)
1. Create a Function App
Go to Azure portal → Custom Deployment →Load a GitHub quickstart template or load your own custom template and parameter files
Alternatively, we can create a function app and a storage account from the portal.
Go to Azure Portal →Create Function App →Fill the Instance details → Select runtime as required. We’ll be using Node.Js as runtime stack→Next: Hosting
Create a new storage account/use an existing one → Select plan type as consumption/premium depending on the environment/usage. This storage account will be used for storing function app files. This is because Functions relies on Azure Storage for operations such as managing triggers and logging function executions. The storage account needs to have a queue and file storage services. Only the Blob storage account cannot be used with Azure Functions.
Go to Monitoring → Enable Application Insights if needed → Add Tags like Resource creation date, TA, owner, etc. → Review+Create