I would like to bootstrap my ntfy users, to avoid having to make a backup of the auth.db file. This involves creating each user with the CLI before starting the main ntfy process. Unfortunately, doing this on a fresh server throws the error auth-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 run ntfy serve at 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_USER and NTFY_PASSWORD), creating this user if it is supplied. Alternatively, providing a CLI (sub)command to create the auth.db file (other than running ntfy serve and 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.
I would like to bootstrap my ntfy users, to avoid having to make a backup of the
auth.db
file. 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 serve
at 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_USER
andNTFY_PASSWORD
), creating this user if it is supplied. Alternatively, providing a CLI (sub)command to create theauth.db
file (other than runningntfy serve
and 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