~sircmpwn/sr.ht-packages

lists.sr.ht-deb: Adding GraphQL API v1 PROPOSED

Peter Sanchez: 1
 Adding GraphQL API

 5 files changed, 45 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-packages/patches/29523/mbox | git am -3
Learn more about email & git

[PATCH lists.sr.ht-deb] Adding GraphQL API Export this patch

---
 debian/rules                             |  7 +++++++
 debian/srht-lists.install                |  1 +
 debian/srht-lists.postinst               |  3 +++
 debian/srht-lists.postrm                 | 21 +++++++++++++++++++++
 debian/srht-lists.srht-lists-api.service | 13 +++++++++++++
 5 files changed, 45 insertions(+)
 create mode 100644 debian/srht-lists.install
 create mode 100644 debian/srht-lists.postrm
 create mode 100644 debian/srht-lists.srht-lists-api.service

diff --git a/debian/rules b/debian/rules
index 1f0e430..3f8c644 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,9 +15,16 @@ export PYBUILD_DISABLE=test
override_dh_auto_build:
	make SRHT_PATH=${SRHT_PATH}
	dh_auto_build
	cd api && go build -o listssrht-api

override_dh_installsystemd:
	dh_installsystemd
	dh_installsystemd --name srht-lists-lmtp
	dh_installsystemd --name srht-lists-process
	dh_installsystemd --name srht-lists-webhooks
	dh_installsystemd --name srht-lists-api

override_dh_auto_clean:
	dh_auto_clean
	-rm api/listssrht-api

diff --git a/debian/srht-lists.install b/debian/srht-lists.install
new file mode 100644
index 0000000..78e29dc
--- /dev/null
+++ b/debian/srht-lists.install
@@ -0,0 +1 @@
api/listssrht-api usr/bin
diff --git a/debian/srht-lists.postinst b/debian/srht-lists.postinst
index 74c5732..cc76b0b 100644
--- a/debian/srht-lists.postinst
+++ b/debian/srht-lists.postinst
@@ -6,6 +6,9 @@ case "$1" in
    configure)
        srht-migrate lists.sr.ht -a upgrade head
        listssrht-migrate -a upgrade head

        touch /var/log/lists.sr.ht-api.log
        chown ${USER}: /var/log/lists.sr.ht-api.log
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/srht-lists.postrm b/debian/srht-lists.postrm
new file mode 100644
index 0000000..eef3cf3
--- /dev/null
+++ b/debian/srht-lists.postrm
@@ -0,0 +1,21 @@
#!/bin/sh

set -e

case "$1" in
    purge)
        rm -f /var/log/lists.sr.ht-api.log
    ;;

    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0
diff --git a/debian/srht-lists.srht-lists-api.service b/debian/srht-lists.srht-lists-api.service
new file mode 100644
index 0000000..1ec8bb4
--- /dev/null
+++ b/debian/srht-lists.srht-lists-api.service
@@ -0,0 +1,13 @@
[Unit]
Description=lists.sr.ht API service
Requires=redis-server.service postgresql.service
After=redis-server.service postgresql.service network.target

[Service]
Type=simple
User=listssrht
Restart=always
ExecStart=/usr/bin/listssrht-api -b :5106

[Install]
WantedBy=multi-user.target
-- 
2.34.1
Thanks; I adjusted Build-Depends:, Depends:, and changed Architecture: 
and finally pushed as dd3b4b2aa86e6d04885bec3a7b73de37651c24f1.