Last active
August 29, 2015 14:21
-
-
Save guitarrapc/3ef1cc33dc13ef0f3776 to your computer and use it in GitHub Desktop.
Automate Deploy S3 placed TopShelf Application to the host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configuration SampleTopShelfContinuousDelivery | |
{ | |
$s3Bucket = "INPUT YOUR S3 BUCKET NAME" | |
$zip = "S3 KEY ZIP FILE NAME" | |
$exe = "SERVICE EXE NAME" | |
$serviceName = "SERVICE NAME DEFINED IN TOPSHELF" | |
$destination = "C:\DOWNLOADPATH" | |
$downloadPath = Join-Path $destination $zip | |
$unzipPath = Join-Path $destination $serviceName | |
$servicePath = Join-Path $unzipPath "MSBUILD\EXTRACT\PATH\TO\$exe" | |
Import-DSCResource -ModuleName GraniResource | |
cS3Content SampleTopShelfContinuousDelivery | |
{ | |
S3BucketName = $s3Bucket | |
Key = $zip | |
DestinationPath = $downloadPath | |
PreAction = { | |
if(Get-Service | where Name -eq $using:serviceName){ Stop-Service $using:serviceName } | |
if(Test-Path $using:unzipPath){ Remove-Item -Path $using:unzipPath -Recurse -Force } | |
} | |
} | |
Archive SampleTopShelfContinuousDelivery | |
{ | |
Ensure = 'Present' | |
Path = $downloadPath | |
Destination = $unzipPath | |
} | |
cTopShelf SampleTopShelfContinuousDelivery | |
{ | |
Ensure = "Present" | |
Path = $servicePath | |
ServiceName = $serviceName | |
DependsOn = "[Archive]InstallRapidHouse" | |
} | |
Service SampleTopShelfContinuousDelivery | |
{ | |
Name = $serviceName | |
State = 'Running' | |
DependsOn = "[cTopShelf]InstallRapidHouse" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment