sourcehut.gitsrht: 0.77.3 -> 0.78.18

This commit is contained in:
Julien Moutinho 2022-05-06 00:03:52 +02:00 committed by tomberek
parent 43f856ab2c
commit b57ed0fa1d
3 changed files with 44 additions and 44 deletions

View file

@ -1086,6 +1086,11 @@ in
};
})
];
extraServices.gitsrht-api = {
serviceConfig.Restart = "always";
serviceConfig.RestartSec = "2s";
serviceConfig.ExecStart = "${pkgs.sourcehut.gitsrht}/bin/gitsrht-api -b ${cfg.listenAddress}:${toString (cfg.git.port + 100)}";
};
extraServices.gitsrht-fcgiwrap = mkIf cfg.nginx.enable {
serviceConfig = {
# Socket is passed by gitsrht-fcgiwrap.socket

View file

@ -1,47 +1,57 @@
{ lib
, fetchFromSourcehut
, buildPythonPackage
, buildGoModule
, buildPythonPackage
, python
, srht
, pygit2
, scmsrht
, unzip
}:
let
version = "0.77.3";
version = "0.78.18";
src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "git.sr.ht";
rev = version;
sha256 = "sha256-eJvXCcmdiUzTK0EqNJkLEZsAfr6toD/378HObnMbOWM=";
sha256 = "sha256-pGWphdFKaOIBIKWMxfNAFqXZQx/qHcrwb5Ylj9uag7s=";
};
buildShell = src: buildGoModule {
gitApi = buildGoModule ({
inherit src version;
pname = "gitsrht-shell";
vendorSha256 = "sha256-aqUFICp0C2reqb2p6JCPAUIRsxzSv0t9BHoNWrTYfqk=";
};
pname = "gitsrht-api";
modRoot = "api";
vendorSha256 = "sha256-0YI20liP0X1McfiSUy29zJk2UqqAPBIfIfPLoJOE1uI=";
} // import ./fix-gqlgen-trimpath.nix {inherit unzip;});
buildDispatcher = src: buildGoModule {
gitDispatch = buildGoModule {
inherit src version;
pname = "gitsrht-dispatcher";
pname = "gitsrht-dispatch";
modRoot = "gitsrht-dispatch";
vendorSha256 = "sha256-qWXPHo86s6iuRBhRMtmD5jxnAWKdrWHtA/iSUkdw89M=";
};
buildKeys = src: buildGoModule {
gitKeys = buildGoModule {
inherit src version;
pname = "gitsrht-keys";
modRoot = "gitsrht-keys";
vendorSha256 = "sha256-9pojS69HCKVHUceyOpGtv9ewcxFD4WsOVsEzkmWJkF4=";
};
buildUpdateHook = src: buildGoModule {
gitShell = buildGoModule {
inherit src version;
pname = "gitsrht-update-hook";
vendorSha256 = "sha256-sBlG7EFqdDm7CkAHVX50Mf4N3sl1rPNmWExG/bfbfGA=";
pname = "gitsrht-shell";
modRoot = "gitsrht-shell";
vendorSha256 = "sha256-WqfvSPuVsOHA//86u33atMfeA11+DJhjLmWy8Ivq0NI=";
};
updateHook = buildUpdateHook "${src}/gitsrht-update-hook";
gitUpdateHook = buildGoModule {
inherit src version;
pname = "gitsrht-update-hook";
modRoot = "gitsrht-update-hook";
vendorSha256 = "sha256-Bc3yPabS2S+qiroHFKrtkII/CfzBDYQ6xWxKHAME+Tc=";
};
in
buildPythonPackage rec {
@ -52,6 +62,10 @@ buildPythonPackage rec {
# Revert change breaking Unix socket support for Redis
patches/redis-socket/git/0001-Revert-Add-webhook-queue-monitoring.patch
];
postPatch = ''
substituteInPlace Makefile \
--replace "all: api gitsrht-dispatch gitsrht-keys gitsrht-shell gitsrht-update-hook" ""
'';
nativeBuildInputs = srht.nativeBuildInputs;
@ -68,14 +82,12 @@ buildPythonPackage rec {
postInstall = ''
mkdir -p $out/bin
cp ${buildShell "${src}/gitsrht-shell"}/bin/gitsrht-shell $out/bin/gitsrht-shell
cp ${buildDispatcher "${src}/gitsrht-dispatch"}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
cp ${buildKeys "${src}/gitsrht-keys"}/bin/gitsrht-keys $out/bin/gitsrht-keys
cp ${updateHook}/bin/gitsrht-update-hook $out/bin/gitsrht-update-hook
ln -s ${gitApi}/bin/api $out/bin/gitsrht-api
ln -s ${gitDispatch}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
ln -s ${gitKeys}/bin/gitsrht-keys $out/bin/gitsrht-keys
ln -s ${gitShell}/bin/gitsrht-shell $out/bin/gitsrht-shell
ln -s ${gitUpdateHook}/bin/gitsrht-update-hook $out/bin/gitsrht-update-hook
'';
passthru = {
inherit updateHook;
};
pythonImportsCheck = [ "gitsrht" ];

View file

@ -1,22 +1,8 @@
From 5ccb5386304c26f25b0a9eb10ce9edb6da32f91a Mon Sep 17 00:00:00 2001
From: Julien Moutinho <julm+srht@sourcephile.fr>
Date: Sat, 12 Feb 2022 00:11:59 +0100
Subject: [PATCH git.sr.ht] Revert "Add webhook queue monitoring"
This reverts commit 7ea630b776947ab82438d0ffa263b0f9d33ebff3.
Which has broken Unix socket support for Redis.
See https://lists.sr.ht/~sircmpwn/sr.ht-dev/%3C20211208082636.65665-1-me%40ignaskiela.eu%3E#%3C20211216033723.wefibfulfjhqnhem@sourcephile.fr%3E
---
gitsrht/app.py | 3 ---
gitsrht/webhooks.py | 5 +----
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/gitsrht/app.py b/gitsrht/app.py
index e9ccb56..4928851 100644
index eaae395..731bb03 100644
--- a/gitsrht/app.py
+++ b/gitsrht/app.py
@@ -48,9 +48,6 @@ class GitApp(ScmSrhtFlask):
@@ -55,9 +55,6 @@ class GitApp(SrhtFlask):
self.add_template_filter(url_quote)
self.add_template_filter(commit_links)
@ -27,15 +13,15 @@ index e9ccb56..4928851 100644
def inject():
notice = session.get("notice")
diff --git a/gitsrht/webhooks.py b/gitsrht/webhooks.py
index 8a203fe..6240d50 100644
index 36486d0..0109428 100644
--- a/gitsrht/webhooks.py
+++ b/gitsrht/webhooks.py
@@ -7,13 +7,10 @@ if not hasattr(db, "session"):
@@ -7,12 +7,10 @@ if not hasattr(db, "session"):
db.init()
from srht.webhook import Event
from srht.webhook.celery import CeleryWebhook, make_worker
-from srht.metrics import RedisQueueCollector
from scmsrht.webhooks import UserWebhook
+from scmsrht.webhooks import UserWebhook
import sqlalchemy as sa
-webhook_broker = cfg("git.sr.ht", "webhooks")
@ -43,8 +29,5 @@ index 8a203fe..6240d50 100644
-webhook_metrics_collector = RedisQueueCollector(webhook_broker, "srht_webhooks", "Webhook queue length")
+worker = make_worker(broker=cfg("git.sr.ht", "webhooks"))
class RepoWebhook(CeleryWebhook):
class UserWebhook(CeleryWebhook):
events = [
--
2.34.1