Restore an XWiki Instance
Steps
To bring an XWiki instance back from a backup, on the server it came from or on a new one:
- Install the XWiki version the backup was taken from, and upgrade afterwards rather than restoring into a newer version.
- Stop the servlet container.
- Restore into the web application the files you copied out of it: WEB-INF/hibernate.cfg.xml, WEB-INF/xwiki.cfg, WEB-INF/xwiki.properties, WEB-INF/classes/logback.xml, WEB-INF/observation, the JDBC driver in WEB-INF/lib and any skin under skins.
- Restore the permanent directory to the location the restored xwiki.properties names.
- Restore the database with the command of your database.
- Recreate the database user that the restored hibernate.cfg.xml authenticates with, if the database server is a new one, with the password that file holds.
- Update the reverse proxy configuration if the instance now answers on a different host name or address, and reload the proxy.
- Start the servlet container.
- Open the wiki in a browser. It serves the content the backup holds, and the "Administration" reports the version installed in the first step.
FAQ
The instance answers on a new address. What else has to change?
The database brings back the settings that named the old environment, starting with the "Alias" of the wiki descriptor. Clone an XWiki Instance goes through them.
The server's address changes on every boot. Can the reverse proxy be updated automatically?
Yes. The only value that has to follow the address is the proxy's server_name (see NginX Server Key Configurations) so a boot script that reads the address from the cloud provider's instance metadata and rewrites that one directive is enough. Anchor the substitution to the server_name line: a plain search-and-replace of the old value also hits the proxy_pass target, which must keep pointing at the local application server. Validate with nginx -t before reloading, so a bad rewrite cannot take the site down.
Can I restore over a running instance?
No. The servlet container has to be stopped first, otherwise XWiki keeps writing to the files and the database while they are being replaced.
Does the restore bring back the instance id?
Yes, the whole xwikiid table comes back with the database. That is what a repaired server wants and what a clone does not, which is why Clone an XWiki Instance leaves that table out.