Copy tenant-specifc files from Octopus to target while deploying

support

(Rob Bell) #1

Hi there!

I’m creating a multi-tenanted deployment configuration of octopus.app for a client.

I have a requirement that we copy over a few files, of which one is a license file, per tenant+environment (so Tenant A would have a set of files for a Staging environment, then another for a Production environment).

Is there a way for me to add upload these files to Octopus then include them in a deployment step to be copied to the target?


(Colin Pear) #3

Are you guys in Azure? One solution off the top of my head would be put the files in blob storage and then add a step to retrieve them via a power shell script.

Another option would be to upload a package (zip file) to the built in nuget feed and add a package deployment step that references the package.

Colin Pear
Principal Software Architect
Clear Measure


512-298-1232


(Daniel Fischer) #4

Hi Rob,

Thanks for getting in touch! There are a few options available I believe, depending on what you need to deploy here.

One options is as @Colin_Pear has suggested, package them separately and add them to the deployment with some scoping per tenant/environment. However, this method does not scale very well and can get little messy.

So my questions is this. What parts of the license file change per Tenant/Environment?

Octopus has the ability to automatically substitute variables inside files. On top of that, Octopus is also able to have Tenant specific variables.

For example, if most of the license format is the same between each Tenant and you only need to change a unique string between Tenants, Octopus could automatically perform this action for you.

You could specify a Tenant specific variable to hold the license values that need to change between Tenants (Say #{LicenseVar} as an example). In your license file, you could replace the section of license which requires changing at deployment time with the variable #{LicenseVar}.

In your project you are able to create a Variable Template and specify the value type as Sensitive/Password box (If you do not want the license values to be read by unauthorised users or output in logs.)

From here, any Tenant connected to the Project with the Variable Template will have a variable box for each Environment. If you need a different value per Environment and Tenant, you have the ability do specify that here. (See screenshot)

Project abc is connected to Tenant-A for Environments Dev & Test. It has a single Variable Template. #{LicenseVar} with a default value which can be anything you want.

This means I can have a single license file for my deployment and Octopus will automatically substitute the variable inside it just after extraction, before being copied wherever it needs to go.

The documentation on this subject which I have linked to above has a lot more detailed information.

Let me know if this is not an option or if you have any further question here. I would be happy to help however I can.

Best regards,
Daniel


(Rob Bell) #5

Hi guys - thank you so much for your replies, especially the detail in yours Daniel - much appreciated.

Ultimately I’ve ended up going down the line of Colin’s suggestion. The license and config files have a lot of variables in them, and there is already a system in place for generating these files. With Azure File Storage we were able to use a file system link as an output for this system, sparing any integration effort on that side. As part of a Web App deployment, a custom build script copies the relevant files from Azure Storage using PowerShell into the temp/staging folder on the tentacle (or octopus.app host in this case), and these were successfully copied to the Web App during deployment.

Cheers,

Rob


(Daniel Fischer) #6

Hi Rob,

Thanks for the update! I’m glad to hear you have this working. (Thanks for the input @Colin_Pear!)

If you have any further questions here or run into any more issues, do not hesitate to get in touch. :slight_smile:

Best regards,
Daniel