From cb49312d467441202ff6897ab4ebad71fc7ba204 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 19 Apr 2019 14:20:34 -0400 Subject: [PATCH] Add hg.sr.ht-webhooks service --- sr.ht/hg.sr.ht/APKBUILD | 2 ++ sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init | 36 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init diff --git a/sr.ht/hg.sr.ht/APKBUILD b/sr.ht/hg.sr.ht/APKBUILD index 3f26dd1..12cc79e 100644 --- a/sr.ht/hg.sr.ht/APKBUILD +++ b/sr.ht/hg.sr.ht/APKBUILD @@ -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 diff --git a/sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init b/sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init new file mode 100755 index 0000000..f122850 --- /dev/null +++ b/sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init @@ -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 $? +} -- 2.45.2