Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Kontent-ai-Learn/kontent-ai-learn-code-samples-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

master develop

Kontent.ai Learn - Samples Manager

Backend service for Kontent.ai Learn that fetches content from Kontent.ai.

Together with GitHub Reader, this service is responsible for maintaining Kontent.ai content items that represent code samples used in Kontent.ai Learn.

Samples Manager responds to changes in the stored code samples in Azure Blob Storage and then updates content items in Kontent.ai project accordingly.

Overview

  1. This project is a JavaScript Azure Durable Functions application.
  2. After the GitHub Reader saves changed code samples in the storage, Samples Manager updates content items in Kontent.ai project using Content Management API.
  3. This service is subscribed to a Blob Created event type which is fired when GitHub Sync stores code samples to the Azure Blob Storage.
  4. In order to handle many code samples at once, the service is written as an Azure Durable function that executes a sequence of functions in a specific order. Each of those functions will process only a specified amount of code samples.

Setup

Prerequisites

  1. Node (+yarn) installed
  2. Visual Studio Code installed
  3. Subscriptions on Kontent.ai and MS Azure

Instructions

  1. Open Visual Studio Code and install the prerequisites according to the following steps.
  2. Log in to Azure using the Azure Functions extension tab.
  3. Clone the project repository and open it in Visual Studio Code.
  4. Run yarn install in the terminal.
  5. Set the required keys.
  6. Deploy to Azure using Azure Functions extension tab, or run locally by pressing Ctrl + F5 in Visual Studio Code.

Required Keys

  • KC.ProjectId - Kontent.ai project ID
  • KC.ContentManagementApiKey - Kontent.ai Management API key
  • KC.Step.CopywritingId - Copywriting workflow step ID
  • KC.Step.PublishedId - Published workflow step ID
  • KC.Step.ArchivedId - Archived workflow step ID
  • Azure.ConnectionString - Connection string for the Azure Storage account
  • ChunkSize - Amount of code samples processed in a call of a single function
  • EventGrid.Notification.Key - Key for notification eventGrid topic
  • EventGrid.Notification.Endpoint - Url for notification eventGrid topic

Testing

  • Run yarn run test in the terminal.

How To Contribute

Feel free to open a new issue where you describe your proposed changes, or even create a new pull request from your branch with proposed changes.

License

All the source codes are published under MIT license.