Backup and disaster recovery for HAPI FHIR starts with what the server actually stores
When a HAPI FHIR server must be recovered after an outage, corruption or a failed upgrade, the first question is what has to come back. The JPA server keeps resource data in a relational database, not in files on the application server. The database is therefore the core of any backup, but it is not the whole job. The JPA server is a Java application that runs as a Docker image, a WAR on an application server, or a Helm deployment on Kubernetes, and the operator must be able to rebuild that exact version with its configuration. A backup that restores rows but not the matching application image, application.yaml settings, interceptor code and search parameter configuration will leave the team guessing which version of the server the data belongs to.
The starter defaults to an embedded H2 database, which is suited to evaluation and not to production recovery planning. For production, the supported databases named in the starter documentation are PostgreSQL and Microsoft SQL Server, and MySQL is not supported. Your backup tooling, retention rules and restore runbook should be written for the database you actually run. Ask your team to confirm the exact database version, the backup method (logical dump, physical or point-in-time recovery) and where backups are stored, because each choice changes how a restore is performed. If the deployment stores binary or attachment content in a separate storage system, that storage must be included in the same recovery point, or documents and the database references to them will drift apart after a restore.
Plan the backup scope before go-live, before any schema migration and whenever recovery time and recovery point objectives are agreed with the business. A snapshot taken immediately before a schema migration is the minimum safeguard, and it only has value if it is restored and checked in a separate environment first. Record the server version, Java version, container image digest, configuration files and the list of search parameter and partition settings alongside each backup set. Confirm with your application owners how long clinical and administrative data may be unavailable and how much recent data could be lost, because those answers determine backup frequency, replication and restore testing, and they should be written down before an incident rather than during one.
Backup options and when each fits
This table compares logical dumps, physical or snapshot backups and continuous archiving for the database behind a HAPI FHIR JPA server, along with configuration and image versioning. Read each row against the restore granularity and consistency you need across the database, binary storage and configuration, and treat the effort column as a prompt to measure in your own environment rather than a fixed estimate.
| Option | Restore granularity | Consistency across database and files | Operational effort and when it fits |
|---|---|---|---|
| Logical dump (pg_dump, SQL Server export) | Whole database, or individual schemas and tables when the dump format allows selective restore | Captures the database only. Binary storage and configuration must be backed up separately and matched to the same point in time | Low to moderate. Suits small or non-production instances and copies for test restores, but dump and restore duration grows with data volume |
| Physical or snapshot backup (file-level copy, storage or volume snapshot) | Whole instance or volume. Restoring a single table or resource type usually needs a separate restore and extraction step | Strong only when the database is quiesced or the snapshot is crash-consistent for the database and binary files together. Confirm this with your storage vendor and DBA | Moderate. Fits production clusters on managed storage, but snapshot coordination across database and file storage needs documented runbooks |
| Continuous archiving (PostgreSQL WAL archiving with point-in-time recovery, SQL Server log backups with full recovery model) | Any point in time within the retention window, provided the base backup and log chain are intact | Good for the database alone. Still needs the matching binary storage snapshot or copy for the same recovery point | Highest. Requires log shipping or archive storage, retention rules and regular restore tests. Confirm the feature set with your PostgreSQL or SQL Server edition |
| Configuration backup (Helm values, environment variables, properties files, secrets references) | Per release or per change, applied to a specific server version | Must match the database schema version and the HAPI FHIR version that wrote the data | Low, but easy to neglect. Store in version control and record the image tag used with each backup set |
| Image versioning (container image tag or digest, WAR artifact, JDK version) | Exact server build that can read the restored schema | Needed so that a restored database starts on the same HAPI FHIR and JDK line it was written with. Check the upgrade notes before moving to a newer version | Low. Keep pinned digests or tags alongside each backup and confirm the JDK requirement for your release, for example JDK 17 for HAPI FHIR 8.2.0 |
How to set up backups that restore a working FHIR server
This sequence produces a backup set of the database, binary storage and configuration taken at one point in time, copied outside the failure domain, and proven by a restore that starts the server and answers a FHIR read and search.
Inventory every component the server depends on
Your platform team lists each piece the HAPI FHIR JPA server needs to answer requests: the relational database (PostgreSQL or Microsoft SQL Server in production, since the starter defaults to an embedded H2 database), any binary or attachment storage, the deployed WAR or container image version, the JDK, application configuration such as application.yaml and environment variables, secrets, TLS certificates, the reverse proxy and any search parameter or implementation guide packages you have loaded. Record where each item lives and who owns it. The step is done when the list is reviewed by the database owner and the application owner and every item has a named backup method or an explicit reason it needs none. Confirm with your vendor or DBA which database features your version supports for consistent snapshots.
Choose and document the database backup method
The database backup is the anchor for the whole set, so pick its method first. Options typically include logical dumps, physical base backups with continuous archiving for point-in-time recovery, and storage-level snapshots if your platform provides them. Confirm with your DBA that the chosen method can restore to a chosen time and that retention meets your recovery objectives, which your organization must set. Document the tool, schedule owner, storage target and restore command. The step is done when a written runbook exists and a DBA has signed off on the method, including how the database and the binary store will be captured at the same moment.
Capture binary storage and configuration at the same point
Database rows and external binary content must match, or restored resources will point at files that do not exist. Coordinate the database backup with a snapshot or copy of binary storage so both reflect one moment, either by pausing writes briefly or by using a storage method that supports consistent snapshots across both systems. Back up configuration, deployment manifests, Helm values, secrets references and certificates in version control or a secrets manager, and tag them with the application version. The step is done when a single backup job labeled with one timestamp produces all three artifacts and the manifest lists each file with its checksum.
Store copies outside the failure domain
A backup stored on the same disk, cluster or cloud account as the server does not survive the failure it is meant to cover. Copy each backup set to a separate location, such as another site, another account or offline storage, under encryption with keys held separately. Restrict delete permissions so a compromised admin account cannot remove the only copy, and keep audit logs of access. Because backups contain patient data, apply the same access controls and data handling rules as production. The step is done when a copy exists in a location your recovery plan names, and someone other than the operator can list and read it.
Schedule backup jobs and alert on failure
Put the database dump or base backup, the binary copy and the configuration export on a schedule that matches your recovery objectives, and set retention rules for daily, weekly and long-term copies. Configure the scheduler to fail loudly: alert on job errors, missed runs, backup size that drops sharply, and copies that are older than expected. Send these alerts to the team that can act on them, not only to a log file. The step is done when a test failure triggers an alert to the on-call channel and a missed run is detected without manual checking.
Restore to an isolated environment
Restore the newest backup set into a separate environment with no route to production clients or production databases. Restore the database first, then the binary storage, then the configuration, using the runbook from the earlier step. Record the elapsed time and any manual intervention, because those are the inputs your recovery objectives depend on. The step is done when every artifact restores without error and the restored checksums match the manifest.
Verify the restored server answers FHIR requests
Start the HAPI FHIR JPA server against the restored database and binary storage, using the restored configuration and the same application version as the backup. Confirm the application starts without schema errors and that the health endpoint reports ready. Then run a FHIR read of a known resource by its logical ID and a FHIR search on a known search parameter, and check that the returned resource content, version and count match values recorded before the backup. If a resource references binary content, read that content too. The step is done when both requests return the expected results and the outcome is logged with the backup timestamp. Repeat this check on a schedule, not only once.
Back up before every schema migration
Before any HAPI FHIR upgrade or database change that alters the schema, run a full backup set through the same process and verify it with a restore check. Keep that backup until the upgraded server has run long enough to show the changes are stable, as your change process defines. Record the migration, the backup identifier and the rollback steps in the change ticket. The step is done when the pre-migration backup has passed the restore check and the rollback procedure has been written down and confirmed by the database owner.
How the database, storage and configuration backups fit together
The diagram starts at the HAPI FHIR JPA server running in the primary environment, which reads from three sources: the relational database, the binary storage location for attachments, and the configuration source. A single consistency point marks where all three are captured together, so the copies describe the same moment. The trust boundary sits where backup copies leave the primary environment for the backup target. Check that a restore path rebuilds the server in a fresh environment from those copies, and that the three pieces still match after restore.
Database, binary storage and configuration captured at one consistency point, then restored to a fresh environment.
Setting recovery point and recovery time objectives for a FHIR server
The recovery point objective (RPO) and recovery time objective (RTO) for a HAPI FHIR server should be agreed by the business and clinical owners of the data before anyone chooses a backup tool or schedule. The RPO is the most data loss, measured in time, that the organization can accept after an incident. The RTO is the longest the FHIR API can stay unavailable before clinical workflows, interfaces or patient-facing apps are harmed. Neither number is a technical setting, and neither should be set by the platform team alone. Set both from your own risk assessment, with clinical safety and privacy officers in the room, and write the agreed values into the service documentation so they can be tested later.
Once the objectives exist, they drive the design. A tight RPO means the backup schedule alone will not be enough, so you need to decide whether the PostgreSQL or SQL Server database gets continuous archiving or log shipping, and whether writes that arrive between full backups can be recovered. A tight RTO means a warm standby database and a tested procedure for pointing the application at it, while a looser RTO may allow a restore from a recent backup onto new infrastructure. Binary storage has its own clock: attachments and large payloads must be captured at a point consistent with the database, so confirm with your storage vendor how snapshots or replication align with database backups. Ask each vendor and your own operations team to state, in writing, the recovery time they expect for each component.
Check the objectives against what the platform can actually do before you commit to them. The HAPI FHIR JPA server starter defaults to an embedded H2 database, which is not a production choice, so the RPO and RTO you can meet depend on the production database you select, and the HAPI FHIR JPA server introduction is the place to confirm the database-backed architecture. Run a tabletop exercise that walks a realistic data loss event through your chosen design and records the actual elapsed time for each step. If the exercise shows a gap, the fix is either a design change or a formal decision by the owners to accept the gap in writing.
Restore tests that prove the backup works
A backup that has never been restored is an assumption, not a control. The tests below each prove a different part of recovery, and none of them proves everything on its own. Run them against the database, binary storage and configuration together, and record what each test covered and what it left out.
Full restore to an isolated environment
Restore the complete set (database, binary storage and the configuration used at backup time) into a separate network segment with no route to production systems or live identity providers. Start the JPA server against the restored data and confirm it boots, connects to the database and serves a capability statement. This proves the backup set is internally consistent. It misses load behavior, the true recovery time under real volume, and any dependency on production secrets that were not included in the backup.
Point-in-time restore rehearsal
If the database supports point-in-time recovery, pick a target time inside the retention window, restore to it and compare resource counts and recent version history with what was known at that moment. Time the rehearsal from start to a working server, because that duration is your practical recovery time. This proves the log chain is intact. It misses whether binary files written after the target time are reconciled with the restored rows, so check that as a separate step.
Configuration-only rebuild
Rebuild the deployment from version-controlled configuration, container image tags and secret references, without restoring any data. Confirm that the same JPA server version, Java runtime and database settings come back exactly as recorded. This proves the deployment can be recreated from code and documentation. It misses data entirely, so it cannot show that a restored database and the rebuilt server agree on schema version.
Partition-scoped partial restore
If partitioning is in use, restore a single partition to a scratch database and verify that its resources and search results match the source, without touching other tenants or regions. Confirm that resources in the restored partition do not reference identifiers that exist only in other partitions. This proves that tenant data can be recovered in isolation. It misses any cross-partition references that break when only part of the data set returns, so document those dependencies before the test.
Post-restore search and validation check
After any restore, run a fixed set of searches, read operations and validation requests that match known records, and compare results with an approved baseline. Include searches on search parameters that were recently changed, since search indexes may need rebuilding. This proves the restored server answers correctly, not just that it starts. It misses records no one thought to query, so keep the baseline list under review and expand it after each incident.
Taking a backup before every HAPI FHIR schema migration
A verified backup must exist immediately before every HAPI FHIR upgrade or schema change, because the JPA server migrates the database in place and a failed migration can leave data in a state that the previous server version cannot read. The backup is only useful if it captures the database, the binary storage used for attachments and the server configuration as one set taken at the same point in time. A database dump taken on Tuesday and a configuration file from Friday do not describe the same server. Record the exact HAPI FHIR version, the JDK version, the starter image or WAR tag, and the configuration file contents alongside the backup, so the restore target can be rebuilt to match. The release for the version you are moving to is the source for migration requirements, including any required database steps, and you should confirm them there rather than relying on memory of an earlier release.
The upgrade content group covers the version-by-version steps, and this section does not repeat them. Before you start, confirm in the target release notes whether the migration is reversible, whether the previous server version can read a database that has already been migrated, and whether any batch or reindex job must complete first. Those answers decide your rollback path. If the migration fails before it writes to the schema, you may be able to redeploy the previous version against the same database. If it fails partway through a schema change, the safe path is usually to restore the pre-migration backup into a clean database and point the previous version at it. Write that decision down before the window opens, with a named owner and a time limit after which the team stops trying to fix forward. Also confirm that the backup you took can actually be restored in a test environment, since an untested backup is not a rollback plan.
Protecting backups that contain patient data
A HAPI FHIR backup holds the same patient records as the live server, so it needs the same protection. The cards below cover the controls that should wrap every database dump, binary store and configuration copy, from encryption and key handling to retention and restore logging.
Encrypt backups at rest and in transit
Every copy of the PostgreSQL or SQL Server database, the binary storage and the configuration should be encrypted before it lands in a backup store, and every transfer to that store should use encrypted channels. Check whether your backup tool encrypts natively or whether you need to add encryption in a separate step. Confirm that encryption covers snapshots and replicas as well as primary backup files, since those copies are easy to forget.
Manage keys separately from backups
Store backup encryption keys outside the backup store itself, in a key management service or secrets platform you control. If the same credential opens both the live server and the backup repository, a single compromise exposes both. Document who can release a key, how keys are rotated, and how you will still decrypt older backups after a rotation. Losing the key is as damaging as losing the backup.
Restrict who can reach backup stores
Apply the same least-privilege model to backup repositories that you apply to the FHIR server. Limit write access to the backup job's service account and read access to a named restore group. Keep administrative access to backup storage separate from day-to-day database administration where your team size allows it. Review these grants on a fixed schedule and after staff changes.
Align retention and deletion with policy
Backup retention is not a technical default to accept. Set retention periods with your privacy, legal and records teams, and define how deleted or corrected patient data is handled in older backups. Confirm whether your policy requires purging individual records from backups or only expiring whole backup sets, and document the answer. Expired backups should be destroyed, not just left in cold storage.
Log every restore and backup access
Record who started a restore, which backup set was used, where it was restored to and who approved it. Restores copy PHI into an environment that may have weaker controls, so treat that event as a reportable access. Keep these logs in a location the backup administrators cannot edit. Confirm that your audit logging covers the backup tool and the storage layer, not only the FHIR server.
Do not rely on FHIR security layers
HAPI FHIR provides building blocks such as the AuthorizationInterceptor, consent interceptors and BALP audit logging, but it does not provide one complete security layer, and those interceptors do not protect a database dump. A backup file bypasses every interceptor in the application. Treat backup controls as a separate control set, reviewed by the same people who review the live server.
HAPI FHIR security docsBackup and recovery questions teams ask before hiring help
What does it cost to set up backup and recovery for a HAPI FHIR server?
Cost depends on how much of the work your team keeps and how much a partner takes on. The main components are discovery of the database, binary storage and configuration, backup design, restore runbooks, restore testing and handover. Setup effort is mostly one-time, while backup storage, monitoring of backup jobs and periodic restore tests recur. Effort rises with database size, the number of storage locations, the number of environments and the number of systems that must be restored together. Ask for a quote that lists each component as a separate line, states what is one-time and what recurs, and names the environments in scope. DeployOpen does not publish a price list, and the quote follows from the written scope.
How long does a HAPI FHIR restore test take to plan?
Planning length depends on how many components must come back together and how well they are documented. Planning covers the database, the binary storage that holds attachments and other large content, the server configuration and the container or deployment definition. It also covers which copy is restored, where the restore runs, how data is checked afterwards and who signs off. Teams with a clear inventory and an existing backup job usually plan faster than teams that must first find out where data lives. Ask the partner to confirm the planning steps and the dependencies on your side before agreeing a timeline in writing.
What must our internal team provide before a backup project starts?
The internal team provides access and decisions. The main inputs are:
- Read access to the PostgreSQL or Microsoft SQL Server instance behind the JPA server, plus the backup tooling already in use
- Details of the binary storage location, its size, retention settings and access model
- Copies of the deployment configuration, including the Helm values, Docker Compose files or application server settings
- Change windows for test restores and any planned schema migrations
- A named owner for the recovery time objective and another for the recovery point objective
The RTO and RPO owners must be people who can accept the trade-offs in writing, because those targets decide backup frequency, storage design and restore steps.
Can we build HAPI FHIR backup and recovery ourselves with our existing database tools?
Often yes, if your team already runs backups for the same database engine. Database-level backups and point-in-time recovery are handled by standard database tooling, so the gap is usually the link to everything else. A HAPI FHIR server stores data in the database, but binary content, configuration and container definitions live elsewhere, and a restore is only usable when they match. Check whether your current tooling covers all three, whether a restore has been tested end to end, and whether the team can run that restore without the original author. The HAPI FHIR JPA server documentation at the JPA server introduction is a useful starting point for understanding the database-backed design.
How often should HAPI FHIR restore tests run?
Restore tests should run on a fixed schedule and also before any high-risk change. Schedules are set by the recovery objectives the business has agreed, the rate of change in the data and the risk appetite of the owners. Good triggers include a scheduled interval agreed by the owners, a database engine or HAPI FHIR version change, a schema migration, a change to storage or retention settings, and any incident that touched backups. Each test should record what was restored, how long it took, which checks passed and which steps needed manual work. Ask the partner how results are recorded and how failed tests are retested.
Should we take a backup before every HAPI FHIR schema migration?
Yes. A schema migration changes the database in ways that can be hard to reverse, so a verified backup taken immediately before the change is the minimum safety step. The backup should be consistent with the binary storage and configuration version in use, and a restore of it should be tested before the migration is relied on. Check the upgrade notes for the target release, and see the versions page for Java requirements, because a rollback may also involve reverting the runtime. Ask the partner to include a pre-migration backup step and a rollback runbook in the scope.
What should we ask a partner for in a fixed-scope backup quote?
Ask for a written scope that names every system covered and every system excluded. Useful items to request are:
- A list of the database, binary storage, configuration and deployment components in scope, with the environments for each
- Deliverables such as backup design, runbooks, restore test reports and handover sessions
- The restore test plan, including success criteria and how data is verified after restore
- Assumptions about access, change windows and internal owners, with the actions if they are not met
- Which costs are one-time and which recur, including retesting and ongoing support if you want it
A fixed-scope quote should also state how changes to scope are priced and approved.
How DeployOpen scopes and delivers HAPI FHIR backup and recovery
DeployOpen plans backup and recovery for a HAPI FHIR server as one system, covering the relational database, binary storage and server configuration together. The work runs inside infrastructure you control, and the written scope sets which environments, data stores and recovery targets are included before any build starts.
How we scope
- Inventory the PostgreSQL or Microsoft SQL Server database, binary storage, server configuration and secrets that a restore would need.
- Agree recovery point and recovery time objectives for each environment with your business and clinical owners before choosing tooling.
- Confirm which environments are in scope, including production, staging and any partitioned data, in a written scope before work starts.
How we build
- Design backup jobs that capture database and binary storage at matching points, so a restore never mixes mismatched data sets.
- Set up backups that run before every schema migration, with a documented rollback path tied to the HAPI FHIR upgrade plan.
- Configure retention, encryption and access controls for backup copies, aligned with the access model you already run.
How we hand over
- Deliver a runbook covering restore steps, dependency order, owners and the decision points for a partial or full restore.
- Run restore tests in a non-production environment and document measured results against the agreed objectives.
- Provide a written record of configuration, schedules and test evidence that your compliance and security teams can review.
How we support
- Offer ongoing support, periodic restore testing and updates to backup procedures as the server and its database change.
- Available as a retainer after handover, with scope and frequency agreed in writing.
- Confirm with DeployOpen during scoping which recovery tests and reviews your retainer will include.

