Skip to content

Data and backups

Your queues and jobs stay in Redis. Everything Bullship keeps for itself is in one data directory: /data in the image, ~/.bullship otherwise, or BULLSHIP_DATA_DIR.

File Holds
auth.db Accounts, sessions and API token hashes
alerts.db Alert rules, destinations and alert history
audit.db The activity log, 90 days
history.db Metrics history
connections.json Connections added in the app, once there are any
redaction.json The redaction list, once an admin has saved it
auth-secret The session signing secret, unless BULLSHIP_AUTH_SECRET is set
secret-salt The salt BULLSHIP_SECRET_KEY is stretched with, when that is set

Every file Bullship writes there is readable only by its own user (0600, SQLite’s -wal and -shm files included), and it sets files already there to 0600 at start. If other users can open the directory itself, as a hand-made ~/.bullship or a bind-mounted ./data often allows, Bullship warns at start; chmod 700 it. The .db files are SQLite, through the node:sqlite module built into Node, in WAL mode.

Bullship also writes two small hashes per queue into your Redis, shared by everyone on that connection: bullship:errors:<prefix>:<queue> for resolved and muted error types, and bullship:settings:<prefix>:<queue> for who set a global limit from Bullship and when.

Copy the .db files with SQLite’s .backup command while Bullship runs, or stop Bullship and copy the whole directory.

The image has no sqlite3, so run the backup from a throwaway container that mounts the same volume:

mkdir -p backup
docker run --rm -v bullship-data:/data -v "$PWD/backup":/backup alpine sh -c '
apk add -q sqlite &&
for f in auth alerts audit history; do sqlite3 /data/$f.db ".backup /backup/$f.db"; done &&
cp /data/auth-secret /backup/ &&
cp /data/connections.json /data/redaction.json /data/secret-salt /backup/ 2>/dev/null; true'

With BULLSHIP_SECRET_KEY set, saved connection URLs and alert destinations can be read only with both the key and secret-salt. Back up secret-salt with the data directory, and keep the key with the backup but not inside it.

Stop Bullship, put the files back in the data directory, make them owned by Bullship’s user (uid 1000 in the image) and start it.

When a file is damaged, Bullship stops at start and names the file. Restore it, or move it aside to start without what it held. A data directory Bullship can’t write stops it the same way.

A container that loses its data directory loses its accounts, and the next visitor could create the admin account again. The image declares VOLUME /data, but a volume Docker makes on its own has no name and isn’t reused by the next container, so mount a named volume or a directory.