aboutsummaryrefslogtreecommitdiff
path: root/net-libs/meta-srht/files
diff options
context:
space:
mode:
authorJulien Roy <julien@jroy.ca>2023-01-07 23:38:36 -0500
committerJulien Roy <julien@jroy.ca>2023-01-07 23:38:36 -0500
commitc4a94a0f70bcb249bd795b82d4e5a387e5259a17 (patch)
tree8bafbde9f67c0550c37610fa90ae0a08fc9054a4 /net-libs/meta-srht/files
parentd28857b322402e48794c4d05ca444943367b2a6f (diff)
downloadMrRoy-Overlay-c4a94a0f70bcb249bd795b82d4e5a387e5259a17.tar.gz
MrRoy-Overlay-c4a94a0f70bcb249bd795b82d4e5a387e5259a17.tar.bz2
MrRoy-Overlay-c4a94a0f70bcb249bd795b82d4e5a387e5259a17.zip
net-libs/meta-srht: use official RC scripts, update ebuild
Signed-off-by: Julien Roy <julien@jroy.ca>
Diffstat (limited to 'net-libs/meta-srht/files')
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht-api.confd10
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht-api.initd27
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht-webhooks.confd5
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht-webhooks.initd24
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht.confd10
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht.gunicorn.conf.py5
-rw-r--r--net-libs/meta-srht/files/meta.sr.ht.initd33
7 files changed, 86 insertions, 28 deletions
diff --git a/net-libs/meta-srht/files/meta.sr.ht-api.confd b/net-libs/meta-srht/files/meta.sr.ht-api.confd
index 9f22d1f..8dd25e8 100644
--- a/net-libs/meta-srht/files/meta.sr.ht-api.confd
+++ b/net-libs/meta-srht/files/meta.sr.ht-api.confd
@@ -1,2 +1,8 @@
-ADDRESS=0.0.0.0
-PORT=5100 \ No newline at end of file
+# Run the daemon as this user:
+# META_USER=meta-srht
+
+# Bind the API service to this address:
+# META_BIND=:5100
+
+# Extra arguments to pass to Gunicorn
+# META_ARGS=
diff --git a/net-libs/meta-srht/files/meta.sr.ht-api.initd b/net-libs/meta-srht/files/meta.sr.ht-api.initd
index e3cc759..896a458 100644
--- a/net-libs/meta-srht/files/meta.sr.ht-api.initd
+++ b/net-libs/meta-srht/files/meta.sr.ht-api.initd
@@ -1,15 +1,26 @@
#!/sbin/openrc-run
-# Copyright 2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-name="meta.sr.ht API daemon"
-description=""
+name="meta.sr.ht-api"
+description="meta.sr.ht API service"
+supervisor=supervise-daemon
+META_USER=${META_USER:-meta-srht}
+META_BIND=${META_BIND:-:5100}
+META_ARGS=${META_ARGS:-}
+LOCAL_PG=${LOCAL_PG:-yes}
+LOCAL_REDIS=${LOCAL_REDIS:-yes}
+LOGS=/var/log/meta.sr.ht-api.log
+supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/metasrht-api"
-command_args="-b ${ADDRESS}:${PORT}"
-command_user="meta-srht:meta-srht"
-command_background=true
+command_args="-b $META_BIND"
+command_user="$META_USER:$META_USER"
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
+ use redis
+ use postgresql
+ use pgbouncer
+}
+
+start_pre() {
+ checkpath -f "$LOGS" -m 644 -o "$META_USER:$META_USER"
}
diff --git a/net-libs/meta-srht/files/meta.sr.ht-webhooks.confd b/net-libs/meta-srht/files/meta.sr.ht-webhooks.confd
new file mode 100644
index 0000000..809183f
--- /dev/null
+++ b/net-libs/meta-srht/files/meta.sr.ht-webhooks.confd
@@ -0,0 +1,5 @@
+# Run the daemon as this user:
+# META_USER=meta-srht
+
+# Extra arguments to pass to Gunicorn
+# META_ARGS=
diff --git a/net-libs/meta-srht/files/meta.sr.ht-webhooks.initd b/net-libs/meta-srht/files/meta.sr.ht-webhooks.initd
index e9a712f..4f71f13 100644
--- a/net-libs/meta-srht/files/meta.sr.ht-webhooks.initd
+++ b/net-libs/meta-srht/files/meta.sr.ht-webhooks.initd
@@ -1,15 +1,23 @@
#!/sbin/openrc-run
-# Copyright 2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-name="meta.sr.ht webhooks daemon"
-description=""
+name="meta.sr.ht-webhooks"
+description="meta.sr.ht webhook delivery service"
+supervisor=supervise-daemon
+META_USER=${META_USER:-meta-srht}
+LOCAL_PG=${LOCAL_PG:-yes}
+META_ARGS=${META_ARGS:-}
+LOGS=/var/log/meta.sr.ht-webhooks.log
+supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/celery"
-command_args="-A metasrht.webhooks worker --loglevel=INFO"
-command_user="meta-srht:meta-srht"
-command_background=true
+command_args="-A metasrht.webhooks worker --loglevel=info $META_ARGS"
+command_user="$META_USER:$META_USER"
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
+ use redis
+ use postgresql
+}
+
+start_pre() {
+ checkpath -f "$LOGS" -m 644 -o "$META_USER:$META_USER"
}
diff --git a/net-libs/meta-srht/files/meta.sr.ht.confd b/net-libs/meta-srht/files/meta.sr.ht.confd
index 8113c8e..215645f 100644
--- a/net-libs/meta-srht/files/meta.sr.ht.confd
+++ b/net-libs/meta-srht/files/meta.sr.ht.confd
@@ -1,2 +1,8 @@
-BINDADDRESS=0.0.0.0
-PORT=5000 \ No newline at end of file
+# Run the daemon as this user:
+# META_USER=meta-srht
+
+# Bind the API service to this address:
+# META_BIND=:5100
+
+# Extra arguments to pass to Gunicorn
+# META_ARGS= \ No newline at end of file
diff --git a/net-libs/meta-srht/files/meta.sr.ht.gunicorn.conf.py b/net-libs/meta-srht/files/meta.sr.ht.gunicorn.conf.py
new file mode 100644
index 0000000..aa3e7ae
--- /dev/null
+++ b/net-libs/meta-srht/files/meta.sr.ht.gunicorn.conf.py
@@ -0,0 +1,5 @@
+from prometheus_client import multiprocess
+
+
+def child_exit(server, worker):
+ multiprocess.mark_process_dead(worker.pid)
diff --git a/net-libs/meta-srht/files/meta.sr.ht.initd b/net-libs/meta-srht/files/meta.sr.ht.initd
index d1bcc94..8ef4cbb 100644
--- a/net-libs/meta-srht/files/meta.sr.ht.initd
+++ b/net-libs/meta-srht/files/meta.sr.ht.initd
@@ -1,15 +1,32 @@
#!/sbin/openrc-run
-# Copyright 2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-name="meta.sr.ht daemon"
-description=""
+name="meta.sr.ht"
+description="meta.sr.ht service"
+supervisor=supervise-daemon
+META_USER=${META_USER:-meta-srht}
+META_BIND=${META_BIND:-127.0.0.1:5000}
+META_GUNICORN_CONF=${META_GUNICORN_CONF:-/etc/sr.ht/meta.sr.ht.gunicorn.conf.py}
+META_ARGS=${META_ARGS:-}
+LOGS=/var/log/meta.sr.ht.log
+prometheus_multiproc_dir=/run/meta.sr.ht
+supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
-command_args="metasrht.app:app -b ${ADDRESS}:${PORT}"
-command_user="meta-srht:meta-srht"
-command_background=true
+command_args="metasrht.app:app -b $META_BIND -c $META_GUNICORN_CONF $META_ARGS"
+command_user="$META_USER:$META_USER"
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
+ use redis
+ use postgresql
+ use pgbouncer
+}
+
+start_pre() {
+ checkpath -f "$LOGS" -m 644 -o "$META_USER:$META_USER"
+ # Workaround for https://github.com/OpenRC/openrc/issues/335
+ if [ -n "$prometheus_multiproc_dir" ]
+ then
+ checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$META_USER:$META_USER"
+ rm -rf "$prometheus_multiproc_dir"/*
+ fi
}