chore: remove duplicated config for http-mqtt-bridge

This commit is contained in:
s3lph 2025-01-18 19:52:42 +01:00
parent 9d28b94854
commit 0ee3650142
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
6 changed files with 0 additions and 116 deletions

View file

@ -1,52 +0,0 @@
#!/bin/bash
set -exo pipefail
ROOT=$(pwd)
function fetch() {
apt install --assume-yes --no-install-recommends git golang-go
cd "${SRCDIR}"
git clone https://github.com/subzerobo/http-mqtt-bridge
cd http-mqtt-bridge
export VERSION=0.$(git rev-list --count HEAD)
go get ./...
go build -o http-mqtt-bridge
}
function prepare() {
chmod +x "${SRCDIR}/http-mqtt-bridge/http-mqtt-bridge"
mkdir -p \
"${PKGDIR}/DEBIAN" \
"${PKGDIR}/usr/bin" \
"${PKGDIR}/etc/default" \
"${PKGDIR}/etc/apache2/sites-available" \
"${PKGDIR}/lib/systemd/system"
cp "${SRCDIR}/http-mqtt-bridge/http-mqtt-bridge" "${PKGDIR}/usr/bin/http-mqtt-bridge"
cp "${ROOT}/http-mqtt-bridge.defaults" "${PKGDIR}/etc/default/http-mqtt-bridge"
cp "${ROOT}/http-mqtt-bridge.service" "${PKGDIR}/lib/systemd/system/http-mqtt-bridge.service"
cp "${ROOT}/http-mqtt-bridge.site" "${PKGDIR}/etc/apache2/sites-available/http-mqtt-bridge.site"
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
find "${PKGDIR}" -exec touch -m -d "${ISODATE}" {} \;
}
function package() {
cd "${BUILDDIR}"
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
}
function build() {
export BUILDDIR=${ROOT}/build
export SRCDIR=${ROOT}/build/srcdir
export PKGDIR=${ROOT}/build/pkgdir
mkdir -p ${SRCDIR} ${PKGDIR}
fetch
prepare
package
}
build

View file

@ -1,2 +0,0 @@
/etc/default/http-mqtt-bridge
/etc/apache2/sites-available/http-mqtt-bridge.site

View file

@ -1,11 +0,0 @@
Package: http-mqtt-bridge
Version: __VERSION__
Maintainer: __MAINTAINER__
Section: web
Priority: optional
Architecture: amd64
Recommends: apache2
Description: Rewrite HTTP POST requests into MQTT PUB requests
The HTTP to MQTT bridge should fill that gap of IFTTT Actions for
your Custom IoT Hardwares. The idea is to receive signals using HTTP
requests and transfer them to your MQTT broker.

View file

@ -1,5 +0,0 @@
MQTT_HOST=localhost:1883
#MQTT_USER=
#MQTT_PASS=
AUTH_USERNAME=hmb
AUTH_PASSWORD=hmb

View file

@ -1,14 +0,0 @@
[Unit]
Description=HTTP to MQTT Bridge
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=-/etc/default/http-mqtt-bridge
ExecStart=/usr/bin/http-mqtt-bridge start
DynamicUser=true
CapabilityBoundingSet=
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -1,32 +0,0 @@
<VirtualHost *:80>
ServerName mqtt.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Reverse Proxy for HTTP-MQTT-Bridge
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
# Static auth header (hmb:hmb)
#RequestHeader set "Authorization" "Basic aG1iOmhtYg=="
# Configure CORS headers
Header always set "Access-Control-Allow-Origin" "*"
Header always set "Access-Control-Allow-Methods" "GET, POST, OPTIONS"
Header always set "Access-Control-Allow-Headers" "Content-Type"
# Stop CORB complaints by overwriting text/html with application/json
Header always set "Content-Type" "application/json"
# Make OPTIONS request work by forcibly returning a 200 OK header
# even though the backend returns a 405
RewriteEngine on
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet