Code Monkey home page Code Monkey logo

serverless-resume-api's Introduction

Your Resume API on Azure Serverless

Create an API with Azure Function that displays your resume information in json.

diagram

  • GitHub for Version control.
  • GitHub Actions for CI/CD pipeline.
  • Azure Functions to deploy our API.
  • Azure Blob Storage to store our resume.
  • .NET 6 as our programming framework for our API.
  • GitHub Codespaces as our development environment.
  • Bicep for our Infrastructure as Code.

You'll need

  • Azure account
  • GitHub account
  • I've provided a sample .json file based on the Json resume

NOTE We'll be using GitHub Codespaces for our development environment. At the moment, GitHub Free for personal accounts comes with 15 GB of Codespaces storage and 120 Core hours per month. Read more about pricing here

How to get started

Get the code and environment

  1. Fork the repository so you can have your own copy of it.
  2. Click on the Code button, click on Codespaces tab, and click on Create Codespaces on main. I've provided a devcontainer.json file with the configuration needed for this project.
  3. Once your Codespace has loaded, in the Explorer, expand the src folder and rename local.settings.sample.json to local.settings.json

Authenticate your Environment with Azure

  1. In the Terminal, type az login --use-device-code to log into your Azure account from the az cli in your Codespace.
  2. In the Terminal, type az account list --output table to get a list of Azure subscriptions you have available to you and make note of the name you want to use.
  3. In the Terminal, type az account set --name "name-of-subscription" with the name of the subscription you want to use.
  4. In the Terminal, type az account show and make sure it's set to the subscription you want to work in.

Provision resources in Azure

NOTE: I've set the resource group name to be rg-serverlessresumeapi

  1. I've provided Infrastructure as Code (IaC) files, you can find them in the infra folder. Now we need to use those files to create a deployment in Azure, in the Terminal, type:
    az deployment sub create --template-file ./infra/main.bicep -l <your-region>   
  2. In the Terminal, run the following command to get the values for your storage account name and function app name:
    az deployment group show -g rg-serverlessresumeapi -n resources --query properties.outputs 
  3. Upload myresume.json to that newly created blob container.
    az storage blob upload --account-name <storage-account-name> --container-name resume --name myresume.json --file myresume.json 
  4. In your local.settings.json add the Storage Account Connection String to the AzureWebJobsStorage value. You can get that value by running this command:
    az storage account show-connection-string --name MyStorageAccount --resource-group MyResourceGroup   
  5. You can now run and debug (F5) your Function in your environment

Configure CI/CD with GitHub actions

  1. We'll need to get our Function's Publish Profile, run:
    az functionapp deployment list-publishing-profiles --name {function-name} --resource-group {resource-group} --xml
  2. In your GitHub repo, create a secret named AZURE_FUNCTIONAPP_PUBLISH_PROFILE with the contents of your publish profile.
  3. Head to Actions tab on your Repo and manually run the workflow.
  4. Once it's complete. Visit Azure, select resource groups. find rg-serverlessresumeapi, and click on the function app, then click on the url, add getresume to the end of it, your resume info will be displayed.

serverless-resume-api's People

Contributors

madebygps avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.