Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo local network deploy into IIS

Austin McDaniel November 17, 2013

I'm new to Bamboo and have Stash and JIRA already in my stack. I'm got a task setup for get the latest files from Stash and build them with VS. The output is deployed into a directory called 'target'. I am having trouble actually deploying this software. My IIS is a server inside my network. I've created a map but the download artifact deploy task is only relative. My directory looks like: z:\inetpub\wwroot\mywebapp This seems like a very simple task but i can't seem to figure out the right approach.

1 answer

0 votes
Jason Monsorno
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2013

The artifact download is intended to copy the artifact made from a previous job into a local working copy so that part is correct. An IIS application need not only the files but to be in IIS Manager "Convert to application" the first time to set it up correctly and then it will be in the Default App Pool unless moved. This can also be done with scripts as shown below.

IIS can hold onto files for requests and say they're deleted but not actually delete them, this cause an issue when trying to copy over new files; we've seen quite a few times the entire directory be empty after a simple copy of new files. To deploy without these issues, you'll need to stop the AppPool first. To keep all of the AppPool configurations in sync across sites and avoid manual steps; we deleted the Application and AppPool and make new ones each time. Here is an example powershell script we use, as is it needs to be run from the server you're installing to be you can change than or invoke it on that machine.

Import-Module WebAdministration
if (Test-Path "IIS:\AppPools\$appName")
{	Remove-WebAppPool $appName	}
if (Get-WebApplication -Name "services/$appName")
{	Remove-WebApplication -Name "services/$appName" -Site "Default Web Site"	}
InstallWebService $appName
$appPool = New-WebAppPool $appName
$appPool.managedRuntimeVersion = "v4.0"
$appPool | Set-Item
New-WebApplication -Name "services/$appName" -Site "Default Web Site" -PhysicalPath "C:\inetpub\wwwroot\services\$appName" -ApplicationPool $appName

"InstallWebService" is a custom function of ours that simply copies the files over (we use robocopy), for that piece you'll need to setup a shared directory or use the default ones with admin rights \\servername\z$\inetpub\wwroot\mywebapp and just copy your build results, probably your artifact, to that location.

Jason Monsorno
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2013

You can use whatever AppPool or AppPool configuration you want, we went ahead and are making a separate AppPool for each application which may not work for your situation. Removing the application from IIS instead of just the files underneath it will stop the application and allow you properly copy the new files over so you might choose to skip the AppPool delete parts but I'd still keep a check and creation for new deployments.

Like Zahid Iqbal Tushar likes this
Gretchen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2013

For what it's worth it is possible to recycle the AppPools via a cscript command from bamboo, but it forks off and frequently fails to return a result causing the build to hang. I finally gave up and resorted to running a script manually for the recycle step on a deploy.

Also you'll get a better result with robocopy than xcopy. We had issues with xcopy hitting a locked file and skipping it or terminating on a lock and producing unreliable deployments. Robocopy allows you to use retries and can log all files copied so you know what you're getting is correct and complete. The syntax for robocopy is completely different than xcopy. Officially xcopy is deprecated in favor of robocopy.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events