Add makefile and openrc init
This commit is contained in:
parent
31f27c5092
commit
273d02f4e1
3 changed files with 62 additions and 0 deletions
34
Makefile
Normal file
34
Makefile
Normal file
|
|
@ -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
|
||||
|
||||
10
README.md
Normal file
10
README.md
Normal file
|
|
@ -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
|
||||
```
|
||||
18
extras/openrc/donation-notification
Normal file
18
extras/openrc/donation-notification
Normal file
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue