Everything phaf needs to come back after a failure is in three places: the data folder, config.json and, if you use it, the SQL Server database. Back them up regularly and test a restore once.
What to back up
| Item | Where | Why it matters |
|---|---|---|
| Encryption key | C:\phaf\data\phaf.master_key | Without it, no stored password can be read. Keep an extra copy outside the normal backups (see below). |
| Data folder | C:\phaf\data\ | Users, security settings, workspaces and flows, certificates, shared connections, messages and — with SQLite — the database. |
| Configuration | C:\phaf\app\config.json | Data folder, port and database connection. |
| SQL Server database | Your SQL Server | Transactions, logs and audit, if you use SQL Server. Include it in your normal SQL Server backup plan. |
| IIS site | C:\phaf\iis\web.config and the certificate | The HTTPS front end. |
You do not need to back up C:\phaf\app itself: you can always reinstall it with the installer of the same version. Keep the installers of the versions you install.
The encryption key
Copy phaf.master_key once after the first start, and keep it apart from the normal backups — in a password vault or an encrypted offline medium, with access restricted to administrators. It does not change over time, so one copy is enough.
Treat the key like a password
Anyone who holds both a backup of the data folder and the key can read the passwords stored in phaf. Never store the key in the same place as the data backups without encryption.
How to back up
With SQLite
Copy the data folder with the phaf service stopped, so the database file is consistent. A daily copy usually takes seconds:
$svc = (Get-Service | Where-Object DisplayName -like 'phaf*').Name
Stop-Service $svc
$stamp = Get-Date -Format 'yyyy-MM-dd'
Compress-Archive -Path C:\phaf\data, C:\phaf\app\config.json -DestinationPath "E:\Backups\phaf-$stamp.zip"
Start-Service $svcSchedule this at a quiet hour, or include the folder in your backup software with a pre-backup step that stops the service and a post-backup step that starts it.
With SQL Server
The database is backed up by SQL Server while phaf keeps running. Back up the data folder and config.json with your file backup software; phaf does not need to stop. Take both at about the same time, so the files and the transaction history match.
How often
- Daily — data folder,
config.jsonand the SQL Server database. - After every important change — new flows, certificates or users.
- Before every upgrade — always.
- Once — the encryption key, in its separate safe place.
Keep at least 14 days of backups, or follow your own retention policy.
Restore on the same or a new server
- Prepare the server as in Requirements.
- Run the installer of the same phaf version, then stop the phaf service.
- Restore
C:\phaf\dataandconfig.json. Check thatphaf.master_keyis in the data folder. - With SQL Server: restore the database, or point
config.jsonto the restored copy. TheENC:v1:password keeps working because the key is the same. - Set the service account and the folder permissions again (The Windows service).
- Start phaf in Safe Mode the first time, to check everything before files start moving: add
"safeMode": truetoconfig.json, start the service, check flows and connections, then remove the line and restart the service.
Test it once
Restore a backup on a test server after the installation. It is the only way to know that the backup is complete and that the key matches.