mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1190] Bootstrap user when starting docker container #839
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#839
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Cheezzhead on GitHub (Sep 26, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1190
I would like to bootstrap my ntfy users, to avoid having to make a backup of the
auth.dbfile. This involves creating each user with the CLI before starting the main ntfy process. Unfortunately, doing this on a fresh server throws the errorauth-file does not exist; please start the server at least once to create it. As far as I can see, the only way to create this auth-file is to runntfy serveat least once, kill the server and then restart. This seems... not ideal.When it comes to the ephemerality (if that's a word) of docker containers, it is common practice to bootstrap users in this way; for example, official docker database images such as postgres allow you to define a user with environment variables to be created on startup.
Following those standards, the best way to solve this would be to add similar environment variable functionality (e.g.
NTFY_USERandNTFY_PASSWORD), creating this user if it is supplied. Alternatively, providing a CLI (sub)command to create theauth.dbfile (other than runningntfy serveand then forcefully killing it once) would also be beneficial. I don't know which of these is easier, I guess it depends on where/how the auth file is created in the internal code.Also it's entirely possible that there is already such a method and I haven't looked closely enough.
compose.yml
bootstrap_users.sh
@fiveangle commented on GitHub (Jan 6, 2025):
Fully agree. In fact, I am struggling to find a list of all docker compose environment variables available so that I can perform ALL configuration in the docker-compose file, as customary in all my centrally-managed container deployments. The documentation at first alludes that all confiuration must be done in the offline server.yaml config file. Then as you read the docs, it is revlealed piecemeal that more configuration can be performed in the docker compose file, but there is no comprehensive list that I've been able to find in the repo. I'll keep digging...
@wunter8 commented on GitHub (Jan 6, 2025):
@fiveangle here's a list of the config options: https://docs.ntfy.sh/config/#config-options
NTFY_CONFIG_FILE is missing from the table (just by accident, not intentionally). If anything else is missing from the table, it's probably safe to assume it follows the same naming conventions (e.g., make the server.yml param uppercase, prepend "NTFY_", convert dash to underscore)
You can also see all these env variables listed in the output of
ntfy server --help@binwiederhier commented on GitHub (Jul 31, 2025):
This will be fixed with the next release, see https://docs.ntfy.sh/config/#access-control