~dricottone/huttese-apk

12d1e40e378a1da1c7b75d5a4339134ec2e35660 — Drew DeVault 5 years ago f8d3e69
hg.sr.ht: normalize init scripts
6 files changed, 74 insertions(+), 67 deletions(-)

M sr.ht/hg.sr.ht/APKBUILD
A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd
D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init
A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd
A sr.ht/hg.sr.ht/hg.sr.ht.confd
R sr.ht/hg.sr.ht/{hg.sr.ht.init => hg.sr.ht.initd}
M sr.ht/hg.sr.ht/APKBUILD => sr.ht/hg.sr.ht/APKBUILD +20 -9
@@ 1,9 1,9 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=hg.sr.ht
pkgver=0.1.1
pkgver=0.9.3
pkgrel=0
pkgdesc="sr.ht mercurial service"
url="https://git.sr.ht/~sircmpwn/hg.sr.ht"
url="https://hg.sr.ht/~sircmpwn/hg.sr.ht"
arch="noarch"
license="AGPLv3"
depends="


@@ 15,9 15,11 @@ depends="
makedepends="py-setuptools nodejs sassc"
subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	hg.sr.ht.init
	hg.sr.ht-webhooks.init
	$pkgname-$pkgver.tar.gz::https://hg.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	hg.sr.ht.initd
	hg.sr.ht.confd
	hg.sr.ht-webhooks.initd
	hg.sr.ht-webhooks.confd
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver


@@ 33,9 35,18 @@ package() {
	cd "$builddir"
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/hg.sr.ht.init "$pkgdir"/etc/init.d/hg.sr.ht
	install -Dm755 "$srcdir"/hg.sr.ht-webhooks.init "$pkgdir"/etc/init.d/hg.sr.ht-webhooks
	install -Dm755 "$srcdir"/hg.sr.ht.initd \
		"$pkgdir"/etc/init.d/hg.sr.ht
	install -Dm644 "$srcdir"/hg.sr.ht.confd \
		"$pkgdir"/etc/conf.d/hg.sr.ht
	install -Dm755 "$srcdir"/hg.sr.ht-webhooks.initd \
		"$pkgdir"/etc/init.d/hg.sr.ht-webhooks
	install -Dm644 "$srcdir"/hg.sr.ht-webhooks.confd \
		"$pkgdir"/etc/conf.d/hg.sr.ht-webhooks
}

sha512sums="1594fe5b889525c05539c836594c63d7563184b646724fb3cfa0c4e7aaef0f7f61f66606081dc1ff5e9c77acf1febcbb0d6a89ce0ebf11fb58f04d0a7b6e39fb  hg.sr.ht-0.1.1.tar.gz
5138478f70bf2a0614b72ecbb5c85aafae3c8829d126e4a2f6356dde981154e407b55ab74e3724e2a17a70301fd92f8e233bd0bf0c07e047417bf7d8ea1fcf23  hg.sr.ht.init"
sha512sums="afcb5db447a71cb187bc054b51defa11474cbce52aba75979b0a1c72ddbe51bbc25c1fedc4bb10676624193e9c59a895049a9232ce0a003336474f0267934549  hg.sr.ht-0.9.3.tar.gz
23478d5e0ea9bbc8e372e3921048f0d8ee93caa690f9692b19bcbc0c58d50212e855acdf2a79624603d38287314c6c36ba27e6310d36458d0e0327e6579cf70f  hg.sr.ht.initd
0a66de1b693f6abf7fbd3f566f8afaecaf2935c5d12e5105f2727c730b1ec4d3ef05a1f147ac245bf515a7aef47409564b441b77b94f51789f91c4c7e818b453  hg.sr.ht.confd
83b25d3c08bcd4a92e28e1d14365e94108a95ef1836bdb863d753d5fdd7410cd8cddff23430bcc8bac0f35c6618d1e64f3e8fd0677dc527bc7950c0fdd1ee938  hg.sr.ht-webhooks.initd
9708a018ab7ce31772aff489c57703614ae5f24021d23e440c2d256700e91a2b481d8070895b689ea690bf6e723e52c7aa823641505ab5871f0a321d998fc858  hg.sr.ht-webhooks.confd"

A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd +8 -0
@@ 0,0 1,8 @@
# Run the daemon as this user:
# HG_USER=hgsrht

# Extra arguments to pass to celery
# HG_ARGS=

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

D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.init +0 -36
@@ 1,36 0,0 @@
#!/sbin/openrc-run
name="hg.sr.ht-webhooks"
description="meta.sr.ht webhook delivery service"

# Override these with /etc/conf.d/meta.sr.ht-webhooks
HG_USER=${HG_USER:-hg}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/hg.sr.ht-webhooks.log

depend() {
	need net
	need redis
	[ "$LOCAL_PG" == "yes" ] && need postgresql
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown ${HG_USER} "$LOGS"
	start-stop-daemon \
		-u ${HG_USER} \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/celery -- \
			-A hgsrht.webhooks worker --loglevel=info
	eend $?
}

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

A sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd +23 -0
@@ 0,0 1,23 @@
#!/sbin/openrc-run
name="hg.sr.ht-webhooks"
description="meta.sr.ht webhook delivery service"
supervisor=supervise-daemon
HG_USER=${HG_USER:-hg}
HG_ARGS=${HG_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/hg.sr.ht-webhooks.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/celery"
command_args="-A hgsrht.webhooks worker --loglevel=info $HG_ARGS"
command_user="$HG_USER:$HG_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	need redis
	[ "$LOCAL_PG" == "yes" ] && need postgresql
}

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

A sr.ht/hg.sr.ht/hg.sr.ht.confd => sr.ht/hg.sr.ht/hg.sr.ht.confd +15 -0
@@ 0,0 1,15 @@
# Run the daemon as this user:
# HG_USER=hg

# Bind the web service to this address:
# HG_BIND=127.0.0.1:5001

# Extra arguments to pass to Gunicorn
# HG_ARGS=

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

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


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

# Override these with /etc/conf.d/hg.sr.ht
supervisor=supervise-daemon
HG_USER=${HG_USER:-hg}
HG_BIND=${HG_BIND:-127.0.0.1:5001}
HG_ARGS=${HG_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOCAL_REDIS=${LOCAL_REDIS:-yes}
LOGS=/var/log/hg.sr.ht.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/gunicorn"
command_args="hgsrht.app:app -b $HG_BIND $HG_ARGS"
command_user="$HG_USER:$HG_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 $HG_USER "$LOGS"
	start-stop-daemon \
		-u $HG_USER \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/gunicorn -- \
			hgsrht.app:app -b ${HG_BIND} ${HG_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 "$HG_USER:$HG_USER"
}