From 19ae9ecb7fbd665e7d5335d4f364aa2eb70a8f2d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 20 Jul 2020 10:32:49 -0600 Subject: [PATCH] dispatch.sr.ht: overhaul init files --- sr.ht/dispatch.sr.ht/APKBUILD | 18 ++++++----- sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd | 8 +++++ sr.ht/dispatch.sr.ht/dispatch.sr.ht.init | 39 ----------------------- sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd | 24 ++++++++++++++ 4 files changed, 42 insertions(+), 47 deletions(-) create mode 100644 sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd delete mode 100755 sr.ht/dispatch.sr.ht/dispatch.sr.ht.init create mode 100644 sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd diff --git a/sr.ht/dispatch.sr.ht/APKBUILD b/sr.ht/dispatch.sr.ht/APKBUILD index 703af71..be1493c 100644 --- a/sr.ht/dispatch.sr.ht/APKBUILD +++ b/sr.ht/dispatch.sr.ht/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Drew DeVault pkgname=dispatch.sr.ht -pkgver=0.13.2 -pkgrel=1 +pkgver=0.14.5 +pkgrel=0 pkgdesc="sr.ht dispatch service" url="https://git.sr.ht/~sircmpwn/dispatch.sr.ht" arch="noarch" @@ -16,7 +16,8 @@ makedepends="py-setuptools nodejs sassc" subpackages="${pkgname}-openrc" source=" $pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz - dispatch.sr.ht.init + dispatch.sr.ht.confd + dispatch.sr.ht.initd " builddir="$srcdir/$pkgname-$pkgver" export PKGVER=$pkgver @@ -24,16 +25,17 @@ options="$options !check" install="$pkgname.post-install $pkgname.post-upgrade" build() { - cd "$builddir" python3 setup.py build } package() { - cd "$builddir" python3 setup.py install --root="$pkgdir" --optimize=1 - install -Dm755 "$srcdir"/dispatch.sr.ht.init \ + install -Dm755 "$srcdir"/dispatch.sr.ht.initd \ "$pkgdir"/etc/init.d/dispatch.sr.ht + install -Dm644 "$srcdir"/dispatch.sr.ht.confd \ + "$pkgdir"/etc/conf.d/dispatch.sr.ht } -sha512sums="3727ac71e937a2eb328b58760b6d30594afb53a331496a82d9d6d6bbdd805f9526373ad98b1d072329039dfcd2c766ead652a570dde939775b14c54b3d5c3af4 dispatch.sr.ht-0.13.2.tar.gz -e1f8d464056b903da60cabf98f87e985bb0b863f84c24d104b52063f7d8f6acb0a56abefeed83e3fc24436dd4914866e03ebb0a555770e04594a90c854afd7cb dispatch.sr.ht.init" +sha512sums="3270903bfd8995c570cda06e76b27e43bac5243fd1f2eaed9bcf35a60326b3805d8119aa287ccd03f9ca934bde58d82a00ac027fb46449683c25cb870c217b25 dispatch.sr.ht-0.14.5.tar.gz +2cb15282905d56d6b17f5aed032b15d98da64c9ec315db4650e0729398a9ea4d9704a57e3b7f55e1c5381914f7fe5e85b58e4e88e9e68fcab89ef1763e377278 dispatch.sr.ht.confd +a3b7f73aa99c428e8cacd823d39c1fa472746b237887c2e69b9fc53600d9148944e8a89b6af050c9f1114e148ff06f343f495e89d704b470596955ae57fe4378 dispatch.sr.ht.initd" diff --git a/sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd b/sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd new file mode 100644 index 0000000..38b98a6 --- /dev/null +++ b/sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd @@ -0,0 +1,8 @@ +# Run the daemon as this user: +# DISPATCH_USER=meta + +# Bind the web service to this address: +# DISPATCH_BIND=127.0.0.1:5005 + +# Extra arguments to pass to Gunicorn +# DISPATCH_ARGS= diff --git a/sr.ht/dispatch.sr.ht/dispatch.sr.ht.init b/sr.ht/dispatch.sr.ht/dispatch.sr.ht.init deleted file mode 100755 index 019f71e..0000000 --- a/sr.ht/dispatch.sr.ht/dispatch.sr.ht.init +++ /dev/null @@ -1,39 +0,0 @@ -#!/sbin/openrc-run -name="dispatch.sr.ht" -description="dispatch.sr.ht service" - -# Override these with /etc/conf.d/dispatch.sr.ht -DISPATCH_USER=${DISPATCH_USER:-dispatch} -DISPATCH_BIND=${DISPATCH_BIND:-127.0.0.1:5005} -DISPATCH_ARGS=${DISPATCH_ARGS:-} -LOCAL_PG=${LOCAL_PG:-yes} -LOCAL_REDIS=${LOCAL_REDIS:-yes} -LOGS=/var/log/dispatch.sr.ht.log - -depend() { - need net - [ "$LOCAL_REDIS" = "yes" ] && need redis - [ "$LOCAL_PG" = "yes" ] && need postgresql -} - -start() { - ebegin "Starting $name" - touch "$LOGS" - chown $DISPATCH_USER "$LOGS" - start-stop-daemon \ - -u $DISPATCH_USER \ - -1 "$LOGS" \ - -2 "$LOGS" \ - --background \ - --make-pidfile \ - --pidfile /run/$name.pid \ - --exec /usr/bin/gunicorn -- \ - dispatchsrht.app:app -b ${DISPATCH_BIND} ${DISPATCH_ARGS} - eend $? -} - -stop() { - ebegin "Stopping $name" - start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid - eend $? -} diff --git a/sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd b/sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd new file mode 100644 index 0000000..f38053c --- /dev/null +++ b/sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd @@ -0,0 +1,24 @@ +#!/sbin/openrc-run +name="dispatch.sr.ht" +description="dispatch.sr.ht service" +supervisor=supervise-daemon +DISPATCH_USER=${DISPATCH_USER:-meta} +DISPATCH_BIND=${DISPATCH_BIND:-127.0.0.1:5005} +DISPATCH_ARGS=${DISPATCH_ARGS:-} +LOGS=/var/log/dispatch.sr.ht.log +supervise_daemon_args="-1 $LOGS -2 $LOGS" +command="/usr/bin/gunicorn" +command_args="dispatchsrht.app:app -b $DISPATCH_BIND $DISPATCH_ARGS" +command_user="$DISPATCH_USER:$DISPATCH_USER" +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + need net + use redis + use postgresql + use pgbouncer +} + +start_pre() { + checkpath -f "$LOGS" -m 644 -o "$DISPATCH_USER:$DISPATCH_USER" +} -- 2.45.2