# XWiki backup, restore and upgrade: protect database, attachments and extensions

Source: https://forgeone.solutions/en/tech/xwiki-backup-restore-upgrade-database-attachments-extensions
Language: en
Published: 2026-10-10
Updated: 2026-11-23

Testing XWiki backup and upgrade properly: database, attachments, configuration, extensions and restore acceptance.

## Introduction

This article treats backup, restore and upgrade not as an abstract concept, but as a verifiable runbook for XWiki with database, attachments, extensions and configuration.

[![XWiki logo](https://forgeone.solutions/media/xwiki-logo-preview-1200x630.png)](https://forgeone.solutions/media/xwiki-logo-preview-1200x630.png)

## Test Environment and Assumptions

The examples use neutral lab names such as wiki.example.test and xwiki01.example.test. They show real work steps but contain no production hostnames, credentials or internal paths.

- XWiki runs behind a reverse proxy with HTTPS.
- PostgreSQL is used as the database.
- Attachments and XWiki state live in a persistent directory.
- Administration is done through the XWiki UI and supplemented on the shell.

## Runbook

1. Inventory: database, permanent storage, extensions, configuration.
2. Create a consistent backup.
3. Restore into an isolated test instance.
4. Validate search, attachments, permissions, mail and extensions.
5. Upgrade only after the restore test has passed.

## What Matters Most in This Part

For backup, restore and upgrade, technical state and UI behavior must match. A command can be green while users still cannot find a page, lack permissions or have unusable search.

## Before the Change: Establish a Baseline

```bash
curl -fsS -o /dev/null -w '%{http_code}\n' https://wiki.example.test/bin/view/Main/
systemctl is-active tomcat postgresql nginx
df -h /srv/xwiki/permanent
```

## Navigation in XWiki

1. Log in and open the menu in the upper right.
2. Choose Administration.
3. First review Users & Rights, Extensions, Search and Mail on the left.
4. Then switch to the affected space and validate space permissions, pages and attachments.
5. Finally test with a normal user, not only with the administrator.

## Implementation

### Run backup and restore

```bash
install -d -m 0700 /backup/xwiki/$(date +%F)
systemctl stop tomcat
pg_dump -Fc -f /backup/xwiki/$(date +%F)/xwiki.dump xwiki
rsync -aHAX --numeric-ids /srv/xwiki/permanent/ /backup/xwiki/$(date +%F)/permanent/
rsync -aHAX --numeric-ids /etc/xwiki/ /backup/xwiki/$(date +%F)/etc-xwiki/
systemctl start tomcat
```

```bash
createdb -O xwiki xwiki_restore
pg_restore -d xwiki_restore /backup/xwiki/2026-10-10/xwiki.dump
rsync -aHAX /backup/xwiki/2026-10-10/permanent/ /srv/xwiki/permanent/
systemctl restart tomcat
```

## Step by Step: XWiki Backup, Restore and Upgrade

This workflow is intentionally written as an operational guide. The goal is not only to trigger a backup, but to prove that XWiki is usable again after restore or upgrade. Placeholders such as wiki.example.test, xwiki01.example.test and /srv/xwiki/permanent must be replaced by the real environment.

### 1. Capture system baseline

Before every backup or upgrade window, record which XWiki version is running, where data is stored and which services are involved. This baseline is the comparison point after restore or upgrade.

```bash
curl -fsS -o /dev/null -w "%{http_code}\n" https://wiki.example.test/bin/view/Main/\nsystemctl is-active tomcat postgresql nginx\nreadlink -f /var/lib/tomcat/webapps/xwiki\ndu -sh /srv/xwiki/permanent\npsql -U xwiki -d xwiki -c "select now();"
```

### 2. Check backup components

A complete XWiki backup is more than the database. If attachments, extension data or configuration are missing, the application may start but still be incomplete for users.

- PostgreSQL database: pages, rights, history and metadata.
- XWiki permanent directory: attachments, extension data, cache-related state and local files.
- XWiki configuration: xwiki.cfg, xwiki.properties, hibernate.cfg.xml and all deliberate custom files.
- Tomcat and reverse proxy configuration: context, ports, headers, TLS and upload limits.
- Operations documentation: active version, extension list, backup target, restore target and owner.

### 3. Back up the database consistently

For small environments, a maintenance window with a database dump may be enough. In larger environments, snapshots or backup agents should make sure database and permanent directory belong to the same point in time.

```bash
backup_id="$(date +%Y%m%d-%H%M%S)"\ninstall -d -m 0750 /backup/xwiki/${backup_id}\npg_dump -Fc -U xwiki -d xwiki > /backup/xwiki/${backup_id}/xwiki-db.dump\nsha256sum /backup/xwiki/${backup_id}/xwiki-db.dump > /backup/xwiki/${backup_id}/SHA256SUMS
```

### 4. Back up attachments and XWiki state

The permanent directory must match the database state. If files are uploaded during backup, use a maintenance window, snapshots or a coordinated backup method.

```bash
rsync -aH --numeric-ids /srv/xwiki/permanent/ /backup/xwiki/${backup_id}/permanent/\ntar -C /etc -czf /backup/xwiki/${backup_id}/xwiki-config.tar.gz xwiki tomcat nginx\nsha256sum /backup/xwiki/${backup_id}/xwiki-config.tar.gz >> /backup/xwiki/${backup_id}/SHA256SUMS
```

### 5. Prepare the restore target

The restore test belongs on a separate system or isolated test environment. The test FQDN must be clearly different so nobody accidentally uses production links, webhooks or mail paths.

- Same XWiki version or deliberately documented upgrade path.
- Separate database or empty schema.
- Dedicated test FQDN with its own TLS certificate.
- Mail delivery and external integrations disabled or clearly redirected in the test.
- No production user activity on the restore test system.

### 6. Restore database and files

During restore, restore the database first, then the permanent directory, then adapt configuration deliberately. Start Tomcat only after that.

```bash
systemctl stop tomcat\ndropdb --if-exists xwiki_restore\ncreatedb xwiki_restore\npg_restore -U xwiki -d xwiki_restore /backup/xwiki/${backup_id}/xwiki-db.dump\nrsync -aH --delete /backup/xwiki/${backup_id}/permanent/ /srv/xwiki/permanent/\nrestorecon -Rv /srv/xwiki/permanent 2>/dev/null || true\nsystemctl start tomcat
```

### 7. Browser acceptance after restore

Now the important part begins. A green service status is not enough. Open XWiki in the browser and test real user paths: login, pages, attachments, search and permissions.

1. Log in as local admin and open global administration.
2. Open a known page from a production-like space.
3. Download an attachment and check whether the file size is plausible.
4. Test the same page with a normal user.
5. Search for a known page title and a term inside a page.
6. Check Tomcat, XWiki, PostgreSQL and Nginx logs for new errors.

### 8. Test the upgrade on the restore system first

An upgrade should run against the restored test instance first. Then complete Distribution Wizard, Extension Manager and browser paths. Only when this workflow is stable should the upgrade move into a production maintenance window.

1. Read release notes and check extension compatibility.
2. Restore a test instance from the current backup.
3. Run the upgrade and save complete output.
4. Complete the Distribution Wizard in the browser.
5. Open Extension Manager and document incompatible extensions.
6. Test login, permissions, attachments, search and important spaces again.

### 9. Do not only claim rollback

Rollback means database state, permanent directory, webapp version and configuration fit together again. The return path must therefore be known before the production upgrade and should be exercised at least once in the test environment.

## Practical Orientation: Making Restore and Upgrade Reproducible

An XWiki backup is only reliable when a business user can work with the wiki again after restore. The test should not end when Tomcat starts successfully. Open real pages in the browser, download attachments, test search and check a page with restricted permissions.

### Minimal restore test for newcomers

For a first production-like check, use a small but complete test scope. The test should run in an isolated environment so mails, webhooks or external integrations are not triggered accidentally. Document the steps so another person can repeat them.

1. Clearly label the test URL and test system.
2. Restore database and XWiki permanent directory from the same backup point.
3. Log in as local admin and open global administration.
4. Open a page with an attachment and download the attachment.
5. Search for a page that certainly existed before the backup.
6. Check with a normal user whether permissions behave the same after restore.

### Finish the upgrade in the browser

After an XWiki upgrade, updating packages or the WAR file is not enough. XWiki often displays the Distribution Wizard or extension steps in the browser. These steps are part of the upgrade and must be completed deliberately. Only then is the application functionally valid.

After the wizard, check the homepage, Extension Manager, search, a page with macros and a page with attachments. If extensions are incompatible, this should appear in the test system and not during the production maintenance window.

### Plan rollback realistically

Rollback in XWiki is not only copying old files back. If an upgrade changed database structures or extension data, you need to know which database state, permanent storage and webapp version belong together. Every upgrade therefore needs a marked previous state.

- Record backup ID or snapshot ID before the upgrade.
- Document active XWiki version and extension list.
- Do not only describe rollback; execute it at least once in the test environment.
- After rollback, test login, attachments and search again.
- Only then approve the production maintenance window.

### What belongs in the operations runbook

- Where backup logs are stored and who reviews them.
- How long backups are retained.
- How often restore is tested.
- Which extensions are critical.
- Which business pages are always checked after restore or upgrade.

## How Completely Did We Test?

| Area | Evidence | Status |
| --- | --- | --- |
| Browser UI | Homepage, login, global administration, rights management and extension area checked. | Evidenced |
| Technical services | Tomcat, PostgreSQL, reverse proxy, internal Tomcat port and versioned release path checked. | Evidenced |
| Functional visual check | Rights matrix, admin areas, Extension Manager and public reachability checked. | Evidenced |
| Mutating tests | Restore, reindex, mail delivery or attachment upload are only performed in an agreed test space and are not claimed here. | Scope limit |

## Technical Acceptance

The result check follows the same pattern as the grommunio articles: PASS means the concrete checkpoint was actively executed and evidenced. PASS WITH CONDITIONS, SCOPE LIMIT and NOT TESTED remain visible so a backup runbook does not promise more than was actually verified.

| Area | Check | Result |
| --- | --- | --- |
| Backup scope | Database, XWiki permanent directory, configuration, reverse proxy and TLS renewal path are covered by the runbook. | PASS |
| Backup evidence | Backup artifacts, return code, target path and timestamp are documented. | PASS |
| Restore basis | Restore target system is separate from production and clearly marked as a test system. | PASS |
| Database restore | PostgreSQL dump or snapshot is restored into the test instance. | PASS WITH CONDITIONS |
| Attachments | A page with an attachment is opened after restore and the attachment is downloaded. | PASS WITH CONDITIONS |
| Permissions | An admin and a normal user check the same test page with expected permissions. | PASS WITH CONDITIONS |
| Search | Known page titles and terms return results again after restore. | PASS WITH CONDITIONS |
| Upgrade wizard | Distribution Wizard and Extension Manager are completed in the browser after upgrade. | PASS WITH CONDITIONS |
| Rollback | Backup ID, webapp version and permanent storage point in time belong together. | SCOPE LIMIT |
| Production restore | A mutating restore against production data was not performed in this public article. | NOT TESTED IN THIS PASS |

## Mandatory Tests After Restore or Upgrade

This list is the actual acceptance core. XWiki should only be released again when these points passed or are explicitly documented as not tested.

| Area | Acceptance point |
| --- | --- |
| System | Check Tomcat, PostgreSQL, reverse proxy, TLS and free storage. |
| Version | Document active XWiki version, webapp path and extension list. |
| Login | Local admin and normal user work. |
| Content | Open known page, check history and open edit mode. |
| Attachments | Download existing attachment and upload a new test attachment only in an approved test space. |
| Permissions | Test anonymous access, normal user, editor and admin separately. |
| Search | Check known page title, term inside page text and attachment name. |
| Extensions | Distribution Wizard and Extension Manager have no mandatory steps open. |
| Logs | Review Tomcat, XWiki, PostgreSQL and Nginx after the test run. |
| Rollback | Document return path including backup ID and storage state. |

## What Does PASS Mean in This Test?

PASS does not only mean that a service is running. PASS means that the browser user path works, the technical state is plausible and a second test with restricted permissions produces the expected result.

## Pitfalls

- Admin rights are assigned globally although space permissions would be enough.
- Attachments are not stored in the persistent directory.
- Backups include the database but not extensions, configuration and attachments.
- Search is not validated after restore or upgrade.
- Screenshots or documentation contain real internal hostnames.

## Final Health Check

```bash
curl -fsS -o /dev/null -w '%{http_code}\n' https://wiki.example.test/bin/view/Main/
systemctl is-active tomcat postgresql nginx
journalctl -u tomcat --since -1h --no-pager | tail -n 80
```

## Acceptance List

| Acceptance point | Expected result |
| --- | --- |
| Public URL and admin access | XWiki is reachable and administration opens with an authorized account. |
| User and group model | Groups, roles and break-glass access are documented. |
| Backup scope | Database, attachments, configuration and relevant operations files are included. |
| Restore or rollback | The return path was tested or explicitly marked as an open point. |
| Search and mail function | Search index and mail path are checked after restore or upgrade. |
| Public documentation | The article contains no real hostnames, credentials or secrets. |

## Partner Runbook: Order for Your Own Environments

1. Build lab or staging system first.
2. Then test the XWiki UI with admin and normal user.
3. Only then move SSO, permissions, backup and monitoring into production.
4. Accept every change with both browser path and shell check.

## FAQ

### Is it enough if XWiki opens in the browser?

No. Login, permissions, search, attachments, mail and backup must also be validated.

### Does every installation need SSO?

Not necessarily. In production it must be clear whether users are managed locally, through LDAP, OIDC or SAML.

### Why focus so much on restore?

Because a wiki without attachments, permissions and extensions may start after an incident but is often no longer fully usable for users.

## Result control / technical acceptance

The technical acceptance follows the same pattern as the grommunio and SUSE articles: PASS means the specific check was actively performed or clearly evidenced. PASS WITH CONDITIONS, SCOPE LIMIT and NOT TESTED remain visible so the article does not claim more than was actually verified.

| Area | Check | Expected result | Status |
| --- | --- | --- | --- |
| Backup scope | Capture database, permanent directory, configuration, reverse proxy and TLS path | Backup scope is fully documented | PASS |
| Backup evidence | Document artifacts, return code, target path and timestamp | Backup is traceably evidenced | PASS |
| Restore basis | Restore to separate test system | Production system remains unchanged | PASS WITH CONDITIONS |
| Database | Restore PostgreSQL dump or snapshot | Wiki data exists in restore system | PASS WITH CONDITIONS |
| Attachments | Download known attachment and upload only in test space | File path and permissions work | PASS WITH CONDITIONS |
| Permissions and search | Check admin, user, search index and known content | User paths work after restore or upgrade | PASS WITH CONDITIONS |
| Production restore | Restore against production data | Not performed in this public pass | NOT TESTED IN THIS PASS |

## Conclusion

XWiki becomes production-ready when technical installation, UI operation, permissions, backup and operations are tested together. That combination makes the series reproducible.

Commands are only half of the work. The decisive part is documented acceptance with real user paths in XWiki. The related XWiki series is shown directly below the article.

## Hero image

[![XWiki logo](https://forgeone.solutions/media/xwiki-logo-preview-1200x630.png)](https://forgeone.solutions/media/xwiki-logo-preview-1200x630.png)

## Author

Mathias Rumbold

## Category

- [XWiki & Knowledge Management](https://forgeone.solutions/en/tech/xwiki-backup-restore-upgrade-database-attachments-extensions?category=xwiki-wissensmanagement)

## Tags

- [XWiki](https://forgeone.solutions/en/tech/xwiki-backup-restore-upgrade-database-attachments-extensions?tags=xwiki)

## Make XWiki backup and restore reliable

ForgeOne supports a verifiable backup, restore and upgrade concept for database, attachments, configuration and extensions.

## XWiki step by step

Installation, SSO, backup, restore and operations for XWiki as a production knowledge platform.

1. [Installation of XWiki – Building a Productive Knowledge Management and Collaboration Platform](https://forgeone.solutions/en/tech/installation-of-xwiki-building-a-productive-knowledge-management-and-collaboration-platform)
2. [Operate XWiki with SSO, groups and permissions in production](https://forgeone.solutions/en/tech/xwiki-sso-groups-permissions-production)
3. [XWiki backup, restore and upgrade: protect database, attachments and extensions (current part)](https://forgeone.solutions/en/tech/xwiki-backup-restore-upgrade-database-attachments-extensions)
4. [Operate XWiki in production: monitoring, search, governance and content maintenance](https://forgeone.solutions/en/tech/xwiki-production-operations-monitoring-search-governance)

## Further content

- [Collaboration](https://forgeone.solutions/en/collaboration)
- [XWiki Confluence Migration](https://forgeone.solutions/en/products/xwiki/xwiki-confluence-migration)
- [Implementation & Migration of Your IT Infrastructure](https://forgeone.solutions/en/implementation-migration)
