Multiple Applications on target machine

I have questions on setting up target machine using tentacles. I have a target machine where two different applications are deployed under different folders. I read in octopus documentation the path of where the nuget package is deployed

C:\Octopus\Applications[Tenant name][Environment name][Package name][Package version]\

What I would like to see is

C:\Octopus\Applications[Application Name][Tenant name][Environment name][Package name][Package version]\

Basically [Application Name] before Tenant Name. So for instance if I dont use tenant name my folder structure should look like

D:[Company Name]\Applications\Application1\Stage\OrderingSite\1.1.0.0
D:[Company Name]\Applications\Application2\Stage\InvetorySite\2.1.0.0

How do I achieve this kind of application level deployment on the same target machine?

Bhavesh

Hi Bhavesh,

Thanks for getting in touch! While there is no way to change the default installation path for your applications, you can set a Custom Installation Directory. We also have some great documentation on how to configure your project to use a custom installation directory. It involves creating a custom variable named CustomWebInstallDirectory and assigning it the value you want. (Example: C:\wwwsites\testing)
You can also apply the scoping option that i mention in my other response. You can create several variables all named CustomWebInstallDirectory, they can all have different values and be scoped to different environments.

You can then look into the System variable’s that i linked in my other response. You can create your Custom Installation Directory with the System variables to make something such as the following:

#{Octopus.Tentacle.Agent.ApplicationDirectoryPath}\#{TheirApplicationNameVariable}#{if Octopus.Deployment.Tentant.Name}\#{Octopus.Deployment.Tenant.Name}#{/if}\#{Octopus.Environment.Name}\#{Octopus.Action.Package.PackageId}\#{Octopus.Package.PackageVersion}

The above will output something such as your example: (The If statement at Octopus.Deployment.Tenant.Name will only add that variable in If your deployment is tenanted)
C:\Octopus\Applications[Tenant name][Environment name][Package name][Package version]

Link to the Custom Installation Directory documentation.

I hope that helps you configure your custom directories, please feel free to let me know if you have any questions here.

Best regards,
Daniel

Thanks Daniel.

I will try out #{Octopus.Tentacle.Agent.ApplicationDirectoryPath}#{TheirApplicationNameVariable}#{if Octopus.Deployment.Tentant.Name}#{Octopus.Deployment.Tenant.Name}#{/if}#{Octopus.Environment.Name}#{Octopus.Action.Package.PackageId}#{Octopus.Package.PackageVersion} option.

Can you confirm if I can use #{Octopus.Tentacle.Agent.ApplicationDirectoryPath} as part of the value at the time of variable definition or I have to create this path dynamically and assign it to CustomWebInstallDirectory?

Also if I use CustomWebInstallDirectory; how does retention policy work? Can I still apply octopus retention policy to keep last 2 versions of app or do I have to manage it manually?

Bhavesh

Hi Bhavesh,

Thanks for getting back. Unfortunately retention policies do not clean up custom installation directory paths.

As for using #{Octopus.Tentacle.Agent.ApplicationDirectoryPath}, your question was a little bit unclear so I made some assumptions, please correct me and provide me some more information if I am wrong. :slight_smile:
You can define this when you create the CustomWebInstallDirectory or you can have it defined as a prompted variable, either way, during deployment Octopus will evaluate it to the Tentacle agent application directory.

I hope that helps, again if I am wrong about the variable questions please provide a bit more information and I would be more than happy to help. :slight_smile:

Best regards,
Daniel

Thanks Daniel for your response.

For variable definition question, I tried the solution and it works. See the attached images.

I wonder why the retention policy wouldn’t apply as the path remains the same except I am adding one folder in between?

Hi Bhavesh,

Thanks for getting back! I’m glad to hear that it works! Unfortunately, the retention policies in Octopus are pretty deeply tied into the program and designed to only delete from the default installation directory that Octopus manages. When you allow for retention from custom installation directories it can quickly become messy. While you can purge a folder before the deployment, this does not apply in your situation as you are using a new directory for each installation.

From our documentation:

Note that if you use the Custom Installation Directory feature, we will never delete from that directory during retention policies. This can be purged during deployment in the project step settings. But it is assumed this will have a working release in it.

The only way around this would be to setup your own retention policy system which involves some scripting on your end. On the tentacle machine we keep a file called DeploymenyJournal.xml which has entries for each deployment that was done, included the “Custom Installation directory” where the files were dropped. This is the file we use to know what to delete when we run retention policies, and you could also use it to create a custom script that can handle your own retention.

Hope that helps. :slight_smile:

Best regards,
Daniel

Thanks Daniel. DeploymentJournal.xml is good pointer for custom retention policy script. I can write poweshell script to delete older deployment folders and also the nuget packages from files folder.

Bhavesh

Hi Bhavesh,

Thanks for getting back! Sounds good. Feel free to get in touch in the future if you run into any further issues or have any questions. :slight_smile:

Best regards,
Daniel