Storage and Backups
Protect the bot's settings and history by backing up the database with pg_dump and keeping a separate copy of the installation keyThe key that locks your secrets; back it up with the database.
The Data Volume
The container keeps everything in one data volumeThe Docker volume where all your data lives at /config. With docker run, it is the host folder you pass with -v, such as /path/to/discord-stonker-bot. Compose mounts a volume named stonker-data, and docker volume ls lists it as discord-stonker-bot_stonker-data.
| Path | What it holds |
|---|---|
/config/database/ | The PostgreSQL database, with every setting, account, token, invite pageA public page that hands out short-lived Discord invites image, job, and log |
/config/keys/ | The private key directory, with mode 0700 |
/config/keys/installation.key | The installation keyThe key that locks your secrets; back it up with the database, with mode 0600 |
Every start changes the ownership of the whole state tree to PUID:PGID; each ID must be from 1 through 60000. docker compose down keeps the volume, and only docker compose down --volumes deletes it.
Upgrading a /data Install
Mount the same host folder at /config instead of /data. Files from the old layout first appear at the same relative paths, then the start moves postgres/ to database/ and secrets/credential.key to keys/installation.key without overwriting either destination.
An unchanged old run line that mounts only /data still starts safely. Nova resolves /data as the state directory, performs the same layout migration there, and logs a warning to change the mount to /config. If current state appears in both roots, it uses /config and leaves both copies intact for manual review.
The Installation Key
The applianceOne container that holds the bot, panel, worker, and database creates the installation keyThe key that locks your secrets; back it up with the database on its first start as 64 lowercase hexadecimal characters followed by a newline. Its file mode is 0600 inside the mode-0700 keys/ folder, so only the services' user can read it. It encrypts the Bot TokenThe bot's password for Discord, from the Developer Portal, every feature secret, every authenticator appA phone app that makes six-digit sign-in codes secret, and the secret fieldsDestination setting that's saved but never shown again of every notification destinationOne place alerts go, such as a chat, topic, or inbox.
Accounts, passwords, passkeysSign in with Face ID, Touch ID, or a security key, sessions, and access tokensA key that lets your scripts call the panel's API as you don't use the key, because the panel stores hashes or public keys for them. A pg_dump backup doesn't include the key.
Keys From Version 4.0
Version 4.0 kept the key as 32 raw bytes at /config/secrets/credential.key. On the first start of a newer version, the applianceOne container that holds the bot, panel, worker, and database moves that file to /config/keys/installation.key, verifies it against the database, and atomically rewrites the same bytes in the hexadecimal format. Every saved secret keeps working, and the container log shows one Moved the installation key line.
If both files exist, startup stops without changing either one. Put the matching key at /config/keys/installation.key and remove the obsolete copy only after you have verified it. The database migration behaves the same way when both the old postgres/ and new database/ directories hold files: it stops rather than combining or overwriting them.
If the Key File Is Missing
When the key file is gone but the database holds secrets the old key encrypted, the next start makes a new key and removes those secrets. Everything else stays, including feature settings, accounts, passwords, passkeysSign in with Face ID, Touch ID, or a security key, sessions, access tokensA key that lets your scripts call the panel's API as you, and logs.
- Bot TokenThe bot's password for Discord, from the Developer Portal — The bot can't sign in until you enter the token again on the Connection page.
- Feature secrets — Webhook URLs, API keys, and signing secrets are removed, but each feature keeps its other settings, so only the secret fields need filling again.
- Authenticator appsA phone app that makes six-digit sign-in codes — Each one is turned off, the same as Turn off, along with its recovery codesA one-time backup code for when your authenticator is gone, so nobody is locked out. Its user signs in with a password or a passkeySign in with Face ID, Touch ID, or a security key, then sets the app up again on Sign-in and security.
- Notification destinationsOne place alerts go, such as a chat, topic, or inbox — Each one keeps its name, service, eventsSomething the bot can alert you about, and plain fields, but loses its secret fieldsDestination setting that's saved but never shown again, so it gets no alerts until you enter them again on Notifications.
The applianceOne container that holds the bot, panel, worker, and database writes one credential_key_replaced warning to the container log that names each removed secret. The line never appears on the Logs page.
docker logs discord-stonker-bot | grep credential_key_replaced
docker compose logs app | grep credential_key_replaced
2026-10-25T12:30:00.000Z WARN migration: credential_key_replaced message=No installation key was found at /config/keys/installation.key, so Stonker Bot for Discord made a new one. Enter the saved secrets again in the control panel.
Notification destinationsOne place alerts go, such as a chat, topic, or inbox that kept working, because they have no secret fieldsDestination setting that's saved but never shown again, also get a Saved secrets were removed alert with the same list, as described in Notifications.
When nothing depended on the old key, such as on a fresh install, there's no warning and no notice.
The Saved Secrets Notice
After a new key replaces a lost one, the control panel shows Saved secrets were removed at the top of every page, with the date the new key was made and a link for each removed secret.
- Bot TokenThe bot's password for Discord, from the Developer Portal — Enter the Bot Token opens the Connection page.
- Feature secrets — One link per feature and server, in the form
Enter the <Feature> secrets for <Server>, opens that feature in that server. - Authenticator appA phone app that makes six-digit sign-in codes — Set up the authenticator app opens Sign-in and security.
- Notification destinationsOne place alerts go, such as a chat, topic, or inbox — One link per destinationOne place alerts go, such as a chat, topic, or inbox, in the form
Set up the <Name> notification again, opens Notifications.

Everyone sees the link for their own authenticator appA phone app that makes six-digit sign-in codes. The OwnerThe first account; it can do everything and can't be removed, AdministratorsRole that can change everything, including users, and OperatorsRole that runs the bot and its features, but not users also see the Bot TokenThe bot's password for Discord, from the Developer Portal link, the notification links, and the feature links for the servers they can open, while ViewersRead-only role: sees everything, changes nothing see only their own.
- Entering a secret again — Saving the Bot TokenThe bot's password for Discord, from the Developer Portal or the feature, turning the authenticator appA phone app that makes six-digit sign-in codes back on, or saving the notification destinationOne place alerts go, such as a chat, topic, or inbox with every removed secret takes its link off the notice. Removing the destinationOne place alerts go, such as a chat, topic, or inbox takes its link off too.
- Dismiss — Hides the notice for your account only, and anything not entered again stays removed. Every other user keeps seeing the Bot TokenThe bot's password for Discord, from the Developer Portal, notification, feature, and authenticator appA phone app that makes six-digit sign-in codes links they can act on until they dismiss it too.
If the Key File Belongs to Another Database
A key file that doesn't match the database, such as one from another install, stops startup instead. The applianceOne container that holds the bot, panel, worker, and database logs migration_failed with this error, and the bot, the control panel, and the workerBackground service that runs schedules and deliveries don't start:
The installation key at /config/keys/installation.key doesn't belong to this database. Put back the key file this database was created with, or delete /config/keys/installation.key and restart to make a new key, then enter the saved secrets again.
Every start stops the same way until you put back the key file this database was created with. Deleting the key file instead makes a new one on the next start, as described in If the Key File Is Missing.
Back Up the Database
Run pg_dump inside the container and write a custom-format dump to the Docker host. It connects over PostgreSQL's Unix socket, so it needs no password.
sudo docker exec --user 1000:1000 discord-stonker-bot sh -c \
'pg_dump --host=/tmp/postgresql --username="${POSTGRES_USER:-stonker}" --dbname="${POSTGRES_DB:-stonker}" --format=custom' \
> stonker.dump
docker compose exec --no-TTY --user "${PUID:-1000}:${PGID:-1000}" app sh -c \
'pg_dump --host=/tmp/postgresql --username="${POSTGRES_USER:-stonker}" --dbname="${POSTGRES_DB:-stonker}" --format=custom' \
> stonker.dump
With docker run, use your own PUID and PGID in place of 1000:1000.
It is recommended to store the dump away from the Docker host, keep a copy of the installation keyThe key that locks your secrets; back it up with the database with the same care as a password, and test a restore before you rely on it.
Restore From a Backup
A restore needs the database dump and the installation keyThe key that locks your secrets; back it up with the database from the same applianceOne container that holds the bot, panel, worker, and database.
A new container makes its own key on its first start, while a dump restored into it brings back the old database's key check. The next start then stops with the error in If the Key File Belongs to Another Database.
- With the old key — Copy the old install's
installation.key(credential.keyfrom a version 4.0 install), or the copy you kept with the backup, over/config/keys/installation.key, then restart the container. The restored Bot TokenThe bot's password for Discord, from the Developer Portal, feature secrets, and authenticator appsA phone app that makes six-digit sign-in codes keep working. - Without the old key — Delete
/config/keys/installation.keyand restart. The start makes a new key and removes the restored secrets, and the notice lists them to enter again, as described in If the Key File Is Missing.
Network Storage
PostgreSQL expects the behavior of a local filesystem. It is recommended to keep the data volumeThe Docker volume where all your data lives on local disk and copy pg_dump backups to a NAS or other remote storage, instead of placing the live database on NFS or SMB.
Growth Over Time
The applianceOne container that holds the bot, panel, worker, and database never deletes old log entries or finished jobs, so the database grows as the bot runs. Invite pageA public page that hands out short-lived Discord invites images are the exception: saving the invite pageA public page that hands out short-lived Discord invites deletes the uploads it no longer uses.
Delete Everything
danger
docker compose down --volumes permanently deletes the database and the installation keyThe key that locks your secrets; back it up with the database.