Tenant From Tenant To

Hi,

I’m not sure if what I’m asking is possible but is there a way I can use two tenants in a single runbook with a to and from?

Basically the scenario is we would like to take a database backup from tenant 1 and restore it to tenant 2.
Both tenants have their own defined variables on where the database server is and what the database name is.

Any help would be greatly appreciated.
Thank you,
Dave Schmitz

Hi Dave,

Thank you for reaching out. In a nutshell, yes that is possible, but you have to do some magic to get it to work.

You’ll need three runbooks.

  1. Create backup (and scrub it?) for Tenant A
  2. Restore backup of Tenant A to Tenant B
  3. Orchestration runbook leveraging the run a runbook step template.

The run a runbook step allows you to pass in a tenant name. I did that for our spin-up process to create multiple EC2 workers in AWS across regions (each tenant is a region because AWS has different AMIs, VPCs, etc per region).

https://samples.octopus.app/app#/Spaces-102/projects/core-iac/operations/runbooks/Runbooks-105/process/RunbookProcess-Runbooks-105

That step template also allows you to send in prompted variable values.

My thinking is the runbook that creates the database backup does so to a secure location but with a common naming convention. \mysecureshare\databasebackups[tenant name].bak

Then the restore runbook uses that same naming convention (and accepts the tenant from as a prompted variable) to restore it.

I hope that helps!

Best regards,
Bob Walker

Bob,

I like the idea of the 3 runbook idea. The part I’m a bit confused on is Tenant A and Tenant B both have variables such as database server, database name, etc. How would orchestrator runbook know to pass Tenant A to runbook 1 and Tenant B to runbook 2.

Thank you,
Dave Schmitz

Hi Dave,

Apologies, I wasn’t clear on the orchestrator runbook.

The orchestrator runbook would either run as no tenant:

Or run with a specific tenant (most likely the tenant from):

The run a runbook step template requires you to pass in a tenant name to run against. You can either provide a hardcoded tenant name:

The deployment tenant name:

Or provide a variable

If I were setting this up, I’d probably configure the orchestrator project to run under the tenant from tenant. When calling the backup runbook, send the name of the tenant being run as.

Then for the tenant to, make that a prompted variable (Prompted variables - Octopus Deploy)

I hope that helps!

Best regards,
Bob Walker