diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..19fe58f --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.POSIX: + +PREFIX ?= /usr +GO ?= go +GOFLAGS ?= -buildvcs=false +RM ?= rm -f + +all: donation-notification + +donation-notification: + $(GO) build $(GOFLAGS) . + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f donation-notification $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/donation-notification + +uninstall: + $(RM) $(DESTDIR)$(PREFIX)/bin/donation-notification + +clean: + $(RM) donation-notification + +run: + go run -race . + +watch: + fd -e go -e tmpl | entr -rcs "go run . -config config.toml" + +lint: + fd -e go | entr -c golangci-lint run + +.PHONY: all donation-notification install uninstall clean run watch lint + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6f68e8 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +Listen for donations from paypal and stripe for charleseisenstein.org and send +an email notification. + +## deployment +```sh +doas make install +doas cp extras/openrc/donation-notification /etc/init.d +doas rc-update add donation-notification +doas rc-service donation-notification start +``` diff --git a/extras/openrc/donation-notification b/extras/openrc/donation-notification new file mode 100644 index 0000000..9765711 --- /dev/null +++ b/extras/openrc/donation-notification @@ -0,0 +1,18 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="donation-notifications" +description="Listen for donations from paypal and stripe" + +command=${command:-/usr/bin/donation-notifications} +command_background=true +command_user="donation-notifications:donation-notifications" + +pidfile="/run/${RC_SVCNAME}.pid" +output_log="/var/log/donation-notifications/output.log" +error_log="/var/log/donation-notifications/output.err" + +depend() { + need net + use dns logger netmount +}