mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-22 05:40:10 +00:00
intermediate commit
This commit is contained in:
parent
9e20d48d76
commit
19a2b4d0db
5 changed files with 193 additions and 23 deletions
34
README.md
34
README.md
|
@ -153,7 +153,7 @@ The following parameters must be set (mandatory) for the container to function:
|
|||
| `S6_SERVICES_GRACETIME` | Optional, set to 30000 when saving traces / globe_history | | `3000` |
|
||||
| `LOGLEVEL` | `verbose` (all messages), `error` (errors only), `none` (minimal) | | `verbose` |
|
||||
|
||||
`READSB_EXTRA_ARGS` just passes arguments to the commandline, you can check this file for more options for wiedehofp's readsb fork: <https://github.com/wiedehopf/readsb/blob/dev/help.h>
|
||||
`READSB_EXTRA_ARGS` just passes arguments to the commandline, you can check this file for more options for wiedehopf's readsb fork: <https://github.com/wiedehopf/readsb/blob/dev/help.h>
|
||||
|
||||
### Getting ADSB data to the Ultrafeeder
|
||||
|
||||
|
@ -218,6 +218,38 @@ docker exec -it ultrafeeder /usr/local/bin/autogain1090 reset
|
|||
|
||||
In addition to (or instead of) connecting to a SDR or hardware device to get ADSB data, the container also supports ingesting data from a TCP port. Here are some parameters that you need to configure if you want to make this happen:
|
||||
|
||||
##### All-in-One Configuration using `ULTRAFEEDER_CONFIG`
|
||||
|
||||
`ULTRAFEEDER_CONFIG` is a new parameter that can be used instead of separately defining `READSB_NET_CONNECTOR`, `MLAT_NET_CONNECTOR`, `MLATHUB_NET_CONNECTOR`/`MLATHUB_CONFIG`. These legacy parameters will still work; however, we wanted to provide a single parameter that enables configuration of incoming and outgoing ADSB data, MLAT-client data, and MLATHUB data.
|
||||
|
||||
Note that `ULTRAFEEDER_CONFIG` and `ULTRAFEEDER_NET_CONNECTOR` can be used interchangeably; in this documentation, we'll use `ULTRAFEEDER_CONFIG` as an example.
|
||||
|
||||
# Format:
|
||||
# ULTRAFEEDER_CONFIG=adsb,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
# ULTRAFEEDER_CONFIG=mlat,host,port[,return_port][,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
# ULTRAFEEDER_CONFIG=mlathub,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
#
|
||||
# The ULTRAFEEDER_CONFIG parameter can have multiple config strings, separated by a `;`
|
||||
# Please note that the config strings cannot containe `;` or `,` -- undefined things may happen if these characters are present.
|
||||
#
|
||||
# In the above configuration strings:
|
||||
# `host` is an IP address. Specify an IP/hostname/containername for incoming or outgoing connections.
|
||||
# `port` is a TCP port number
|
||||
# `protocol` can be one of the following:
|
||||
# `beast_reduce_out`: Beast-format output with lower data throughput (saves bandwidth and CPU)
|
||||
# `beast_reduce_plus_out`: Beast-format output with extra data (UUID). This is the preferred format when feeding the "new" aggregator services
|
||||
# `beast_out`: Beast-format output
|
||||
# `beast_in`: Beast-format input
|
||||
# `raw_out`: Raw output
|
||||
# `raw_in`: Raw input
|
||||
# `sbs_out`: SBS-format output
|
||||
# `vrs_out`: SBS-format output
|
||||
# `uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` is an optional parameter that sets the UUID for this specific instance.
|
||||
# It will override the global `UUID` parameter. This is only needed when you want to send different UUIDs to different aggregators.
|
||||
# `extra-arguments` can be any additional command line argument you want to pass to readsb, mlathub, or mlat-client
|
||||
# Example: `--net-only`. Please make sure to only once pass in an extra argument for each of the adsb|mlat|mlathub service.
|
||||
|
||||
|
||||
##### Networking parameters
|
||||
|
||||
| Environment Variable | Purpose | Default |
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash disable=SC1091,SC2015,SC2016
|
||||
|
||||
source /scripts/common
|
||||
|
||||
#---------------------------------------------------------------------------------------------
|
||||
# Copyright (C) 2023, Ramon F. Kolb (kx1t)
|
||||
#
|
||||
|
@ -22,6 +20,9 @@ source /scripts/common
|
|||
APPNAME="mlat-client"
|
||||
echo "[$(date)][${APPNAME}] Started as an s6 service"
|
||||
|
||||
source /scripts/common
|
||||
source /scripts/interpret_ultrafeeder_config
|
||||
|
||||
MLAT_CMD="/usr/bin/mlat-client"
|
||||
|
||||
RESTARTTIMER=15
|
||||
|
@ -61,7 +62,10 @@ fi
|
|||
# anything else will be appended as extra parameter(s) to the mlat-client command line
|
||||
|
||||
# parse MLAT_CONFIG string into mlat_configs array
|
||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG// /}")
|
||||
# Strip any extraneous spaces:
|
||||
MLAT_CONFIG="${MLAT_CONFIG#"${MLAT_CONFIG%%[![:space:]]*}"}" # strip leading space
|
||||
MLAT_CONFIG="${MLAT_CONFIG//; /;}"
|
||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG}")
|
||||
|
||||
# Now loop through the MLAT_CONFIG items and start up an Mlat_client for each of them:
|
||||
for instance in "${mlat_configs[@]}"
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash disable=SC1091,SC2016
|
||||
# shellcheck shell=bash disable=SC1091,SC2015,SC2016
|
||||
|
||||
APPNAME="mlathub"
|
||||
source /scripts/common
|
||||
source /scripts/interpret_ultrafeeder_config
|
||||
|
||||
if [[ -z "${MLAT_CONFIG}" ]] && [[ -z "$MLATHUB_NET_CONNECTOR" ]]; then
|
||||
echo "[$(date)][mlathub] No MLAT servers have been defined in MLAT_CONFIG and no external sources have been defined in MLATHUB_NET_CONNECTOR - no need to start MLATHUB"
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] No MLAT servers have been defined in MLAT_CONFIG and no external sources have been defined in MLATHUB_NET_CONNECTOR - no need to start MLATHUB"
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
if chk_enabled "${MLATHUB_DISABLED}"; then
|
||||
echo "[$(date)][mlathub] MLATHUB is disabled."
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] MLATHUB is disabled."
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
|
@ -56,25 +58,25 @@ done
|
|||
|
||||
if (( mlat_result_sources == 0 ))
|
||||
then
|
||||
echo "[$(date)][mlathub] No MLAT servers have been defined in MLAT_CONFIG - no need to start MLATHUB"
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] No MLAT servers have been defined in MLAT_CONFIG - no need to start MLATHUB"
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
# removed as it will cause looping:
|
||||
# handle MLATHUB_ENABLE_ADSB_INGEST (if set, connect to readsb as input)
|
||||
# if [[ -n "$MLATHUB_ENABLE_ADSB_INGEST" ]]; then
|
||||
# MLATHUB_CMD+=("--net-connector=localhost,30006,beast_in")
|
||||
# fi
|
||||
|
||||
# Add any additional net_connectors:
|
||||
if [[ -n "$MLATHUB_NET_CONNECTOR" ]]; then
|
||||
# Strip any extraneous spaces:
|
||||
MLATHUB_NET_CONNECTOR="${MLATHUB_NET_CONNECTOR#"${MLATHUB_NET_CONNECTOR%%[![:space:]]*}"}" # strip leading spaces
|
||||
MLATHUB_NET_CONNECTOR="${MLATHUB_NET_CONNECTOR//; /;}" # strip space after semicolon
|
||||
IFS=';' read -r -a MLATHUB_NET_CONNECTOR_ARRAY <<< "$MLATHUB_NET_CONNECTOR"
|
||||
for NET_CONNECTOR_ELEMENT in "${MLATHUB_NET_CONNECTOR_ARRAY[@]}"
|
||||
do
|
||||
MLATHUB_CMD+=("--net-connector=${NET_CONNECTOR_ELEMENT// /}")
|
||||
MLATHUB_CMD+=("--net-connector=${NET_CONNECTOR_ELEMENT}")
|
||||
done
|
||||
fi
|
||||
|
||||
# Handle ULTRAFEEDER_CONFIG / ULTRAFEEDER_NET_CONNECTOR elements relevant to readsb:
|
||||
[[ "${#MLATHUB_CONF_ARR[@]}" -gt 0 ]] && MLATHUB_CMD+=("${MLATHUB_CONF_ARR[@]}") || true
|
||||
|
||||
if chk_enabled "${READSB_DEBUG}"; then
|
||||
MLATHUB_CMD+=("--debug=$READSB_DEBUG")
|
||||
fi
|
||||
|
@ -106,7 +108,7 @@ MLATHUB_CMD+=("--net-heartbeat=${READSB_NET_HEARTBEAT:-30}")
|
|||
|
||||
if [[ ! -f /run/mlathub_up ]]
|
||||
then
|
||||
echo "[$(date)][mlathub] Delaying MLAT hub start until container is established..."
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] Delaying MLAT hub start until container is established..."
|
||||
while [[ ! -f /run/mlathub_up ]]
|
||||
do
|
||||
sleep 2
|
||||
|
@ -114,18 +116,18 @@ then
|
|||
fi
|
||||
sleep 5 # sleep a bit so everything is well established
|
||||
|
||||
echo "[$(date)][mlathub] Starting MLATHUB..."
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] Starting MLATHUB..."
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then
|
||||
"${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS 2>&1 | \
|
||||
mawk -W Interactive '{print "[" strftime("%Y/%m/%d %H:%M:%S", systime()) "][mlathub] " $0}'
|
||||
mawk -W Interactive '{print "[" strftime("%Y-%m-%d %H:%M:%S", systime()) "][mlathub] " $0}'
|
||||
elif [[ "${LOGLEVEL,,}" == "error" ]]; then
|
||||
"${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS 2>&1 >/dev/null | \
|
||||
mawk -W Interactive '{print "[" strftime("%Y/%m/%d %H:%M:%S", systime()) "][mlathub] " $0}'
|
||||
mawk -W Interactive '{print "[" strftime("%Y-%m-%d %H:%M:%S", systime()) "][mlathub] " $0}'
|
||||
elif [[ "${LOGLEVEL,,}" == "none" ]]; then
|
||||
"${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][mlathub] The mlathub instance has exited. Restarting in 10 seconds."
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] The mlathub instance has exited. Restarting in 10 seconds."
|
||||
sleep 10
|
|
@ -1,7 +1,10 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash disable=SC2016,SC1091
|
||||
|
||||
APPNAME="readsb"
|
||||
|
||||
source /scripts/common
|
||||
source /scripts/interpret_ultrafeeder_config
|
||||
|
||||
mkdir -p /run/readsb
|
||||
|
||||
|
@ -61,12 +64,12 @@ if ! chk_enabled "$READSB_NET_SBS_DISABLE_REDUCE"; then
|
|||
fi
|
||||
|
||||
if chk_enabled "${READSB_FORWARD_MLAT}"; then
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")][readsb] WARNING -- READSB_FORWARD_MLAT has been set! Do not feed the output of this container to any aggregators!"
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")][${APPNAME}] WARNING -- READSB_FORWARD_MLAT has been set! Do not feed the output of this container to any aggregators!"
|
||||
READSB_CMD+=("--forward-mlat")
|
||||
fi
|
||||
|
||||
if chk_enabled "${READSB_FORWARD_MLAT_SBS}"; then
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")][readsb] WARNING -- READSB_FORWARD_MLAT_SBS has been set! Do not feed the SBS (BaseStation) output of this container to any aggregators!"
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")][${APPNAME}] WARNING -- READSB_FORWARD_MLAT_SBS has been set! Do not feed the SBS (BaseStation) output of this container to any aggregators!"
|
||||
READSB_CMD+=("--forward-mlat-sbs")
|
||||
fi
|
||||
|
||||
|
@ -168,6 +171,9 @@ fi
|
|||
|
||||
# Handle "--net-connector=<ip,port,protocol>"
|
||||
if [[ -n "$READSB_NET_CONNECTOR" ]]; then
|
||||
# Strip any extraneous spaces:
|
||||
READSB_NET_CONNECTOR="${READSB_NET_CONNECTOR#"${READSB_NET_CONNECTOR%%[![:space:]]*}"}" # strip leading space
|
||||
READSB_NET_CONNECTOR="${READSB_NET_CONNECTOR//; /;}"
|
||||
IFS=';' read -r -a READSB_NET_CONNECTOR_ARRAY <<< "$READSB_NET_CONNECTOR"
|
||||
for NET_CONNECTOR_ELEMENT in "${READSB_NET_CONNECTOR_ARRAY[@]}"
|
||||
do
|
||||
|
@ -175,6 +181,9 @@ if [[ -n "$READSB_NET_CONNECTOR" ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
# Handle ULTRAFEEDER_CONFIG / ULTRAFEEDER_NET_CONNECTOR elements relevant to readsb:
|
||||
[[ "${#READSB_CONF_ARR[@]}" > 0 ]] && READSB_CMD+=("${READSB_CONF_ARR[@]}") || true
|
||||
|
||||
# Handle "--net-connector-delay=<seconds>"
|
||||
if [[ -n "$READSB_NET_CONNECTOR_DELAY" ]]; then
|
||||
READSB_CMD+=("--net-connector-delay=$READSB_NET_CONNECTOR_DELAY")
|
||||
|
@ -320,7 +329,7 @@ elif [[ "${LOGLEVEL,,}" == "none" ]]; then
|
|||
"${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][readsb] The main readsb instance has exited. Restarting in 10 seconds."
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")][${APPNAME}] The main readsb instance has exited. Restarting in 10 seconds."
|
||||
sleep 10
|
||||
|
||||
|
||||
|
|
123
rootfs/scripts/interpret_ultrafeeder_config
Executable file
123
rootfs/scripts/interpret_ultrafeeder_config
Executable file
|
@ -0,0 +1,123 @@
|
|||
# shellcheck shell=bash disable=SC2015
|
||||
#
|
||||
# This scripts should be sourced by the /etc/services.d/xxx/run modules for
|
||||
# readsb, mlat-client, and mlathub. It interprets the ULTRAFEEDER_CONFIG / ULTRAFEEDER_NET_CONNECTOR parameter
|
||||
# and makes individual net-connector strings available for these three modules.
|
||||
#
|
||||
#---------------------------------------------------------------------------------------------
|
||||
# Copyright (C) 2023, Ramon F. Kolb (kx1t)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with this program.
|
||||
# If not, see <https://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Note:
|
||||
# ULTRAFEEDER_CONFIG and ULTRAFEEDER_NET_CONNECTOR can be used interchangeably
|
||||
# If both are defined, they will be considered jointly.
|
||||
#
|
||||
# Format:
|
||||
# ULTRAFEEDER_CONFIG=adsb,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
# ULTRAFEEDER_CONFIG=mlat,host,port[,return_port][,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
# ULTRAFEEDER_CONFIG=mlathub,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]
|
||||
#
|
||||
# The ULTRAFEEDER_CONFIG parameter can have multiple config strings, separated by a `;`
|
||||
# Please note that the config strings cannot containe `;` or `,` -- undefined things may happen if these characters are present.
|
||||
#
|
||||
# In the above configuration strings:
|
||||
# `host` is an IP address. Specify an IP/hostname/containername for incoming or outgoing connections.
|
||||
# `port` is a TCP port number
|
||||
# `protocol` can be one of the following:
|
||||
# `beast_reduce_out`: Beast-format output with lower data throughput (saves bandwidth and CPU)
|
||||
# `beast_reduce_plus_out`: Beast-format output with extra data (UUID). This is the preferred format when feeding the "new" aggregator services
|
||||
# `beast_out`: Beast-format output
|
||||
# `beast_in`: Beast-format input
|
||||
# `raw_out`: Raw output
|
||||
# `raw_in`: Raw input
|
||||
# `sbs_out`: SBS-format output
|
||||
# `vrs_out`: SBS-format output
|
||||
# `uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` is an optional parameter that sets the UUID for this specific instance.
|
||||
# It will override the global `UUID` parameter. This is only needed when you want to send different UUIDs to different aggregators.
|
||||
# `extra-arguments` can be any additional command line argument you want to pass to readsb, mlathub, or mlat-client
|
||||
# Example: `--net-only`. Please make sure to only once pass in an extra argument for each of the adsb|mlat|mlathub service.
|
||||
|
||||
# Do some prep work:
|
||||
# combine ULTRAFEEDER_CONFIG and ULTRAFEEDER_NET_CONNECTOR
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG}${ULTRAFEEDER_CONFIG:+;}${ULTRAFEEDER_NET_CONNECTOR}"
|
||||
# Strip any extraneous spaces:
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG#"${ULTRAFEEDER_CONFIG%%[![:space:]]*}"}" # strip leading space
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG//; /;}"
|
||||
|
||||
# Now read each entry and parse it:
|
||||
|
||||
READSB_CONF_ARR=()
|
||||
MLATHUB_CONF_ARR=()
|
||||
|
||||
readarray -td ";" configs < <(printf '%s' "${ULTRAFEEDER_CONFIG}")
|
||||
|
||||
# Now loop through the MLAT_CONFIG items and start up an Mlat_client for each of them:
|
||||
for instance in "${configs[@]}"
|
||||
do
|
||||
[[ -z "${instance}" ]] && continue || true
|
||||
# put individual params into the $params array:
|
||||
readarray -td "," param < <(printf '%s' "${instance}")
|
||||
|
||||
# Process based on parameter string type in param[0]:
|
||||
param[0]="${param[0],,}"
|
||||
case "${param[0]}" in
|
||||
|
||||
adsb)
|
||||
# parse arguments for main readsb
|
||||
# build net-connector string into $readsb_str
|
||||
# and add any extra arguments in as individual entries into READSB_CONF_ARR()
|
||||
readsb_str="${param[1]},${param[2]},${param[3]}"
|
||||
for ((i=4; i<${#param[*]}; i++))
|
||||
do
|
||||
if [[ "${param[i]:0:5}" == "uuid=" ]]; then
|
||||
readsb_str="${readsb_str},${param[i]}"
|
||||
elif [[ -n "${param[i]}" ]]; then
|
||||
READSB_CONF_ARR+=("${param[i]}")
|
||||
fi
|
||||
done
|
||||
# Now add $readsb_str to the READSB_CONF_ARR() as --net-connector argument:
|
||||
READSB_CONF_ARR+=("--net-connector=${readsb_str}")
|
||||
;;
|
||||
|
||||
mlat)
|
||||
# parse arguments for the individual MLAT clients.
|
||||
# In this case, the mlat-client run module will interpret everything
|
||||
# as long as it is in the MLAT_CONFIG parameter. So we'll just add that here.
|
||||
MLAT_CONFIG="${MLAT_CONFIG}${MLAT_CONFIG:+;}${instance#*,}"
|
||||
;;
|
||||
|
||||
mlathub)
|
||||
# parse arguments for mlat_hub
|
||||
# build net-connector string into $readsb_str
|
||||
# and add any extra arguments in as individual entries into MLATHUB_CONF_STR()
|
||||
mlathub_str="${param[1]},${param[2]},${param[3]}"
|
||||
for ((i=4; i<${#param[*]}; i++))
|
||||
do
|
||||
if [[ "${param[i]:0:5}" == "uuid=" ]]; then
|
||||
mlathub_str="${readsb_str},${param[i]}"
|
||||
elif [[ -n "${param[i]}" ]]; then
|
||||
MLATHUB_CONF_ARR+=("${param[i]}")
|
||||
fi
|
||||
done
|
||||
# Now add $readsb_str to the READSB_CONF_STR as --net-connector argument:
|
||||
MLATHUB_CONF_ARR+=("--net-connector=${mlathub_str}")
|
||||
;;
|
||||
|
||||
*)
|
||||
# unknown string; warn and skip
|
||||
echo "[$(date)][${APPNAME}] Warning: skipping unknown ULTRAFEEDER_CONFIG config element \"${instance}\""
|
||||
esac
|
||||
|
||||
done
|
Loading…
Reference in a new issue