Wiki source code of Instance Cloning

Last modified by Eleni Cojocariu-testing account on 2026/08/21 15:47

Show last authors
1 Cloning an XWiki instance means making a full, independent copy of it: an instance that serves the same content while keeping its own identity. A common case is copying a live instance into a preproduction environment, to test changes before they go live.
2
3 The base procedure is a [[Backup and Restore>>doc:documentation.xs.admin.backup.WebHome]] of the database and the [[permanent directory>>documentation.xs.admin.configuration.directories.permanent-directory.WebHome]], which together hold everything the instance contains. What that copy cannot do on its own is tell apart what belongs to the wiki from what identifies //this// instance in //this// environment. [[Clone an XWiki Instance>>documentation.xs.admin.backup.instance-cloning.clone-instance.WebHome]] covers both halves.
4
5 Every instance has an [[id of its own>>documentation.xs.dev.instance.get-instance-id.WebHome]], stored as the single row of the ##xwikiid## database table. Restoring that row would hand the source's identity to the target, so the table is left out of the restore.
6
7 This id can also be relevant for licensing, if applicable. For example, [[paid extensions>>https://store.xwiki.com/xwiki/bin/view/Main/]] have their licenses issued against an instance id, so licenses restored with the database do not apply to the target instance, which instead reloads its own licenses from the store.
8
9 A domain name, a mail server, the address of a third-party service: these describe the environment rather than the wiki, and they live in two places that behave differently when cloning. ##xwiki.cfg## and ##xwiki.properties## are [[configuration files>>documentation.xs.admin.configuration.WebHome]], so no database restore touches them. They have to be copied from the source and then reviewed, because any of their uncommented settings may name the source's environment.
10
11 Everything else is in the database and comes back holding the source's values: the "Alias" property of the ##XWiki.XWikiServerXwiki## page, which is the domain name the wiki answers on, and the settings of every extension that connects to an external service, for example, the [[mail sending>>extensions:Extension.Mail.MailApplication]] settings.
12
13 The [[external identities>>documentation.xs.admin.authentication.user-profiles-external-identities.WebHome]] an identity provider recorded on the user profiles are copied with them, which is what you want when both instances authenticate against the same provider. When the target uses a different one, returning users are given a second, empty profile, and its own [[authentication>>documentation.xs.admin.authentication.WebHome]] settings are not enough to prevent that, hence [[Preserve User Profiles When Cloning to a Different Identity Provider>>documentation.xs.admin.backup.instance-cloning.preserve-user-profiles-different-identity-provider.WebHome]].

Get Connected