Giter Club home page Giter Club logo

pulumi-azure-dotnet5's Introduction

Deploy


Deploy Containerized Web Applications using Azure Next Generation Provider, .NET 5, and C# 9

The example demonstrate several Pulumi features:

  • Azure NextGen provider
  • Running on .NET 5
  • Using C# 9 constructs like top-level statements, implicit constuctors, and records
  • Defining and using components with Pulumi

Adjust the code

This example can cover several deployments architectures that are listed below.

Public Docker Image to Azure App Service

You can deploy any public Docker image that contains a web application listening to port 80 to an Azure App Service. Modify the constructor of MyStack class in Program.cs file to

public MyStack()
{
    var app = new WebApplication("hello", new()
    {
        DockerImage = "strm/helloworld-http"
    });

    this.Endpoint = app.Endpoint;
}

Custom Application to Azure App Service

Builds a Docker container from the files in app folder, push it to Azure Container Registry, and deploy it to an Azure App Service. Modify the constructor of MyStack class in Program.cs file to

public MyStack()
{
    var app = new WebApplication("hello", new()
    {
        AppFolder = "./app"
    });

    this.Endpoint = app.Endpoint;
}

Public Docker Image to Azure Kubernetes Service

You can deploy any public Docker image that contains a web application listening to port 80 to a new AKS cluster. Modify the constructor of MyStack class in Program.cs file to

public MyStack()
{
    var cluster = new AksCluster("demoaks");

    var app = new WebApplication("hello", new()
    {
        Cluster = cluster,
        DockerImage = "strm/helloworld-http"
    });

    this.Endpoint = app.Endpoint;
}

Custom Application to Azure Kubernetes Service

Builds a Docker container from the files in app folder, push it to Azure Container Registry, and deploy it to a new AKS cluster. Modify the constructor of MyStack class in Program.cs file to

public MyStack()
{
    var cluster = new AksCluster("demoaks");

    var app = new WebApplication("hello", new()
    {
        Cluster = cluster,
        AppFolder = "./app"
    });

    this.Endpoint = app.Endpoint;
}

Deploying the App

To deploy your infrastructure, follow the below steps.

Prerequisites

  1. Install Pulumi
  2. Configure Azure Credentials

Steps

After cloning this repo and making adjustments as described above, from this working directory, run these commands:

  1. Create a new stack, which is an isolated deployment target for this example:

    $ pulumi stack init dev
  2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    $ az login
    
  3. Stand up the application by invoking pulumi

    $ pulumi up
  4. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:

    $ pulumi destroy --yes
    $ pulumi stack rm --yes

pulumi-azure-dotnet5's People

Contributors

dmorosinotto avatar

Watchers

James Cloos avatar  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.