From e3c386882b3ef0f7b2c930c2813486f486718a72 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 29 Apr 2020 09:09:01 -0400 Subject: [PATCH] hub.sr.ht: new aport --- sr.ht/hub.sr.ht/APKBUILD | 40 ++++++++++++++++++++++++++ sr.ht/hub.sr.ht/hub.sr.ht.confd | 14 +++++++++ sr.ht/hub.sr.ht/hub.sr.ht.initd | 25 ++++++++++++++++ sr.ht/hub.sr.ht/hub.sr.ht.post-install | 3 ++ 4 files changed, 82 insertions(+) create mode 100644 sr.ht/hub.sr.ht/APKBUILD create mode 100644 sr.ht/hub.sr.ht/hub.sr.ht.confd create mode 100755 sr.ht/hub.sr.ht/hub.sr.ht.initd create mode 100644 sr.ht/hub.sr.ht/hub.sr.ht.post-install diff --git a/sr.ht/hub.sr.ht/APKBUILD b/sr.ht/hub.sr.ht/APKBUILD new file mode 100644 index 0000000..9d920d5 --- /dev/null +++ b/sr.ht/hub.sr.ht/APKBUILD @@ -0,0 +1,40 @@ +# Maintainer: Drew DeVault +pkgname=hub.sr.ht +pkgver=0.1.0 +pkgrel=0 +pkgdesc="sr.ht hub service" +url="https://git.sr.ht/~sircmpwn/hub.sr.ht" +arch="noarch" +license="AGPLv3" +depends=" + py3-srht + py3-gunicorn +" +makedepends="py-setuptools nodejs sassc go" +subpackages="${pkgname}-openrc" +source=" + $pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz + hub.sr.ht.initd + hub.sr.ht.confd +" +builddir="$srcdir/$pkgname-$pkgver" +export PKGVER=$pkgver +options="$options !check" +install="$pkgname.post-install" + +build() { + python3 setup.py build +} + +package() { + python3 setup.py install --root="$pkgdir" --optimize=1 + mkdir -p "$pkgdir"/etc/init.d + install -Dm755 "$srcdir"/hub.sr.ht.initd \ + "$pkgdir"/etc/init.d/hub.sr.ht + install -Dm644 "$srcdir"/hub.sr.ht.confd \ + "$pkgdir"/etc/conf.d/hub.sr.ht +} + +sha512sums="b7228ea201ca911626c484af55e9ca300652366d8f7bfa9d0bb9af1a63d0c7f78c7b849a562f69d6117b63cca5ad074a109a83f249c748d9e2ae24b65ab8613b hub.sr.ht-0.1.0.tar.gz +49b89a85f8a72cfded331bff5fd4891ee2f5b930d01334a63d04fc3cc4974d2595c78e38afa2b66ed49b9704adcb7dfa9bd95e6c1c502e11e7e141bbb1fb0c3c hub.sr.ht.initd +2edd92290b68b5f2a18e3ba24d63ec673aec16f38c020c1f627dc5d92cfa746d14acc4191f33b27cc471e772520e5a5da23e503d64a8f4ad6357fc9f44d15bb2 hub.sr.ht.confd" diff --git a/sr.ht/hub.sr.ht/hub.sr.ht.confd b/sr.ht/hub.sr.ht/hub.sr.ht.confd new file mode 100644 index 0000000..12b587f --- /dev/null +++ b/sr.ht/hub.sr.ht/hub.sr.ht.confd @@ -0,0 +1,14 @@ +# Run the daemon as this user: +# HUB_USER=hub + +# Bind the web service to this address: +# HUB_BIND=127.0.0.1:5014 + +# Extra arguments to pass to Gunicorn +# HUB_ARGS= + +# If no, use an external postgresql server +# LOCAL_PG=yes + +# If no, use an external redis server +# LOCAL_REDIS=yes diff --git a/sr.ht/hub.sr.ht/hub.sr.ht.initd b/sr.ht/hub.sr.ht/hub.sr.ht.initd new file mode 100755 index 0000000..6103740 --- /dev/null +++ b/sr.ht/hub.sr.ht/hub.sr.ht.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +name="hub.sr.ht" +description="hub.sr.ht service" +supervisor=supervise-daemon +HUB_USER=${HUB_USER:-hub} +HUB_BIND=${HUB_BIND:-127.0.0.1:5014} +HUB_ARGS=${HUB_ARGS:-} +LOCAL_PG=${LOCAL_PG:-yes} +LOCAL_REDIS=${LOCAL_REDIS:-yes} +LOGS=/var/log/hub.sr.ht.log +supervise_daemon_args="-1 $LOGS -2 $LOGS" +command="/usr/bin/gunicorn" +command_args="hubsrht.app:app -b $HUB_BIND $HUB_ARGS" +command_user="$HUB_USER:$HUB_USER" +pidfile="/run/${RC_SVCNAME}.pid" + +depend() { + need net + [ "$LOCAL_REDIS" = "yes" ] && need redis + [ "$LOCAL_PG" = "yes" ] && need postgresql +} + +start_pre() { + checkpath -f "$LOGS" -m 644 -o "$HUB_USER:$HUB_USER" +} diff --git a/sr.ht/hub.sr.ht/hub.sr.ht.post-install b/sr.ht/hub.sr.ht/hub.sr.ht.post-install new file mode 100644 index 0000000..94be2e1 --- /dev/null +++ b/sr.ht/hub.sr.ht/hub.sr.ht.post-install @@ -0,0 +1,3 @@ +#!/bin/sh +addgroup -S hub || true +adduser -HSD -h / -s /sbin/nologin -G hub -g hub hub || true -- 2.45.2