Giter Club home page Giter Club logo

appreleasedsc's Introduction

AppReleaseDSC

Invoke App Releases via DSC

This works in conjunction with: brwilkinson/PlatformRelease

  • brwilkinson/PlatformRelease [The Build tools]
  • brwilkinson/AppReleaseDSC [The Release tools - Pull Mode]

PowerShell AZCOPY + App Release DSC Class based Resource

This is a DSC Resource for performing File sync tasks with Azure File Shares

azcopy sync /?

Requirements

  • PowerShell Version 5.0 +
  • Server 2012 +

This is the componentbuild.json metadata file that stores all of your build/release info You have all of your components in there you update this file when you run your build/release pipeline You do a git checkout of the file, update the value for the individual component/environment Then you check it into the git repo, then you copy it to the storage URI DSC will read this file to know which version to install via the DSC Module.

{
    "ComponentName": {
        "LogHeadersAPI": {
            "D": {
                "DefaultBuild": "0.1.0"
            },
            "Q": {
                "DefaultBuild": "0.1.0"
            },
            "T": {
                "DefaultBuild": "0.1.0"
            },
            "U": {
                "DefaultBuild": "0.1.0"
            },
            "P": {
                "DefaultBuild": "0.1.0"
            }
        }
    }
}

I provided a sample with all values passed in, however I would recommend that you set some of the file names as your defaults IN the DSC Module, then you don't need to specify them for each component

    # sample configuation data

            # Blob copy with Managed Identity - Oauth2
            AppReleaseDSCAppPresent     = @(

                @{
                    ComponentName     = 'LogHeadersAPI'
                    SourcePathBlobURI = 'https://{0}.blob.core.windows.net/builds/'
                    DestinationPath   = 'F:\WEB\'
                    ValidateFileName  = 'CurrentBuild.txt'
                    BuildFileName     = 'F:\Build\LogHeadersAPI\ComponentBuild.json'
                    SleepTime         = '10'
                }
            )
Configuration AppServers
{
    Param (
        [String]$StorageAccountName,
        [String]$clientIDGlobal
    )

    node $AllNodes.NodeName
    {
        #-------------------------------------------------------------------
        foreach ($AppComponent in $Node.AppReleaseDSCAppPresent)
        {
            AppReleaseDSC $AppComponent.ComponentName
            {
                ComponentName           = $AppComponent.ComponentName
                SourcePath              = ($AppComponent.SourcePathBlobURI -f $StorageAccountName)
                DestinationPath         = $AppComponent.DestinationPath
                ValidateFileName        = $AppComponent.ValidateFileName
                BuildFileName           = $AppComponent.BuildFileName
                EnvironmentName         = $environment[0]
                Ensure                  = 'Present'
                ManagedIdentityClientID = $clientIDGlobal
                LogDir                  = 'F:\azcopy_logs'
                DeploySleepWaitSeconds  = $AppComponent.SleepTime
            }
            $dependsonAZCopyDSCDir += @("[AppReleaseDSC]$($AppComponent.ComponentName)")
        }

Full sample available here

Invoke the resource directly to sync the files

As well as using DSC in Pull Mode, you can also invoke the release as part of your Release Pipeline directly So you get the benefit of a push or pull model, you can deploy via DSC for initial deployments, Then you perform updates via push.

$ht = @{
    ComponentName           = 'LogHeadersAPI'
    SourcePath              = 'https://storage01.blob.core.windows.net/builds/'
    DestinationPath         = 'F:\WEB'
    EnvironmentName         = 'D'
    ValidateFileName        = 'CurrentBuild.txt'
    BuildFileName           = 'F:\Build\ComponentBuild.json'
    Ensure                  = 'Present'
    ManagedIdentityClientID = '219fa169-9031-49cc-b4cb-1850bc5bf6b4'
    LogDir                  = 'F:\azcopy_logs'
}

Invoke-DscResource -Name AppReleaseDSC -Method Set -ModuleName AppReleaseDSC -Property $ht -Verbose

appreleasedsc's People

Contributors

brwilkinson avatar

Watchers

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