mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-25 15:20:10 +00:00
Add readsb Prometheus output (#3)
This commit is contained in:
commit
352d9c5c19
5 changed files with 27 additions and 3 deletions
|
@ -59,7 +59,7 @@ COPY rootfs/ /
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
branch="##BRANCH##" && \
|
branch="##BRANCH##" && \
|
||||||
[[ "${branch:0:1}" == "#" ]] && branch="main" || true && \
|
[[ "${branch:0:1}" == "#" ]] && branch="main" || true && \
|
||||||
git clone --depth=1 -b $branch https://github.com/sdr-enthusiasts/docker-multifeeder.git /tmp/clone && \
|
git clone --depth=1 -b $branch https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git /tmp/clone && \
|
||||||
pushd /tmp/clone && \
|
pushd /tmp/clone && \
|
||||||
echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > /.CONTAINER_VERSION && \
|
echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > /.CONTAINER_VERSION && \
|
||||||
popd && \
|
popd && \
|
||||||
|
|
|
@ -12,7 +12,7 @@ BASETARGET2=kx1t
|
||||||
IMAGE1="$BASETARGET1/$(pwd | sed -n 's|.*/\(docker-.*\)|\1|p'):$TAG"
|
IMAGE1="$BASETARGET1/$(pwd | sed -n 's|.*/\(docker-.*\)|\1|p'):$TAG"
|
||||||
IMAGE2="$BASETARGET2/$(pwd | sed -n 's|.*/docker-\(.*\)|\1|p'):$TAG"
|
IMAGE2="$BASETARGET2/$(pwd | sed -n 's|.*/docker-\(.*\)|\1|p'):$TAG"
|
||||||
|
|
||||||
echo "press enter to start building $IMAGE1 and $IMAGE2 from $BRANCH"
|
echo "press enter to start building $IMAGE1 from $BRANCH"
|
||||||
|
|
||||||
read
|
read
|
||||||
|
|
||||||
|
@ -32,6 +32,6 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker buildx build -f Dockerfile --compress --push $2 --platform $ARCHS --tag "$IMAGE1" .
|
docker buildx build -f Dockerfile --compress --push $2 --platform $ARCHS --tag "$IMAGE1" .
|
||||||
[[ $? ]] && docker buildx build --compress --push $2 --platform $ARCHS --tag $IMAGE2 .
|
# [[ $? ]] && docker buildx build -f Dockerfile --compress --push $2 --platform $ARCHS --tag $IMAGE2 .
|
||||||
mv -f Dockerfile.tmp-backup Dockerfile
|
mv -f Dockerfile.tmp-backup Dockerfile
|
||||||
echo "Total build time: $(( $(date +%s) - starttime )) seconds"
|
echo "Total build time: $(( $(date +%s) - starttime )) seconds"
|
||||||
|
|
4
rootfs/etc/cont-finish.d/02-remove-prometheus-data
Normal file
4
rootfs/etc/cont-finish.d/02-remove-prometheus-data
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
#shellcheck shell=bash
|
||||||
|
|
||||||
|
rm -f /run/readsb-prometheus.prom || true
|
12
rootfs/etc/services.d/prometheus-readsb/run
Normal file
12
rootfs/etc/services.d/prometheus-readsb/run
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
#shellcheck shell=bash
|
||||||
|
|
||||||
|
if [[ -n "$PROMETHEUS_ENABLE" ]]; then
|
||||||
|
while [[ ! -f /run/readsb-prometheus.prom ]]
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo -e "HTTP/1.1 200 OK\nContent-Type: text/plain\n\n$(cat /run/readsb-prometheus.prom)" | ncat -l 9274 > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
sleep infinity
|
||||||
|
fi
|
|
@ -314,6 +314,14 @@ if [[ -n "$READSB_BEAST_BAUDRATE" ]]; then
|
||||||
READSB_CMD+=("--beast-baudrate=$READSB_BEAST_BAUDRATE")
|
READSB_CMD+=("--beast-baudrate=$READSB_BEAST_BAUDRATE")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# Handle --write-prom=<filepath>
|
||||||
|
|
||||||
|
if [[ -n "$PROMETHEUS_ENABLE" ]]; then
|
||||||
|
READSB_CMD+=("--write-prom=/run/readsb-prometheus.prom")
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then
|
if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then
|
||||||
"${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS 2>&1 | \
|
"${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS 2>&1 | \
|
||||||
|
|
Loading…
Reference in a new issue