---
# System prepended metadata

title: serverless workshops

---

# serverless workshops

We'll focus on 4 points of integration (Observe and Notify):

- Azure Logic/Function Applications
- Gitlab API
- Jenkins API
- ClickUp API

## Workshop 1: Logic and Function Apps, Provider and Platform Agnosticism

### Function as a Service (FaaS)

- What is a Logic App?
- What is a [Function App](https://azure.microsoft.com/en-us/products/functions)?
- What is a [Lambda](https://aws.amazon.com/lambda)?
- What are [Cloud Functions](https://cloud.google.com/functions?hl=en#section-1)?
- What is [Knative](https://www.densify.com/openshift-tutorial/openshift-serverless)?
- What is Serverless?
- Where do Serverless Applications run?

## Workshop setup
- register the insights provider (once for the subscription)
  ```
  az provider register --namespace 'Microsoft.Insights'
  ```

## Workshop 2: Use serverless to scaffold a new application
quick start: https://www.serverless.com/framework/docs/providers/azure/guide/quick-start

- install node https://nodejs.org/en/download/package-manager
  - acceptable versions:
    - 14 <sup>may have issues when running on newer node environments due to inconsistencies `package-lock.json`</sup>
    - 16
    - 18
    - 20
  - recommended version:
    - 18
- install serverless (https://www.serverless.com/framework/docs/providers/fn/guide/installation)
  ```bash
  npm install -g serverless
  ```
- install azure cli. see: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli for platform specific instructions

- run scaffold:
  ```bash
  my_project_name=sls-workshop-$(uuidgen | cut -d '-' -f 1)
  sls create -t azure-nodejs -p ${my_project_name}
  ```
- modify `serverless.yml`
  see: https://www.serverless.com/framework/docs/providers/azure/guide/serverless.yml
  - set region: `uaenorth`
  - set runtime: `nodejs18`
  - set os: `linux`
  - set prefix: `poc`
  - set subscriptionId: `ad744a08-2411-4d78-b417-1f1c83f4f741`
  - set stage: `dev`
  - set type: `consumption` <- case sensitive

- install dependencies
  - serverless offline
    ```bash
    npm install serverless-offline --save-dev
    ````
  - azure functions core tools
    ```bash
    npm install azure-functions-core-tools --save-dev
    ````

## Workshop 3: Implement portability, run, test and debug locally, deploy to a cloud-based dev environment

- authenticate with azure cli
  ```bash
  #tennant=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  tennant=2a97cd69-2afd-40c9-bcf6-32581ecf57c0
  subscription=32a6cd79-17ca-49b9-9213-c5038070ae27
  
  # set tenancy to sandbox environment
  az login --tenant ${tenant}
  
  # set subscription to sandbox environment
  az account set -s ${subscription}
  ```
- run locally
  ```bash
  sls offline
  
  # with a custom serverless.yml
  sls offline --config ./serverless-amazon.yml
  ```
- deploy function app to azure dev environment
  ```bash
  sls deploy
  
  # with a custom serverless.yml
  sls deploy --config ./serverless-amazon.yml
  ```
- set functions runtime
  ```shell
  az functionapp config appsettings set \
    --subscription 32a6cd79-17ca-49b9-9213-c5038070ae27 \
    --resource-group omantel-cicd-sls-workshop-c41c630e-rob \
    --name poc-uaen-dev-sls-workshop-c41c630e-rob \
    --settings FUNCTIONS_EXTENSION_VERSION=~4
  ```

- managing application secrets
  - https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.KeyVault%2Fvaults

## Workshop 4: Git service hooks, clickup integration

- create a gitlab service hook that triggers a function app workflow
- implement a git event handler that makes decisions about responding to webhooks

## Workshop artifacts

- [sls-workshop-7562add4-maathir](https://gitlab.thgttg.com/omantel/sls-workshop-7562add4-9667-4b79-9ea4-3232cf247930)
- [sls-workshop-7cc40859-manudeep](https://gitlab.thgttg.com/omantel/sls-workshop-7cc40859-bc52-4819-8725-1c6ad2fa84cc)
- [sls-workshop-40c4f9ca-rahab](https://gitlab.thgttg.com/omantel/sls-workshop-40c4f9ca-rahab)
- [sls-workshop-a6e4761d-yaqoob](https://gitlab.thgttg.com/omantel/sls-workshop-a6e4761d-819a-4732-9411-9e73a7e13455)
