Defining variables in a multi-tenant world

Machine in Bathtub

This post is a part of our Octopus 3.4 blog series. Follow it on our blog or our twitter feed.

Octopus Deploy 3.4 has shipped! Read the blog post and download it today!


Multi-tenant deployments in Octopus 3.4.0 add a new dimension to the Octopus experience. It enables deploying releases to multiple customers in a safe and repeatable way which was previously a bit awkward to do.

One of the important features we had to consider when designing multi-tenant deployments is how to handle custom variables for tenants. If you imagine a SaaS (Software as a Service) web app that can be customised for multiple customers, there are numerous variables that need to be specified per customer or tenant. There are common customer-specific details that need to change such as website names, titles/headers, image/logo URLs and contact information as well as technical details like server names and database connection settings. Our solution for this is Variable Templates. Variable templates allow you to specify which variables are required to successfully deploy a project to a tenant. They can be defined on a project or a library variable set and we interpret them in a slightly different way depending on where they are defined.

Project variable templates

Defining a variable template in a project means the variable can have a different value for each environment the tenant is connected to. This is a great way to manage technical settings like a database connection string or other environment-specific details. Tenant-specific project variable template values are managed on the tenant variables page under the 'Project Variables' tab.



Library variable templates

Defining a variable template in the library means the variable will have a constant value for that tenant, regardless of project and environment. Tenant specific library variable template values are managed on the tenant page under the 'Common Variables' tab.

Missing Variables

We also warn you if a tenant is missing any required variables and help you fix them quickly and easily.

Project variables and library variable sets

It's worth mentioning that while variable templates enable you to manage required tenant-specific variables, it's still possible to define 'normal' variables in projects and library variable sets and scope then appropriately. Octopus 3.4 introduces the ability to scope variables to tenant tags as well.

Tenant-variable snapshots

Finally, it's important to note that tenant-specific variables are not snapshotted. When you create a release in Octopus, we take a snapshot of the deployment process and the current state of the project-variables, however we do not take a snapshot of tenant-variables. This enables you to add new tenants at any time and deploy an existing release to them. Further, this means you can make changes to tenant-variables and immediately deploy them. This removes the need to need to create a new release and deploy it through numerous environments before making it to production.


For more information, I highly recommend reading our multi-tenant deployment guide and pay special attention to the Working with tenant-specific variables page.


Tagged with: New Releases
Loading...