Giter Site home page Giter Site logo

40a / psdeploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ramblingcookiemonster/psdeploy

0.0 1.0 0.0 648 KB

Simple PowerShell based deployments

Home Page: http://ramblingcookiemonster.github.io/PSDeploy-Take-Two/

License: Apache License 2.0

PowerShell 100.00%

psdeploy's Introduction

Build status Documentation Status

PSDeploy

PSDeploy is a quick and dirty module to simplify PowerShell based deployments.

The idea is that you write a *.psdeploy.ps1 deployment configuration with sources and targets, and PSDeploy will deploy these.

Suggestions, pull requests, and other contributions would be more than welcome! See the contributing guidlines for more info.

Deployments

Invoking PSDeploy is very similar to running Invoke-Pester. Here's an example, Some.PSDeploy.ps1

Deploy ActiveDirectory1 {                        # Deployment name. This needs to be unique. Call it whatever you want
    By Filesystem {                              # Deployment type. See Get-PSDeploymentType
        FromSource 'Tasks\AD\Some-ADScript.ps1', # One or more sources to deploy. Absolute, or relative to deployment.yml parent
                   'Tasks\AllOfThisDirectory'
        To '\\contoso.org\share$\Tasks'          # One or more destinations to deploy the sources to
        Tagged Prod                              # One or more tags you can use to restrict deployments or queries
        WithOptions @{
            Mirror = $True                       # If the source is a folder, triggers robocopy purge. Danger
        }
    }
}

Let's pretend Some.PSDeploy.ps1 lives in C:\Git\Misc\Deployments. Here's what happens when we invoke a deployment:

Invoke-PSDeploy -Path C:\Git\Misc
  • We search for all *.psdeploy.ps1 files under C:\Git\Misc, and find Some.PSDeploy.ps1. In this case, we have two resulting deployments, Some-ADScript.ps1, and AllOfThisDirectory
  • We check the deployment type. Filesystem.
  • We invoke the script associated with Filesystem Deployments, passing in the two deployments
  • Relative paths are resolved by joining paths with C:\Git\Misc
  • C:\Git\Misc\Tasks\AD\Some-ADScript.ps1 is copied to \contoso.org\share$\Tasks with Copy-Item
  • C:\Git\Misc\Tasks\AD\Tasks\AllOfThisDirectory is copied to \contoso.org\share$\Tasks with robocopy, using /XO /E /PURGE (we only purge if mirror is true)

Initial PSDeploy setup

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the PSDeploy folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)

    #Simple alternative, if you have PowerShell 5, or the PowerShellGet module:
        Install-Module PSDeploy

# Import the module.
    Import-Module PSDeploy    # Alternatively, Import-Module \\Path\To\PSDeploy

# Get commands in the module
    Get-Command -Module PSDeploy

# Get help for the module and a command
    Get-Help about_PSDeploy
    Get-Help Invoke-PSDeploy -full

More Information

The PSDeploy docs will include more information, including:

  • Examples for different DeploymentTypes - will try to keep these in sync with new types when they are added
  • Illustrations of features like tags and dependencies
  • Common scenarios (todo)
  • How to write new PSDeploy DeploymentTypes
  • Details on the PSDeploy Configuration Files

The blog posts (one, two), and three will become out of date over time, but may include helpful details.

Notes

Thanks go to:

  • Scott Muc for PowerYaml, which we borrow for YAML parsing
  • Boe Prox for Get-FileHash, which we borrow for downlevel hash support in the deployment scripts
  • Michael Greene, for the idea of using a DSL similar to Pester
  • Folks writing new PSDeploy deployment types and contributing in other ways - thank you!

psdeploy's People

Contributors

devblackops avatar dexterposh avatar equelin avatar gerane avatar mgreenegit avatar michaeltlombardi avatar platta avatar plork avatar ramblingcookiemonster avatar terrapinstation avatar

Watchers

 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.