GitAudience keeps everything in one PostgreSQL database, gitaudience: every project, its stargazers, enrichments, notes and settings, the users and the GitHub Apps. A backup is a dump of that database plus the .env file of the instance. Backups are yours to run: GitAudience never copies your data anywhere.
Warning
The secrets of your GitHub Apps are encrypted with SECRET_KEY. A dump restored with another key keeps all your data, but the worker can’t use the Apps until you disconnect and reconnect each one. Keep a copy of .env with your dumps, off the server.
Backing up
backup.sh ships with the deployment files. With the reference compose.yaml running, from the directory that holds it:
./backup.sh /var/backups/gitaudience
The script runs pg_dump inside the postgres container, so the dump always matches the server’s PostgreSQL version. It writes one file per run:
/var/backups/gitaudience/gitaudience-20261201T030000Z.dump
- The file uses
pg_dump’s custom format and is readable by its owner only (mode 600). It holds personal data about your stargazers: store it accordingly. - The directory defaults to
./backupswhen you give none. - The database password is read inside the container. It never appears on a command line, in the output or in the file.
- Two runs in the same second write two separate files.
The script finds the container of the postgres service in the compose project gitaudience. Two variables change its defaults:
| Variable | Default | Use |
|---|---|---|
POSTGRES_CONTAINER | the postgres service of the compose project | Name or ID of the PostgreSQL container, when the script can’t find it or finds several. |
GITAUDIENCE_DB_NAME | gitaudience | The database to dump. Letters, digits and _ only. |
To back up every night, add a line to the server’s crontab, for example:
0 3 * * * cd /opt/gitaudience && ./backup.sh /var/backups/gitaudience
Then copy the dumps somewhere other than the server, and delete old ones on your own schedule: the script keeps every file it writes.
Note
Copying the files of the gitaudience_pg_data volume while PostgreSQL runs does not give a backup you can restore. Use backup.sh or pg_dump.
Restoring
Restore into an empty database, on the same PostgreSQL major version, before GitAudience starts on it: a first start of migrate on an empty database creates a new, empty schema.
On a new server, or after docker compose down -v, with your .env in place (same SECRET_KEY):
Start PostgreSQL alone
docker compose up -d postgresOn an empty volume, PostgreSQL creates the database and its single application owner
gitaudience, usingPOSTGRES_PASSWORD.Restore the dump
docker exec -i gitaudience-postgres-1 sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" \ pg_restore --host=127.0.0.1 --username=gitaudience --dbname=gitaudience \ --no-owner --no-privileges --exit-on-error' < gitaudience-20261201T030000Z.dumpReplace
gitaudience-postgres-1with the namedocker compose psgives for thepostgrescontainer. The single quotes keep$POSTGRES_PASSWORDfor the container, which already knows it.Start GitAudience
docker compose up -dmigratechecks database ownership, applies missing migrations and closes access by PUBLIC before API and worker start. If this is a pre-v1 dump using tag0000_init, follow the explicitmigrate --adopt-initprocedure in Upgrading before starting; a different initial SQL hash is refused.
Sign in and open a project to check your data. If you restored with a different SECRET_KEY, go to Settings › GitHub Apps, click Disconnect on each App, then connect the account again: the projects and their data stay, and attach to the new App. The old App stays on GitHub until you uninstall or delete it there; its secrets can no longer be read.
What a backup doesn’t hold
.env:SECRET_KEY,POSTGRES_PASSWORD. Generate one randomPOSTGRES_PASSWORDand oneSECRET_KEY(32 random bytes in base64). KeepSECRET_KEYwith your backups.- The agent side: the MCP connection and the sub-agent files on your team’s machines. They are rebuilt from the console, in Settings › MCP agent.
- The result of the limit check, which is never stored. GitAudience checks again after the restore.