mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #182] Unable to autostart the daemon (if set, key file must exist) #144
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#144
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 @A-Nicoladie on GitHub (Mar 21, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/182
Hi,
I am discovering and testing ntfy and I have a small problem:
The installation went well and after launching the service, I receive all expected notifications.
But after a reboot, the service does not start automatically 😟
It seems to be an access rights issue (maybe), but I'm not sure what's the best approach to solve this.
Here some info:
systemctl enable ntfyandsystemctl start ntfyreturn no error.sudo -H -u root bash -c '/usr/bin/ntfy serve'
sudo -H -u ntfy bash -c '/usr/bin/ntfy serve'
systemctl list-units | grep ntfy
cat /etc/ntfy/server.yml
cat -n /var/log/syslog
cat /lib/systemd/system/ntfy.service
ls -l /usr/bin/ntfy
sudo -H -u root bash -c 'ls -l /etc/letsencrypt/live/PRIVATE/privkey.pem'
sudo -H -u ntfy bash -c 'ls -l /etc/letsencrypt/live/PRIVATE/privkey.pem'
sudo -H -u root bash -c 'ls -l /etc/letsencrypt/archive/PRIVATE/privkey20.pem'
@binwiederhier commented on GitHub (Mar 21, 2022):
Hey @A-Nicoladie thanks for trying out ntfy. Yeah that looks like a permissions issue.
The ntfy systemd service runs as use
ntfyas you have already figured out, so key and cert file have to be readable by that user. There are multiple ways to solve this:1. Run ntfy behind a proxy (nginx, Apache2, caddy, ...)
If you run ntfy behind a proxy (instructions here: https://ntfy.sh/docs/config/#nginxapache2caddy), you can put all of the cert management in there and run multiple services on different subdomains as well. It's the most common approach, unless you are only running ntfy and nothing else.
In this case, you'd run ntfy on
:1234/httpor some other port (not https) and let nginx handle the SSL termination.2. Run
ntfysystemd service as root (don't do this ⛔)You can
systemctl edit ntfyand manually override theUser/Grouplike this. This way, you'll be able to read the cert no matter what.3. Copy certs to
/etc/ntfyand chown themYou can copy the cert and keyfile from
/etc/letsencrypt/...to/etc/ntfyand make sure that they are readable by the ntfy user bychown ntfy:ntfy ...them. Then also make sure that you have apost_hookin thecertbotconfig, like this:@A-Nicoladie commented on GitHub (Mar 21, 2022):
Thank you !
Copy certs work like a charm.
(Running ntfy behind a proxy seems a bit complicated for me at the moment.)
@binwiederhier commented on GitHub (Mar 21, 2022):
Glad I could help. Don't forget the
post_hook, otherwise you're gonna have a bad time in 3 months. Be kind to future-you.@A-Nicoladie commented on GitHub (Mar 21, 2022):
Yes, you right 😁
I tried to force a renewal (
certbot renew --force-renewal) to see if files changes. All is OK 😉