~dricottone/huttese-apk

9107e9b759aef081ae2b99a14954ddc0971d17bd — Drew DeVault 5 years ago 2853308
Add git.sr.ht-webhooks service
M sr.ht/git.sr.ht/APKBUILD => sr.ht/git.sr.ht/APKBUILD +2 -0
@@ 16,6 16,7 @@ subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	git.sr.ht.init
	git.sr.ht-webhooks.init
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver


@@ 34,6 35,7 @@ package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/git.sr.ht.init "$pkgdir"/etc/init.d/git.sr.ht
	install -Dm755 "$srcdir"/git.sr.ht-webhooks.init "$pkgdir"/etc/init.d/git.sr.ht-webhooks
	cd gitsrht-dispatch
	install -Dm755 gitsrht-dispatch "$pkgdir"/usr/bin/gitsrht-dispatch
}

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

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

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

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

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

M sr.ht/git.sr.ht/git.sr.ht.post-upgrade => sr.ht/git.sr.ht/git.sr.ht.post-upgrade +1 -0
@@ 1,2 1,3 @@
#!/bin/sh
srht-migrate git.sr.ht -a upgrade head
gitsrht-migrate -a upgrade head