~sircmpwn/sr.ht-packages

todo.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/29525/mbox | git am -3
Learn more about email & git

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

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

diff --git a/debian/rules b/debian/rules
index 4abedcb..2d27bca 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,8 +15,15 @@ export PYBUILD_DISABLE=test
override_dh_auto_build:
	make SRHT_PATH=${SRHT_PATH}
	dh_auto_build
	cd api && go build -o todosrht-api

override_dh_installsystemd:
	dh_installsystemd
	dh_installsystemd --name srht-todo-lmtp
	dh_installsystemd --name srht-todo-webhooks
	dh_installsystemd --name srht-todo-api

override_dh_auto_clean:
	dh_auto_clean
	-rm api/todosrht-api

diff --git a/debian/srht-todo.install b/debian/srht-todo.install
new file mode 100644
index 0000000..e3cd240
--- /dev/null
+++ b/debian/srht-todo.install
@@ -0,0 +1 @@
api/todosrht-api usr/bin
diff --git a/debian/srht-todo.postinst b/debian/srht-todo.postinst
index bbc9c56..223b004 100644
--- a/debian/srht-todo.postinst
+++ b/debian/srht-todo.postinst
@@ -6,6 +6,9 @@ case "$1" in
    configure)
        srht-migrate todo.sr.ht -a upgrade head
        todosrht-migrate -a upgrade head

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

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

set -e

case "$1" in
    purge)
        rm -f /var/log/todo.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-todo.srht-todo-api.service b/debian/srht-todo.srht-todo-api.service
new file mode 100644
index 0000000..d1eee03
--- /dev/null
+++ b/debian/srht-todo.srht-todo-api.service
@@ -0,0 +1,13 @@
[Unit]
Description=todo.sr.ht API service
Requires=redis-server.service postgresql.service
After=redis-server.service postgresql.service network.target

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

[Install]
WantedBy=multi-user.target
-- 
2.34.1
Thanks; pushed as 4ffe62360ca19bf7522713c160afb38b93d0ebcd.