Install nuget package in custom location when deploying services in parallel

Hi all,

We need to deploy multiple windows services. Each service has its own Octopus project.
The deployment process for each service contains 2 steps (screen_1):

  1. Deploy the service
  2. Deploy a common nuget package (Deploy nuget package step with a custom install directory)

In order to have faster deployments we want to deploy services in parallel. The problem is that in step 2 the common package is installed into same location (tentacle) and this fails because we get concurrent access on the same files (screen_2).

Is there a simple way to install the nuget package into a custom directory based on current deployed octopus project (D:\Octopus\Applications\Test\DeployedService\CommonPackage\1.0.0.3122) instead of the default location (D:\Octopus\Applications\Test\CommonPackage\1.0.0.3122)…
If not we are thinking to introduce a custom power-shell script that will install/copy and delete the common package.

Thank you,
Andrei Scutariu

screen_1.PNG

Hi Andrei,

Thanks for reaching out! Is there a specific reason why you have the 3 services spread across 3 different projects, instead of having just 1 project that deploys the 3 of them? Just trying to get a better understanding of your setup in order to give you an accurate advice :slight_smile:

Thanks!
Dalmiro

Each service is different and have own functionality (this is the reason to be a separate octopus project in our thinking), but needs the same nuget package.

And this common package is a library that is assembly scanned when the service is started.

And on screen_1 the deployed package is the actual service, not Common.Package as in the screenshot. I misspelled package name for the first step. Sorry for that. I’ve updated the screenshot.

screen_01_v2.PNG

Hi,
I’ve added another comments on the topic: http://help.octopusdeploy.com/discussions/questions/9683-install-nuget-package-in-custom-location-when-deploying-services-in-parallel
Thank you,Andrei Scutariu

On Monday, November 7, 2016 7:57 PM, Dalmiro Grañas <tender2+dfa09df830@tenderapp.com> wrote:

#yiv6806627662 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv6806627662 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}

Hi Andrei,

Try enabling the feature Custom Installation Directory on the step that deploys the common package, and put the code below on that field.

#{env:TentacleApplications}\#{Octopus.environment.name}\#{Octopus.Project.Name}\#{Octopus.Action.Package.PackageId}\#{Octopus.Action.Package.PackageVersion}

It should deploy to the path including the Project name just like you asked.

Let me know how that goes.

Dalmiro

Hi,
We have a deploy nuget package step with custom install directory feature enabled (see screenshot).
We think this works in the following way:1. Install the package into tentacle in the location D:\Octopus\Applications\Test\CommonPackage\1.0.0.3122.2. Custom install directory feature will copy the files from D:\Octopus\Applications\Test\CommonPackage\1.0.0.3122 into the right folder.If this is correct, step 1 is out of our control. In step 1 we have concurrent access problems.Is there a way to configure where the package is installed initially (on the deploy step)? Did we missconfigured the steps?
Thank you, Andrei

On Tuesday, November 8, 2016 5:48 PM, Dalmiro Grañas <tender2+dfa09df830@tenderapp.com> wrote:

#yiv9291775780 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv9291775780 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}

Hi Andrei,

I’m afraid I’m not following your last reply :(.

You have 2 “Package deploy steps” which you showed me on previous screenshot. Could you please let me know:

  1. Where would you like the step Deploy Windows Service Step to drop the files?
  2. Where would you like the step Deploy common package step to drop the files?

Try to give me a full path example including a (fake) version number so I can get a full grasp of where do you need these files to be dropped.

Thanks,
Dalmio

Hi,
We have

On Wednesday, November 9, 2016 7:38 PM, Dalmiro Grañas <tender2+dfa09df830@tenderapp.com> wrote:

#yiv4713034537 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv4713034537 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}

Hi Andrei,

It seems that we didn’t get your full last reply. Are you answering via email by any chance? If possible, try to log into http://help.octopusdeploy.com/ and answer straight from the forum instead.

THanks!
Dalmiro

Hi,

You’re right. We have 2 deploy nuget package step.

  1. Is for the service.

  2. Is for the common nuget package where we have somelibraries that is dynamic loaded when the service is started. The service isstarted in the final step of the Octopus project.

Let’s assume that:

OctopusTentacle = D:\Octopus\Applications\Test\

OctopusProjects:

            -step for OctopusProjectForService1

                            -Deploy Service1,

                            -Deploy CommonPackageStep (deploy CommmonLibrary) with custom directory outputon Service2 bin folder,

                            -Start Service1

                            

            -step for OctopusProjectForService2

                            -Deploy Service2,

                            -Deploy CommonPackageStep (deploy CommmonLibrary) with custom directory outputon Service2 bin folder,

                            -Start Service2

                            

            -step for OctopusProjectForService3

                            -Deploy Service3,

                            -Deploy CommmonLibraryStep (deploy CommmonLibrary) with custom directory outputon Service2 bin folder,

                            -Start Service3

We have this deploy CommonPackageStep because we don’twant to have direct reference between ServiceX and CommmonLibrary.

All OctopusProjects is deployed into same tentacle.

When this three octopus projects is deployed in parallelon the same tentacle this is happen for our octopus projects:

  1. OctopusProjectForService1:

             a)Service1 is drop on OctopusTentacle\Service1\1.0.3\...
    
             b)CommmonLibrary is drop firstly on OctopusTentacle\CommmonLibrary\1.2.7\... andafter that is copied into Service1 bin folder (because custom install directory feature)
    
  2. OctopusProjectForService2:

             a)Service1 is drop on OctopusTentacle\Service2\1.0.3\...
    
             b)CommmonLibrary is drop firstly on OctopusTentacle\CommmonLibrary\1.2.7_1\...and after that is copied into Service2 bin folder
    
  3. OctopusProjectForService3:

             a)Service1 is drop on OctopusTentacle\Service3\1.0.3\...
    
             b)CommmonLibrary is drop firstly on OctopusTentacle\CommmonLibrary\1.2.7_2\...and after that is copied into Service3 bin folder
    

So for the all b steps for each octopus project we haveconcurrent access issues. (When creating this folders with version_x)

What I want is to modify the initial drop folder forCommmonLibrary to have something like this

  1. OctopusProjectForService1:

             a)Service1 is drop on OctopusTentacle\Service1\1.0.3\...
    
             b)CommmonLibrary is drop firstly onOctopusTentacle\Service1\CommmonLibrary\1.2.7\... and after that is coppiedinto Service1 bin folder
    
  2. OctopusProjectForService2:

             a)Service1 is drop on OctopusTentacle\Service2\1.0.3\...
    
             b)CommmonLibrary is drop firstly onOctopusTentacle\Service2\CommmonLibrary\1.2.7_1\... and after that is copiedinto Service2 bin folder
    
  3. OctopusProjectForService3:

             a)Service1 is drop on OctopusTentacle\Service3\1.0.3\...
    
             b)CommmonLibrary is drop firstly onOctopusTentacle\Service3\CommmonLibrary\1.2.7_2\... and after that is copiedinto Service3 bin folder
    

In this way we will not have concurrent for the b steps anymore.

This is possible in octopus? And in which version?

Thank you.

Andrei Scutariu

On Wednesday, November 9, 2016 8:43 PM, Andrei Scutariu <scutariu_and@yahoo.com> wrote:

Hi,
We have

On Wednesday, November 9, 2016 7:38 PM, Dalmiro Grañas <tender2+dfa09df830@tenderapp.com> wrote:

#yiv3798062562 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv3798062562 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}

Hi Andrei,

Let me know if this setup would work for you.

Projects

Have only 1 project that contains the 3 services.

Channels

Have 4 channels with the following names:

  • Service1
  • Service2
  • Service3
  • AllServices

Steps

  • Deploy Service 1. Scoped to channels Service1 and AllServices. Runs in parallel with the other service steps

  • Deploy Service 1. Scoped to channels Service2 and AllServices. Runs in parallel with the other service steps

  • Deploy Service 3. Scoped to channels Service3 and AllServices. Runs in parallel with the other service steps

  • Deploy common Package. Scoped to Service1,Service2,Service3 & AllServices

see attached screenshot for visual reference

How will this work

Deploying to channel AllServices will deploy the 3 services at the same time. If you ever want to deploy just 1 of the services, you can just pick one of the other 3 service-dedicated channels.

I think this is a more elegant and organized solution to that scenario. Let me know what you think :slight_smile:

Dalmiro