~dricottone/huttese-apk

cb49312d467441202ff6897ab4ebad71fc7ba204 — Drew DeVault 5 years ago 9107e9b
Add hg.sr.ht-webhooks service
2 files changed, 38 insertions(+), 0 deletions(-)

M sr.ht/hg.sr.ht/APKBUILD
A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init
M sr.ht/hg.sr.ht/APKBUILD => sr.ht/hg.sr.ht/APKBUILD +2 -0
@@ 17,6 17,7 @@ subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	hg.sr.ht.init
	hg.sr.ht-webhooks.init
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver


@@ 33,6 34,7 @@ package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/hg.sr.ht.init "$pkgdir"/etc/init.d/hg.sr.ht
	install -Dm755 "$srcdir"/hg.sr.ht-webhooks.init "$pkgdir"/etc/init.d/hg.sr.ht-webhooks
}

sha512sums="1594fe5b889525c05539c836594c63d7563184b646724fb3cfa0c4e7aaef0f7f61f66606081dc1ff5e9c77acf1febcbb0d6a89ce0ebf11fb58f04d0a7b6e39fb  hg.sr.ht-0.1.1.tar.gz

A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init +36 -0
@@ 0,0 1,36 @@
#!/sbin/openrc-run
name="hg.sr.ht-webhooks"
description="meta.sr.ht webhook delivery service"

# Override these with /etc/conf.d/meta.sr.ht-webhooks
HG_USER=${HG_USER:-hg}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/hg.sr.ht-webhooks.log

depend() {
	need net
	need redis
	[ "$LOCAL_PG" == "yes" ] && need postgresql
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown ${HG_USER} "$LOGS"
	start-stop-daemon \
		-u ${HG_USER} \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/celery -- \
			-A hgsrht.webhooks worker --loglevel=info
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop --exec /usr/bin/celery --pidfile /run/$name.pid
	eend $?
}