M sr.ht/builds.sr.ht/APKBUILD => sr.ht/builds.sr.ht/APKBUILD +8 -4
@@ 7,17 7,19 @@ url="https://git.sr.ht/~sircmpwn/builds.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
- py3-srht
- py3-pgpy
py3-celery
+ py3-gunicorn
+ py3-pgpy
py3-redis
+ py3-srht
py3-yaml
"
makedepends="py-setuptools nodejs sassc go"
subpackages="$pkgname-images:_images $pkgname-worker:_worker:any"
source="
$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/${pkgver}.tar.gz
- builds.sr.ht-worker.initd
+ builds.sr.ht.init
+ builds.sr.ht-worker.init
"
install="$pkgname.pre-install"
builddir="$srcdir/$pkgname-$pkgver"
@@ 34,6 36,8 @@ build() {
package() {
cd "$builddir"
python3 setup.py install --root="$pkgdir" --optimize=1
+ install -Dm755 "$srcdir"/builds.sr.ht.init \
+ "$subpkgdir"/etc/init.d/builds.sr.ht
}
_images() {
@@ 49,7 53,7 @@ _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.initd \
+ install -Dm755 "$srcdir"/builds.sr.ht-worker.init \
"$subpkgdir"/etc/init.d/builds.sr.ht-worker
}
R sr.ht/builds.sr.ht/builds.sr.ht-worker.initd => sr.ht/builds.sr.ht/builds.sr.ht-worker.init +0 -0
A sr.ht/builds.sr.ht/builds.sr.ht.init => sr.ht/builds.sr.ht/builds.sr.ht.init +37 -0
@@ 0,0 1,37 @@
+#!/sbin/openrc-run
+name="builds.sr.ht"
+description="builds.sr.ht service"
+
+# Override these with /etc/conf.d/builds.sr.ht
+BUILDS_USER=${BUILDS_USER:-builds}
+BUILDS_BIND=${BUILDS_BIND:-127.0.0.1:5000}
+LOCAL_PG=${LOCAL_PG:-yes}
+LOGS=/var/log/builds.sr.ht.log
+
+depend() {
+ need net
+ need redis
+ [ "$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}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping $name"
+ start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
+ eend $?
+}