From ff26bd87f221334f71d2a171111f92b166df378b Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Wed, 18 Dec 2024 13:42:59 -0700 Subject: [PATCH] rename config, fix pyproject.toml, add rpm stuff --- config/{eavesdrop.yaml => buzon.yaml} | 0 pyproject.toml | 2 +- requirements.txt | 4 --- rpm/buzon.service | 14 +++++++++ rpm/buzon.spec | 45 +++++++++++++++++++++++++++ rpm/buzon.sysconfig | 2 ++ 6 files changed, 62 insertions(+), 5 deletions(-) rename config/{eavesdrop.yaml => buzon.yaml} (100%) delete mode 100644 requirements.txt create mode 100644 rpm/buzon.service create mode 100644 rpm/buzon.spec create mode 100644 rpm/buzon.sysconfig diff --git a/config/eavesdrop.yaml b/config/buzon.yaml similarity index 100% rename from config/eavesdrop.yaml rename to config/buzon.yaml diff --git a/pyproject.toml b/pyproject.toml index 5aa3296..5da794c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ requires-python = ">=3.9" dependencies = [ "fastapi >= 0.115.5", "paho-mqtt >= 1.6.1", - "pydantic >= 2.9.2" + "pydantic >= 2.9.2", "uvicorn >= 0.29.0" ] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f8bf322..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -fastapi>=0.115.5 -paho-mqtt>=1.6.1 -pydantic>=2.9.2 -uvicorn>=0.29.0 diff --git a/rpm/buzon.service b/rpm/buzon.service new file mode 100644 index 0000000..6743388 --- /dev/null +++ b/rpm/buzon.service @@ -0,0 +1,14 @@ +[Unit] +Description=Buzon - MQTT Webhook Delivery Service +After=network-online.target +Wants=network-online.target + +[Service] +Environment="BUZON_CONFIG=/etc/buzon/buzon.yaml" +EnvironmentFile=/etc/sysconfig/noggin +EnvironmentFile=/etc/buzon/buzon.yaml +ExecStart=/usr/bin/uvicorn --host ${BUZON_HOST} --port ${BUZON_PORT} buzon.app:app + +[Install] +WantedBy=multi-user.target + diff --git a/rpm/buzon.spec b/rpm/buzon.spec new file mode 100644 index 0000000..b3ccb9d --- /dev/null +++ b/rpm/buzon.spec @@ -0,0 +1,45 @@ +Name: buzon +Version: 0.1.0 +Release: 1%{?dist} +Summary: MQTT Webhook Delivery Service + +License: GPLv3 +URL: https://git.resf.org/infrastructure/buzon +Source0: %{name}-%{version}.tar.gz + +BuildArch: noarch +BuildRequires: pyproject-rpm-macros +BuildRequires: systemd-rpm-macros +Requires: (python3dist(uvicorn) with /usr/bin/uvicorn) + +%description +Buzon is a webhook system designed to receive messages from a forgejo instance +and then send it to an MQTT-aware endpoint. + +%prep +%autosetup -n %{name}-%{version} -p1 + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files buzon + +# install buzon.yaml to /etc/buzon + +%files -f %{pyproject_files} +%license LICENSE +%ghost %{_sysconfdir}/%{name}/%{name}.cfg + + + +%changelog +* Wed Dec 18 2024 Louis Abel - 0.1.0-1 +- Initial buzon spec file + diff --git a/rpm/buzon.sysconfig b/rpm/buzon.sysconfig new file mode 100644 index 0000000..ab1c8b8 --- /dev/null +++ b/rpm/buzon.sysconfig @@ -0,0 +1,2 @@ +BUZON_HOST="0.0.0.0" +BUZON_PORT="9898"