Serverless backend for the Gif-Collage application utilizing Azure Functions, SignalR, EventGrid, CosmosDB, and Blob Storage.
Terraform is not required, but makes setting up Azure Services seamless. NOTE: A change in the backend "remote" block in provider.tf
may be required. Run the following commands once Terraform Cloud is connected.
terraform workspace new prod # or dev
terraform init
terraform apply
This will run the Terraform IaC to set-up the serverless infrastructure required to run GifCollage.
- Install Ngrok: Click here for download link
- Azure Subscription
- Install ngrok, then run the following command:
ngrok http -host-header=localhost 7071
. - Fill out the necessary configurations in
local.settings.json
using thesample.local.settings.json
file as a template. - Run
npm install
. - Run
npm run offline
command to run the azure function app locally. - (Optional / Required for File Uploads) Navigate to the Event-Grid System Topic in Azure Portal for the
storagifcollage<env>
i.e:storagegifcollageprod
account. Use this page for creating the event-grid subscription for the local "gifCollageUpload" Function. The steps for setting up can be found in the following wiki provided by Azure: Here. You can use the following guide below to create the new event subscription.- Basic tab
- Event Subscription Name:
filesavesub-gifurl-local
- Event Scheme: "Event Grid Scheme"
- Filter to Event Types: "Blob Created"
- Endpoint Type: Webhook
- Subscriber Endpoint:
<ngrok url>/runtime/webhooks/EventGrid?functionName=gifCollageUpload
- Event Subscription Name:
- Filters tab
- Enable Subject Filtering
- Subject begins with:
/blobServices/default/containers/gifcollage/blobs/files/
- Basic tab
NOTE: Every time you start ngrok, the HTTPS URL is regenerated and the value changes. Therefore you must create a new Event Subscription each time you expose your function to Azure via ngrok.