A sr.ht/hub.sr.ht/APKBUILD => sr.ht/hub.sr.ht/APKBUILD +40 -0
@@ 0,0 1,40 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+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"
A sr.ht/hub.sr.ht/hub.sr.ht.confd => sr.ht/hub.sr.ht/hub.sr.ht.confd +14 -0
@@ 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
A sr.ht/hub.sr.ht/hub.sr.ht.initd => sr.ht/hub.sr.ht/hub.sr.ht.initd +25 -0
@@ 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"
+}
A sr.ht/hub.sr.ht/hub.sr.ht.post-install => sr.ht/hub.sr.ht/hub.sr.ht.post-install +3 -0
@@ 0,0 1,3 @@
+#!/bin/sh
+addgroup -S hub || true
+adduser -HSD -h / -s /sbin/nologin -G hub -g hub hub || true