Initial import into git
This commit is contained in:
3
avahi-browse
Executable file
3
avahi-browse
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
exec docker compose exec reflector avahi-browse "$@"
|
||||||
3
avahi-resolve
Executable file
3
avahi-resolve
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
exec docker compose exec reflector avahi-resolve "$@"
|
||||||
18
docker-compose-example.yml
Normal file
18
docker-compose-example.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
services:
|
||||||
|
reflector:
|
||||||
|
build:
|
||||||
|
context: ./docker
|
||||||
|
container_name: "avahi-reflector"
|
||||||
|
pull_policy: build
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
- "AVAHI_INTERFACES=dummy0"
|
||||||
|
# Ref: https://docs.docker.com/reference/dockerfile/#healthcheck
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "avahi-browse", "-a", "-c"]
|
||||||
|
interval: 1m30s
|
||||||
|
timeout: 30s
|
||||||
|
retries: 3
|
||||||
|
start_period: 5s
|
||||||
|
start_interval: 5s
|
||||||
20
docker/Dockerfile
Normal file
20
docker/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
RUN apk --no-cache add \
|
||||||
|
avahi \
|
||||||
|
avahi-tools \
|
||||||
|
dbus \
|
||||||
|
envsubst \
|
||||||
|
s6-overlay \
|
||||||
|
socat
|
||||||
|
|
||||||
|
COPY ./services.d/ /etc/services.d/
|
||||||
|
COPY wait-for-dbus /usr/local/bin/
|
||||||
|
COPY avahi-daemon.conf.template /etc/avahi/
|
||||||
|
COPY entrypoint-dlitz.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint-dlitz.sh"]
|
||||||
|
ENV AVAHI_INTERFACES=dummy0
|
||||||
|
|
||||||
|
#CMD ["/usr/sbin/avahi-daemon"]
|
||||||
|
CMD ["/bin/sh", "-c", "wait-for-dbus ; exec /usr/sbin/avahi-daemon"]
|
||||||
|
|
||||||
21
docker/avahi-daemon.conf.template
Normal file
21
docker/avahi-daemon.conf.template
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# vim:set backupcopy=yes:
|
||||||
|
|
||||||
|
[server]
|
||||||
|
use-ipv4=yes
|
||||||
|
use-ipv6=yes
|
||||||
|
ratelimit-interval-usec=1000000
|
||||||
|
ratelimit-burst=1000
|
||||||
|
enable-dbus=yes
|
||||||
|
|
||||||
|
#allow-interfaces=br0,ve-wuuf-int
|
||||||
|
#allow-interfaces=br0,vlan-iot,ve-wuuf
|
||||||
|
#allow-interfaces=br0,ve-wuuf
|
||||||
|
allow-interfaces=${AVAHI_INTERFACES}
|
||||||
|
|
||||||
|
[publish]
|
||||||
|
disable-publishing=yes
|
||||||
|
|
||||||
|
[reflector]
|
||||||
|
enable-reflector=yes
|
||||||
|
#reflect-ipv=no
|
||||||
|
#reflect-filters=
|
||||||
4
docker/entrypoint-dlitz.sh
Executable file
4
docker/entrypoint-dlitz.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
envsubst < /etc/avahi/avahi-daemon.conf.template > /etc/avahi/avahi-daemon.conf
|
||||||
|
exec /init "$@"
|
||||||
5
docker/services.d/dbus/run
Executable file
5
docker/services.d/dbus/run
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
[ -f ./setup ] && source ./setup
|
||||||
|
#exec /usr/bin/dbus-daemon --system --nofork --nosyslog
|
||||||
|
exec /usr/bin/dbus-daemon --system --nofork
|
||||||
11
docker/services.d/dbus/setup
Executable file
11
docker/services.d/dbus/setup
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
mkdir -p /run/dbus
|
||||||
|
|
||||||
|
# Clean up stale pid file, if present.
|
||||||
|
pidfile=/run/dbus/dbus.pid
|
||||||
|
pid=$(cat "$pidfile" || true)
|
||||||
|
if [ -n "$pid" ] && ! [ -d "/proc/$pid" ]; then
|
||||||
|
echo >&2 "Removing stale PID file $pidfile"
|
||||||
|
rm -f "$pidfile"
|
||||||
|
fi
|
||||||
14
docker/wait-for-dbus
Executable file
14
docker/wait-for-dbus
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# dlitz 2025
|
||||||
|
set -eu
|
||||||
|
prog="$(basename "$0")"
|
||||||
|
socket=/run/dbus/system_bus_socket
|
||||||
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
if test -e "$socket" && socat -u stdio unix-connect:"$socket" </dev/null >/dev/null; then
|
||||||
|
echo >&2 "$prog: dbus socket connection successful: $socket"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo >&2 "$prog: Could not connect to dbus socket $socket. Sleeping..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo >&2 "$prog: dbus socket connection failed: continuing anyway: $socket"
|
||||||
Reference in New Issue
Block a user