~dricottone/huttese-apk

17867a8ba8f5a7b19dbf1d994e1b4695e42d2195 — Drew DeVault 5 years ago 75f9a76
Add webhooks init script to meta.sr.ht
2 files changed, 41 insertions(+), 1 deletions(-)

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


@@ 39,7 40,10 @@ package() {
	cd "$builddir"
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/meta.sr.ht.init "$pkgdir"/etc/init.d/meta.sr.ht
	install -Dm755 "$srcdir"/meta.sr.ht-webhooks.init \
		"$pkgdir"/etc/init.d/meta.sr.ht-webhooks
}

sha512sums="3f6559de738796ea522fff2ed1aa592bbae4ba56f59535fb66885deb832b5189fd023b108a63427e94128cd5dc71491c76d1e0104b51f20f758bd3fa89168c16  meta.sr.ht-0.9.8.tar.xz
c149ba165ce153a13f55ce4b46427e6a7f7dc97ce7bbd776e6d56255b90edb52cc02f80c83e59dd11a67efd1ef0fe9e2a2812ca171d215df15513a1ca60ba597  meta.sr.ht.init"
c149ba165ce153a13f55ce4b46427e6a7f7dc97ce7bbd776e6d56255b90edb52cc02f80c83e59dd11a67efd1ef0fe9e2a2812ca171d215df15513a1ca60ba597  meta.sr.ht.init
2f002245a570ae7e51063f488e5199cb34de71762d1fdf0605463923a02b6d81d20c7bc5777f6c984b2f58906b0378fe53b456d76f56a06ec865db1e3923d8c8  meta.sr.ht-webhooks.init"

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

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

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

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

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