Giter Site home page Giter Site logo

paulyuk / containerapps-dapralbums Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/containerapps-dapralbums

0.0 0.0 0.0 281 KB

Container Apps Dapr-enabled sample

License: MIT License

JavaScript 4.03% C# 3.94% CSS 0.19% Dockerfile 1.71% Pug 1.59% Bicep 87.98% Shell 0.56%

containerapps-dapralbums's Introduction

Azure Container Apps: Dapr Albums Sample

Open in GitHub Codespaces

This repository was created to help users quickly deploy Dapr-enabled microservices to Azure Container Apps.

Solution Overview

The solution is composed of two microservices: the album API and the album viewer.

architecture

Album API (albumapi)

The albumapi is an .NET 7 minimal Web API that retrieves a list of Albums from Azure Storage using the Dapr State Store API. Upon running the application for the first time the state store will be initialized with data. For subsequent calls, the list of albums will be retrieved from the backing state store.

Album Viewer (python-app)

The albumviewer is a Node.js client application through which the albums retrieved by the API are surfaced. In order to display the repository of albums, the album viewer microservice uses the Dapr Service invocation API to contact the backend album API.

Run locally

Run in Visual Studio

  1. Load the albumapi.sln solution in VS 2022 for any editing
  2. To run, we'll still use a Terminal
cd ./albumapi/
dotnet build
dapr run --app-id albumapi --app-port 5007 --dapr-http-port 3500 --components-path ../dapr-components/local -- dotnet run --urls "http://localhost:5007"

The API service is started on http://localhost:5007 and can be called with the http://localhost:5007/albums route.

cd ./albumviewer/
npm install
dapr run --app-id albumviewer --app-port 3000 --dapr-http-port 3501 --components-path ../dapr-components/local -- npm run start --urls "http://localhost:3000"

The Web client app will be running on http://localhost:3000

Run in VS Code

  1. Load this folder in VS Code
code .
  1. In the Run and Debug menu, selected "All services", and Press Start Debugging (F5)
  2. In the PORTS window, right click on the endpoint running on port 3000, Open in Browser

Run in CodeSpaces

  1. Load this repo in a CodeSpace clicking this button

Open in GitHub Codespaces

  1. In the Run and Debug menu, selected "All services", and Press Start Debugging (F5)
  2. In the ports window, right click on the endpoint running on port 3000, Open in Browser

Run in the Terminal

  1. Start the albumapi app in a new Terminal window
dotnet build
dapr run --app-id albumapi --app-port 5007 --dapr-http-port 3500 --components-path ../dapr-components/local -- dotnet run --urls "http://localhost:5007"

The API service is started on http://localhost:5007 and can be called with the http://localhost:5007/albums route.

  1. Open another Terminal window, restore and start the albumviewer app
cd ./albumviewer/
npm install
dapr run --app-id albumviewer --app-port 3000 --dapr-http-port 3501 --components-path ../dapr-components/local -- npm run start --urls "http://localhost:3000"

The Web client app will be running on http://localhost:3000

Deploy using the Azure Developer CLI

Provision and deploy the entire application and dependencies using Azure Developer CLI

azd up

Deploy via GitHub Actions

The entire solution is configured with GitHub Actions and Bicep for CI/CD

  1. Fork the sample repo

  2. Create the following required encrypted secrets for the sample

    Name Value
    AZURE_CREDENTIALS The JSON credentials for an Azure subscription. Replace the placeholder values and run the following command to generate the Azure authentication information for this GitHub secret az ad sp create-for-rbac --name INSERT_SP_NAME --role contributor --scopes /subscriptions/INSERT_SUBSCRIPTION_ID --sdk-auth. For guidance on adding a secret, see here
    RESOURCE_GROUP The name of the resource group to create
    GH_PAT Generate a GitHub personal access token with write:packages permission and store as a pipeline secret. This PAT will be used to push images to your private GitHub Package Registry.
  3. Open the Actions tab, select the Build and Deploy action and choose to run the workflow. The workflow will build the necessary container images, push them to your private Github Package Registry and deploy the necessary Azure services along with two Container Apps for the respective services.

  4. Once the GitHub Actions have completed successfully, navigate to the Azure Portal and select the resource group you created. Open the albumviewer container app and browse to the FQDN displayed on the overview blade. You should see the sample application up and running.

containerapps-dapralbums's People

Contributors

paulyuk avatar bradygaster avatar jongio avatar dependabot[bot] 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.