Creating a Windows Service with Deployment Manager

Automated deployment for web applications and databases

Moderators: Mike Upton, justin.caldicott, Sean.newham, csmith, chirayu, DavidSimner, david.conlin

Postby swinghouse » Tue Oct 16, 2012 12:37 am

Thanks David,

Yes, setting up .config transforms for other types of .NET applications in Deployment Manager proved to be smooth sailing indeed! Great stuff!

May I inquire about another thing? How should I go about registering Windows Services in a Deployment Manager release? Should I create a PowerShell script and put in in Deploy.ps1?

/Mattias

PS. Please let me know if I should start a new thread instead of prolonging this one.
swinghouse
 
Posts: 99
Joined: Mon Sep 12, 2011 10:51 am

Postby chirayu » Tue Oct 16, 2012 10:46 am

Hi Mattias,

David Conlin is on holiday, so I will be dealing with your query.

You can create 4 kinds of Powershell scripts with Deployment Manager:
    -PreDeploy.ps1
    -Deploy.ps1
    -PostDeploy.ps1
    -DeployFailed.ps1

You may not have come across this help page about creating/updating Windows service from a Powershell script:
http://www.red-gate.com/supportcenter/Content/Deployment_Manager/help/1.0/dm_powershell_scripts

If you have any other problems, please let us know. I hope this helps!
Chirayu Shishodiya
Software Engineer - Deployment Manager
Red Gate
chirayu
 
Posts: 68
Joined: Mon Sep 17, 2012 5:48 pm

Postby swinghouse » Tue Oct 30, 2012 10:17 am

HI Chirayu,

Thanks for the information - very useful!

I have one issue at the moment. Deployment Manager doesn't seem to pick up the .ps1 files in the NuGet package. I get this message while deploying:

No scripts with a .ps1 extension were found.


My .ps1 files, currently PreDeploy.ps1 and PostDeploy.ps1, are located at the root of my NuGet package.

What might I be doing wrong?

/Mattias
swinghouse
 
Posts: 99
Joined: Mon Sep 12, 2011 10:51 am

Postby swinghouse » Tue Oct 30, 2012 10:39 am

Success!

After upgrading the version number of my NuGet package and pointing Deployment Manager at the new version, Deployment Manager picked up my changes and executed the PowerShell scripts!

/Mattias
swinghouse
 
Posts: 99
Joined: Mon Sep 12, 2011 10:51 am

Postby swinghouse » Tue Oct 30, 2012 11:47 am

I'd just like to point out that, in addition to setting up a PostDeploy.ps1 script using the first example at http://www.red-gate.com/supportcenter/C ... ll_scripts as template, I created a PreDeploy.ps1 script which stops the service if it's already installed.

Otherwise Deployment Manager, very helpfully, reported the following error message:

One or more files in the directory may be locked by another process. You could use a PreDeploy.ps1 script to stop any processes that may be locking the file.


Very nice!

/Mattias
swinghouse
 
Posts: 99
Joined: Mon Sep 12, 2011 10:51 am

Postby chirayu » Tue Oct 30, 2012 2:21 pm

Hi Mattias,

I am glad you got Deployment Manager configured to use preDeploy and postDeploy scripts.

Currently, whenever you make changes to your package, you need to increment the version number for the changes to be picked up. We are aware of this and would be looking to fix this in the near future.

Please let us know if you have any further queries.

Thanks!
Chirayu Shishodiya
Software Engineer - Deployment Manager
Red Gate
chirayu
 
Posts: 68
Joined: Mon Sep 17, 2012 5:48 pm


Return to Deployment Manager

Who is online

Users browsing this forum: No registered users and 0 guests