cyphernode icon indicating copy to clipboard operation
cyphernode copied to clipboard

E-mail notifications on events

Open Kexkey opened this issue 5 years ago • 7 comments

Have a way to send e-mails (to the admin) triggered on events.

For example:

  • Spending hot wallet balance is below a certain amount
  • Error in logs (excluding debug traces)
  • A docker container restarted
  • Etc.

This should be implemented inside its own container that all the other containers can use/call.

Kexkey avatar Feb 02 '19 18:02 Kexkey

would running postfix in a docker work for this? need a different mailer?

wiredcheetah avatar Mar 14 '19 12:03 wiredcheetah

I would suggest considering implementing generic notifications system which would log notifications locally into a file by default. I would bet some project like this already exists.

And then implementing e-mail as one of possible backends for delivering notifications. I personally would like to see keybase as another possible way how to consume notifications (a keybase bot posting into a group channel or sending messages directly into a 1-1 chat).

darwin avatar Apr 08 '19 19:04 darwin

Just did a bit of googling and I think we need something like:

  • https://github.com/elastic/logstash
  • https://github.com/fluent/fluentd

And use existing email plugin or write our own (e.g. I would do one for the keybase integration)

Both projects look quite heavy-weight and enterprise-y to me. Would be nice to have something lightweight, simple, docker-friendly and extensible with shell scripts (which means extensible by anything shell can call).

darwin avatar Apr 08 '19 19:04 darwin

Hi darwin! Thanks for joining in! I like the approach of having something like a "Notification MQ" that can be picked up by whatever we plug-in (like an e-mailer, SMS sender, slack bot or whatever). It is a very nice idea and decoupled architecture.

Would you take that challenge? What part of it are you willing to take? The keybase integration? Let me think about how we would go about it and in the meantime let me know if you want to contribute.

Kexkey avatar Apr 08 '19 20:04 Kexkey

Yes, I think this could be a good task for me to start contributing.

I can implement whole notification subsystem. And provide email and keybase as initial "output plugins".

You should maybe decide what existing technology to use (if any). Since you already have everything based on docker, maybe simple filtering of docker logs could be enough for our needs. And services would communicate events by printing to stdout. I would just implement a system of plugins which would implement triggers/actions. But as I said I don't want to be reinventing the wheel here, so I'm not afraid of using existing tools. Personally I'm leaning to use simple unix-y/shell tools when it makes sense.

Think about it with other project maintainers and give me some specs. No hurry.

darwin avatar Apr 08 '19 20:04 darwin

Hi @darwin ! I added the broker and notifier components to Cyphernode as well as publishing/subscribing functionalities.

The broker is a lightweight pub/sub implementation called Eclipse Mosquitto (https://mosquitto.org/). Right now, the notifier is the only subscriber and it receives requests to call back URLs when something happens (for example, when a Bitcoin address receives a payment or when an OTS stamp is confirmed/upgraded). Current publisher for the callbacks is the proxy.

Anyway, I think the notifier should be the central piece that would take care of the notifications. Right now only the HTTP/S requests are supported, but we can easily add any other types of notifications.

The notifier is pretty straight forward. It can be rewritten in another language and made richer.

BTW the publish/subscribe mechanism may replace the http communication between cyphernode's components.

Kexkey avatar Jun 29 '19 18:06 Kexkey

Thanks for the report. I'm going revisit Cyphernode in a week or two. Will look into this.

darwin avatar Jun 30 '19 22:06 darwin