Copying and Overriding Tenants
There are many reasons why you may want to clone an existing tenant. For instance, a production tenant might be duplicated for backup/restore purposes, or to populate dev and test environments. You may also want to restore a tenant to a previous state, or overwrite an existing tenant with data/assets from another tenant. In Crystallize, you have the option to do these things programmatically with the PIM API or through the Crystallize App. Here, we'll cover the necessary steps within the user interface.
Copying a Tenant in the Crystallize App
To copy a tenant, one must be a Tenant Admin. You can read more about authorization in Crystallize and managing user roles and permissions by following the links.
From the left-hand panel of buttons, choose Settings, then click on the Info label if it isn't already selected. Click the Copy Tenant button at the top right to get started.
Your options are as follows:
- Create a new tenant that is identical to the current one. In this case, specify a desired identifier and (optionally) name for the copy that will be created. A duplicated tenant may share the same name as the original tenant, but its tenant identifier must be unique.
- Override an existing tenant with this tenant's data. In this case, specify the tenant you wish to target. The override process will delete everything in the target tenant, then copy the current tenant into it.
Click the Start Duplicating button to begin the procedure. You’ll see a progress bar and status for the copy procedure. The larger your tenant is and the more there is to copy, the longer the process will take.
It's important to note that if a tenant override should fail, the target tenant will most likely not be recoverable. If you need to be able to restore the target tenant for any reason, make sure to back it up before attempting the override.
Metering for Tenant Copy
When a tenant duplication process completes successfully, you will be charged 1 API call per item/order/customer/etc. copied, and for whatever bandwidth your duplicated assets require. The billing is applied to the tenant from which you initiate the duplication procedure. Within the Crystallize App, this can be viewed from the Usage screen under Settings. Refer to the Metering Tenants page for more information.
Tenant Copy-Related Webhooks
You can (optionally) set up webhooks to subscribe to events related to tenant duplication. In Crystallize, events are fired whenever a tenant copy process has:
- Started
- Finished
- Failed
You can set up a webhook, then come up with your own way of responding to events. For instance, you could respond to a failed backup process by trying again. For more information, read about defining webhooks here.