Docs Operate
Backups and upgrades
This page is for the administrator who runs the Phigon app for a company. When you sign in, you connect a database: a file on this computer, or your company's PostgreSQL. The app runs your company's Phigon server on that database. Everything your computers send, and every rule you set, is kept there.
Phigon's own servers keep none of this data, so backing it up is up to you.
The recovery key
When you connect a database, Phigon shows a recovery key that starts with phgr_. It holds the keys your data is protected with: the key that encrypts activity in the database, and the key that protects how computers connect.
You need it to:
- open the same data after reinstalling Phigon, or on a new computer;
- connect a second Phigon app to the same PostgreSQL database;
- restore a backup on a computer that did not make it.
Without it, a backup can still be copied, but the activity in it can't be read, and Phigon can't recover the key for you. Keep it somewhere safe, such as your company's password manager, and not in the same place as your backups: anyone with the recovery key and a copy of the database can read the data. Settings › Database › Recovery key shows it again.
Where the data on this computer lives
When you choose On this computer, the database is a SQLite file in Phigon's folder:
| System | Folder |
|---|---|
| Windows | %APPDATA%\Phigon\server\ (usually C:\Users\<you>\AppData\Roaming\Phigon\server\) |
| macOS | ~/Library/Application Support/Phigon/server/ |
That folder holds:
phigon.db, the database. While Phigon runs, recent changes can also be inphigon.db-walbeside it.backups, the copies of the database.tls, your server's certificate authority. Every connected computer pins it, and Phigon's relay names your server after it. Always keep it with the database: without it, every computer must be connected again. It holds the authority's private key, so protect it like the database.server.log, the server's log.
Settings › About › Open data folder opens it. Uninstalling Phigon keeps this folder. On Windows, the uninstaller deletes it only when you tick Also delete the company database and its backups.
Phigon deletes activity older than 30 days, and its audit log older than a year, by itself. Change this in Settings › Keep history (activity 1 to 3,650 days, audit log 30 to 3,650 days).
Backing up the data on this computer
Phigon copies the database itself while it keeps running. In Settings › Backups:
- Back up now makes a copy at once.
- Change sets how often Phigon makes one by itself (every day, the default; every week; or only when you choose Back up now) and how many copies it keeps (7 by default, 1 to 100).
- Open folder opens the
backupsfolder.
Settings shows when the last copy was made, and says why in one sentence when a copy failed, for example because the disk is almost full. Scheduled copies are made only while Phigon runs, which includes running in the tray.
Each copy is one complete database file, named after the time and the Phigon version that made it, such as phigon-copy-20261102T091500Z-1.4.0.db. Copy the whole backups folder somewhere safe, such as another disk or your company's file server. It includes a copy of the tls folder; a restore without it means connecting every computer again.
To copy the database by hand instead, quit Phigon completely first (closing the window leaves it running in the tray), then copy phigon.db with any phigon.db-wal and phigon.db-shm files beside it. Don't copy only phigon.db while Phigon runs: the newest changes may still be in phigon.db-wal.
Restoring the data on this computer
- Quit Phigon completely.
- In Phigon's
serverfolder, movephigon.db,phigon.db-walandphigon.db-shmsomewhere else. Keep them until you are sure the restore worked. - Copy the backup into the folder and name it
phigon.db. - Open Phigon.
On a new computer, or after reinstalling Phigon:
- On the old computer, if it still works, quit and uninstall Phigon. Two computers running the same Phigon server fight over its relay address.
- Install Phigon on the new computer and close it before connecting a database.
- Put the backup in Phigon's
serverfolder asphigon.db, and copy thetlsfolder (from the oldserverfolder, or from the copy inbackups) beside it. - Open Phigon and sign in with your key. At Connect your database, choose On this computer, then Restore the data on this computer with a recovery key, enter the recovery key and choose Restore and start.
Phigon checks that the recovery key matches the data before it uses it. Observers 8.10.0 or newer find the server again through the relay by themselves.
Upgrading Phigon
Phigon downloads new versions by itself and installs one when you choose Restart to update, or the next time you quit it. Settings › Check for updates automatically turns this off. When Phigon started at sign-in and nobody opened its window since, it installs the update by itself and opens again in the tray; its server stops for about a minute, and computers keep their activity meanwhile.
The first time a new version starts on the data on this computer, it makes a copy of the database before its server starts, because the new version may upgrade the database and an older Phigon can't open it afterwards. Phigon shows Backing up your data before the upgrade…; a large database can take a minute or two. It keeps the three newest of these copies, apart from your own backups.
If the copy can't be made, Phigon says why and waits. Choose Try again after fixing the problem, or Continue without a backup; without one you can't go back to the earlier version if something goes wrong.
To go back to the version before an upgrade, install that version of Phigon, then restore the copy named with the newer version's number, as in Restoring the data on this computer.
Update the observer on each computer with phigon-observer update --yes. Read about update.
PostgreSQL
When you choose Your company's database, the data is in your PostgreSQL, and Phigon doesn't copy it itself. Back it up with your usual tools or your cloud provider's snapshots. With pg_dump:
pg_dump --format=custom --no-owner \
--dbname="postgres://USER@HOST:5432/DATABASE?sslmode=verify-full" \
--file=phigon-$(date +%Y%m%d).dump
Take a backup before installing a new version of Phigon: the new version upgrades the database's tables the first time it starts. To back up first, turn off Settings › Check for updates automatically, back up, then choose Check now.
To restore, quit every Phigon app that uses the database, then restore into an empty database:
createdb --host=HOST --username=USER --template=template0 --encoding=UTF8 phigon_restored
pg_restore --no-owner --dbname="postgres://USER@HOST:5432/phigon_restored?sslmode=verify-full" \
phigon-20261102.dump
Then, in Phigon, choose Settings › Database › Change database, enter the restored database's details, and enter the recovery key when asked.
The server's certificate authority stays on the computer that runs Phigon, in its server folder's tls folder, and is not in the database. Keep a copy of it with your database backups.
Encryption and certificates
For a database on another computer, Phigon encrypts the connection and checks the server's certificate and name (verify-full) by default. If your provider uses its own certificate authority, download its CA certificate (a .pem or .crt file) and add it under CA certificate when you connect. If you see "Phigon couldn't verify your database's certificate", add that certificate, or check that the server name matches your provider's instructions.
Moving to your company's PostgreSQL
If you started with On this computer, Phigon can move everything to your PostgreSQL: every computer's history, rules, actions, Cortex conversations, enrollment codes and the audit log. Computers keep connecting with the keys they have, so none of them needs connecting again.
- Create an empty PostgreSQL database that Phigon may create tables in.
- In Settings › Database, choose Move to PostgreSQL.
- Enter the connection, with your provider's CA certificate if it gives you one, and test it.
Phigon stops its server, copies the data in small steps, counts every table in both databases, and switches to PostgreSQL only when they match. The data on this computer is not changed. If anything goes wrong, Phigon says why, starts again on the data on this computer, and Try again continues where the move stopped. The recovery key stays the same.
If an older Phigon opens a newer database
A newer version of Phigon may upgrade the database. If an older Phigon then tries to open it, it refuses to start and says:
This database was upgraded by a newer version of Phigon. Install the latest Phigon to open it.
Nothing in the database is changed. Install the latest Phigon on that computer, or restore a backup made before the upgrade.