~dricottone/huttese-apk

f90215b9bc19ed83ea4cd0ea8062bc7623afa3fc — Drew DeVault 5 years ago 204a142
Add dispatch.sr.ht APKBUILD
A sr.ht/dispatch.sr.ht/APKBUILD => sr.ht/dispatch.sr.ht/APKBUILD +40 -0
@@ 0,0 1,40 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=dispatch.sr.ht
pkgver=0.8.5
pkgrel=0
pkgdesc="sr.ht dispatch service"
url="https://git.sr.ht/~sircmpwn/dispatch.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-cryptography
	py3-gunicorn
	py3-pygithub
	py3-srht
	py3-yaml
"
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
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver
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 \
		"$pkgdir"/etc/init.d/dispatch.sr.ht
}

sha512sums="0f084c3fb0c5f12162488827f908d46f797f4d1b68c7c3ed518b05d1b88c929956e91e8c7209e3741eb06c46e5d015ea457e3da848591af8cdcec05ac63f1fcd  dispatch.sr.ht-0.8.5.tar.gz
404793faf26acf5ca905475c24aa36d9ba5a8e1ea7fc65e2898ac999e2034e65b36f0a1e59decb874634011efb24de908d740cc3d4ceeff61326eeb79397c278  dispatch.sr.ht.init"

A sr.ht/dispatch.sr.ht/dispatch.sr.ht.init => sr.ht/dispatch.sr.ht/dispatch.sr.ht.init +37 -0
@@ 0,0 1,37 @@
#!/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:5000}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/dispatch.sr.ht.log

depend() {
	need net
	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}
	eend $?
}

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

A sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-install => sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-install +3 -0
@@ 0,0 1,3 @@
#!/bin/sh
addgroup -S meta || true
adduser -SDH -s /sbin/nologin -g meta meta || true

A sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-upgrade => sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-upgrade +2 -0
@@ 0,0 1,2 @@
#!/bin/sh
metasrht-migrate -a upgrade head