~dricottone/huttese-apk

51e82ccf0a352bac4ac638e094ace61127785088 — Drew DeVault 5 years ago db2ecc8
git.sr.ht: normalize init scripts
6 files changed, 71 insertions(+), 65 deletions(-)

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


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


@@ 34,11 36,20 @@ package() {
	cd "$builddir"
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/git.sr.ht.init "$pkgdir"/etc/init.d/git.sr.ht
	install -Dm755 "$srcdir"/git.sr.ht-webhooks.init "$pkgdir"/etc/init.d/git.sr.ht-webhooks
	install -Dm755 "$srcdir"/git.sr.ht.initd \
		"$pkgdir"/etc/init.d/git.sr.ht
	install -Dm644 "$srcdir"/git.sr.ht.confd \
		"$pkgdir"/etc/conf.d/git.sr.ht
	install -Dm755 "$srcdir"/git.sr.ht-webhooks.initd \
		"$pkgdir"/etc/init.d/git.sr.ht-webhooks
	install -Dm644 "$srcdir"/git.sr.ht-webhooks.confd \
		"$pkgdir"/etc/conf.d/git.sr.ht-webhooks
	cd gitsrht-dispatch
	install -Dm755 gitsrht-dispatch "$pkgdir"/usr/bin/gitsrht-dispatch
}

sha512sums="48d41ed22e4ba785366016c2044904eb2a2ab0e24f21660b2b262acce3e1f4bc04f36b2340f2344b924592e271c8e8ab67e76b472b0f5a1fbb8afe6f30f6b5b0  git.sr.ht-0.22.1.tar.gz
53d7ecb4456ea5d95afb40d483b6c2feff23543bff0493e14a94a914db4092986ab2fa1e25c6a9478fd7507b9719ef6d214f69f33cd681d756e1d1e5a5db4295  git.sr.ht.init"
sha512sums="771a34eeac9290dde4edc4398a33a43b18cb15fd0d577e741ae54540ecf480104888f8fc15304e5e57554556ed035a45b19f4043b7c37d30245b7e6e99d398e9  git.sr.ht-0.28.3.tar.gz
64ecc7fccf6706b9d732e6f3e1016e4f6f8f076de9c1e920c41d81c7e2ecf74c0a9de1be0d2d789da1b438a06cbf09075ea35d795c1bf9140d4414e0e273bf7a  git.sr.ht.initd
be83df46e7375266fed0e153cd800843568027f0de984c84eb67603b891ae793b1fdd4a04e8e5fbb45e74f4624e58f3cdd70d34edd646394119af5d1e17dcae1  git.sr.ht.confd
e500817c8ff10b42e40853c81c373d86dba7bcec299c62a7dc1c8259a9ca437960fb7b774d9bb92dc824356a1d1d8257e300883af9f660295ef868527358c73d  git.sr.ht-webhooks.initd
8c3365c8f175c901fc0958cb02ca4f1cede282314c904276663800b8be79ff2b2f3bfbd934adfa56f8948dced73de76427fe7703c909a6e5e055d5a164dc17b9  git.sr.ht-webhooks.confd"

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

# Extra arguments to pass to celery
# GIT_ARGS=

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

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

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

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

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown ${GIT_USER} "$LOGS"
	start-stop-daemon \
		-u ${GIT_USER} \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/celery -- \
			-A gitsrht.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/git.sr.ht/git.sr.ht-webhooks.initd => sr.ht/git.sr.ht/git.sr.ht-webhooks.initd +23 -0
@@ 0,0 1,23 @@
#!/sbin/openrc-run
name="git.sr.ht-webhooks"
description="git.sr.ht webhook delivery service"
supervisor=supervise-daemon
GIT_USER=${GIT_USER:-gitsrht}
GIT_ARGS=${GIT_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/git.sr.ht-webhooks.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/celery"
command_args="-A gitsrht.webhooks worker --loglevel=info $GIT_ARGS"
command_user="$GIT_USER:$GIT_USER"
pidfile="/run/${RC_SVCNAME}.pid"

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

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

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

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

# Extra arguments to pass to Gunicorn
# GIT_ARGS=

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

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

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

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