~dricottone/huttese-apk

c2fcbab462e020ac58b3fce19e6f849fbfefaea6 — Drew DeVault 5 years ago 34681b5
Normalize builds.sr.ht init scripts
6 files changed, 57 insertions(+), 65 deletions(-)

M sr.ht/builds.sr.ht/APKBUILD
A sr.ht/builds.sr.ht/builds.sr.ht-worker.confd
D sr.ht/builds.sr.ht/builds.sr.ht-worker.init
A sr.ht/builds.sr.ht/builds.sr.ht-worker.initd
A sr.ht/builds.sr.ht/builds.sr.ht.confd
R sr.ht/builds.sr.ht/{builds.sr.ht.init => builds.sr.ht.initd}
M sr.ht/builds.sr.ht/APKBUILD => sr.ht/builds.sr.ht/APKBUILD +16 -7
@@ 1,6 1,6 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=builds.sr.ht
pkgver=0.29.6
pkgver=0.41.3
pkgrel=0
pkgdesc="sr.ht build service"
url="https://git.sr.ht/~sircmpwn/builds.sr.ht"


@@ 19,8 19,10 @@ makedepends="py-setuptools nodejs sassc go"
subpackages="$pkgname-images:_images $pkgname-worker:_worker $pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/${pkgver}.tar.gz
	builds.sr.ht.init
	builds.sr.ht-worker.init
	builds.sr.ht.confd
	builds.sr.ht.initd
	builds.sr.ht-worker.confd
	builds.sr.ht-worker.initd
"
install="$pkgname.pre-install"
builddir="$srcdir/$pkgname-$pkgver"


@@ 37,8 39,10 @@ build() {
package() {
	cd "$builddir"
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/builds.sr.ht.init \
	install -Dm755 "$srcdir"/builds.sr.ht.initd \
		"$pkgdir"/etc/init.d/builds.sr.ht
	install -Dm644 "$srcdir"/builds.sr.ht.confd \
		"$pkgdir"/etc/conf.d/builds.sr.ht
}

_images() {


@@ 54,9 58,14 @@ _worker() {
	pkgdesc="builds.sr.ht build worker"
	cd "$builddir"/worker
	install -Dm755 worker "$subpkgdir"/usr/bin/builds.sr.ht-worker
	install -Dm755 "$srcdir"/builds.sr.ht-worker.init \
	install -Dm755 "$srcdir"/builds.sr.ht-worker.initd \
		"$subpkgdir"/etc/init.d/builds.sr.ht-worker
	install -Dm644 "$srcdir"/builds.sr.ht-worker.confd \
		"$subpkgdir"/etc/conf.d/builds.sr.ht-worker
}

sha512sums="407d80a7927295fc1432a22f8497af9d290e0fcbb2a9fb414eb6de02f3f83b9361d00c12c07773302b97296996a61573cd032f5a53fdd99341e4daf6a959f268  builds.sr.ht-0.29.6.tar.gz
8eafcde30a13ca91ebea29f259eda145de4f25eefe002ffbdd279a26361a4fe9da87e7b9665d1214ccd25c3a3ae46cda795c64c79a49543d1a5eb5f72808cb4f  builds.sr.ht-worker.initd"
sha512sums="158b58618c3202dc4790fa981b6e3aa9faa2cf4a875af6d78ba46c3048dc109a9e38bb6d510ccab13a2cdbfb2c54e9c40cf53ab1a054fc64bdc95411db5e21ec  builds.sr.ht-0.41.3.tar.gz
68e4abe868cd16c00d96cc54be62272a2248333bf5ad12bb6519f976f8956bba1c3b2fd7f9d9bc87eb52fa31c9ef1f3ef1f96afccbb8f780ac470a3f2a229b3a  builds.sr.ht.confd
d48e195c72b3475bd3f070fc75e068966a686b3c51e398448c3894a4ee141e1c30f5a41b667afd924fb67dc86eea9f5552c6e9d187db065c4537dfd6fb5eb12c  builds.sr.ht.initd
5aa18804ddfee263763b035780679b98cf4877de193c254f24fab7ce56f304556af9a377bfca36635c21b4380892e8d458a420021919934080cc43feda1694c4  builds.sr.ht-worker.confd
36e22f965a824ee368fa70c2d230f337003591009eb9f64d34b56ef28d6dad626107cba12d958d22faa04886688ea4b8b92580e4aee701da7f61522aafc44c73  builds.sr.ht-worker.initd"

A sr.ht/builds.sr.ht/builds.sr.ht-worker.confd => sr.ht/builds.sr.ht/builds.sr.ht-worker.confd +5 -0
@@ 0,0 1,5 @@
# Run the daemon as this user:
# BUILDS_USER=builds

# A common extra parameter might be EXTRA_ARGS=-workers [n] where n != nproc
# EXTRA_ARGS=

D sr.ht/builds.sr.ht/builds.sr.ht-worker.init => sr.ht/builds.sr.ht/builds.sr.ht-worker.init +0 -36
@@ 1,36 0,0 @@
#!/sbin/openrc-run
name="srht-worker"
description="builds.sr.ht build worker"

# Override these with /etc/conf.d/builds.sr.ht-worker
# A common parameter might be EXTRA_ARGS=-workers [n] where n != nproc
EXTRA_ARGS=${EXTRA_ARGS:-}
LOGS=/var/log/builds.sr.ht-worker.log
BUILD_USER=builds

depend() {
	need net
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown ${BUILD_USER} "$LOGS"
	start-stop-daemon \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		-1 "$LOGS" \
		-2 "$LOGS" \
		-u "${BUILD_USER}" \
		--exec /usr/bin/builds.sr.ht-worker -- $EXTRA_ARGS
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop \
		--exec /usr/bin/builds.sr.ht-worker \
		--pidfile /run/$name.pid
	eend $?
}

A sr.ht/builds.sr.ht/builds.sr.ht-worker.initd => sr.ht/builds.sr.ht/builds.sr.ht-worker.initd +14 -0
@@ 0,0 1,14 @@
#!/sbin/openrc-run
name="builds.sr.ht-worker"
description="builds.sr.ht build worker"
supervisor=supervise-daemon
EXTRA_ARGS=${EXTRA_ARGS:-}
BUILDS_USER=builds
supervisor_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/builds.sr.ht-worker -- $EXTRA_ARGS"
command_user="$BUILDS_USER:$BUILDS_USER"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$BUILDS_USER:$BUILDS_USER"
}

A sr.ht/builds.sr.ht/builds.sr.ht.confd => sr.ht/builds.sr.ht/builds.sr.ht.confd +14 -0
@@ 0,0 1,14 @@
# Run the daemon as this user:
# BUILDS_USER=builds

# Bind the web service to this address:
# BUILDS_BIND=127.0.0.1:5000

# Extra arguments to pass to Gunicorn
# BUILDS_ARGS=

# If no, use an external postgresql server
# LOCAL_PG=yes

# If no, use an external redis server
# LOCAL_REDIS=yes

R sr.ht/builds.sr.ht/builds.sr.ht.init => sr.ht/builds.sr.ht/builds.sr.ht.initd +8 -22
@@ 1,14 1,18 @@
#!/sbin/openrc-run
name="builds.sr.ht"
description="builds.sr.ht service"

# Override these with /etc/conf.d/builds.sr.ht
supervisor=supervise-daemon
BUILDS_USER=${BUILDS_USER:-builds}
BUILDS_BIND=${BUILDS_BIND:-127.0.0.1:5000}
BUILDS_ARGS=${BUILDS_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOCAL_REDIS=${LOCAL_REDIS:-yes}
LOGS=/var/log/builds.sr.ht.log
supervisor_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/gunicorn"
command_args="buildsrht.app:app -b $BUILDS_BIND $BUILDS_ARGS"
command_user="$BUILDS_USER:$BUILDS_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net


@@ 16,24 20,6 @@ depend() {
	[ "$LOCAL_PG" = "yes" ] && need postgresql
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown $BUILDS_USER "$LOGS"
	start-stop-daemon \
		-u $BUILDS_USER \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/gunicorn -- \
			buildsrht.app:app -b ${BUILDS_BIND} ${BUILDS_ARGS}
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
	eend $?
start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$BUILDS_USER:$BUILDS_USER"
}