Skip to content

Commit

Permalink
feat(feed): add radarbox support (#135)
Browse files Browse the repository at this point in the history
* feat(feed): add radarbox support
* feat(feed): readme with real logs
* feat(feed): add warning about segfault, add docker-compose conf
  • Loading branch information
Thom-x authored Jun 23, 2023
1 parent 0293167 commit 912c641
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 21 deletions.
93 changes: 85 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,62 @@ RUN set -x && \
# mlat-client: simple test
/usr/local/share/adsbexchange/venv/bin/python3 -c 'import mlat.client'

FROM debian:bullseye as radarbox

# git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/mutability/mlat-client.git' | cut -d '/' -f 3 | grep '^v.*' | tail -1
ENV RADARBOX_MLAT_VERSION v0.2.12

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /tmp
RUN set -x && \
dpkg --add-architecture armhf && \
apt-get update && \
apt-get install -y --no-install-suggests --no-install-recommends \
ca-certificates \
binutils \
wget \
gnupg \
build-essential \
git \
python3-minimal \
python3-distutils \
python3-venv \
libpython3-dev \
libc6:armhf \
libcurl4:armhf \
libglib2.0-0:armhf \
libjansson4:armhf \
libprotobuf-c1:armhf \
librtlsdr0:armhf \
netbase \
xz-utils && \
rm -rf /var/lib/apt/lists/* && \
dpkg --add-architecture armhf && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D043681 && \
bash -c "echo 'deb https://apt.rb24.com/ bullseye main' > /etc/apt/sources.list.d/rb24.list" && \
apt-get update && \
# download rbfeeder deb
cd /tmp && \
apt-get download rbfeeder:armhf && \
# extract rbfeeder deb
ar xv ./rbfeeder_*armhf.deb && \
tar xvf ./data.tar.xz -C / && \
# mlat-client
SRCTMP=/srctmp && \
URL=https://github.com/mutability/mlat-client && \
mkdir -p $SRCTMP && wget -O ${SRCTMP}.tar.gz ${URL}/archive/refs/tags/${RADARBOX_MLAT_VERSION}.tar.gz && tar xf ${SRCTMP}.tar.gz -C ${SRCTMP} --strip-components=1 && \
pushd ${SRCTMP} && \
VENV="/usr/local/share/radarbox-mlat-client/venv" && \
python3 -m venv "${VENV}" && \
source "${VENV}/bin/activate" && \
./setup.py build && \
./setup.py install && \
deactivate && \
popd && \
rm -rf ${SRCTMP} ${SRCTMP}.tar.gz && \
# mlat-client: simple test
/usr/local/share/radarbox-mlat-client/venv/bin/python3 -c 'import mlat.client'

# THTTPD
FROM alpine:3.13.2 AS thttpd

Expand Down Expand Up @@ -185,6 +241,9 @@ RUN mv /copy_root/tcltls-rebuild/tcl-tls_*.deb /copy_root/tcl-tls.deb && \
rm -rf /copy_root/tcltls-rebuild
COPY --from=thttpd /thttpd/thttpd /copy_root/
COPY --from=confd /opt/confd/bin/confd /copy_root/opt/confd/bin/
COPY --from=radarbox /usr/bin/rbfeeder /copy_root/usr/bin/rbfeeder_armhf
COPY --from=radarbox /usr/bin/dump1090-rb /copy_root/usr/bin/dump1090-rbs
COPY --from=radarbox /usr/local/share/radarbox-mlat-client /copy_root/usr/local/share/radarbox-mlat-client
ADD build /copy_root/build

FROM debian:bullseye-slim as serve
Expand All @@ -211,6 +270,7 @@ ENV SERVICE_ENABLE_ADSBEXCHANGE false
ENV SERVICE_ENABLE_PLANEFINDER false
ENV SERVICE_ENABLE_OPENSKY false
ENV SERVICE_ENABLE_ADSBFI false
ENV SERVICE_ENABLE_RADARBOX false

# System properties
ENV SYSTEM_HTTP_ULIMIT_N -1
Expand All @@ -223,13 +283,10 @@ COPY --from=copyall /copy_root/ /

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN arch=$(dpkg --print-architecture) && \
if [ "$arch" == "arm64" ] || [ "$arch" == "armel" ] ; then \
dpkg --add-architecture armhf && \
RUN dpkg --add-architecture armhf && \
apt-get update && \
apt-get install -y libc6:armhf libstdc++6:armhf libusb-1.0-0:armhf lsb-base:armhf; \
ldconfig; \
fi && \
apt-get install -y libc6:armhf libstdc++6:armhf libusb-1.0-0:armhf lsb-base:armhf && \
ldconfig && \
apt-get update && \
# rtl-sdr
apt-get install -y \
Expand Down Expand Up @@ -265,7 +322,21 @@ RUN arch=$(dpkg --print-architecture) && \
python3-venv \
curl \
gzip \
# radarbox
qemu-user-static \
build-essential \
python3-minimal \
python3-distutils \
libcurl4:armhf \
libglib2.0-0:armhf \
libjansson4:armhf \
libprotobuf-c1:armhf \
librtlsdr0:armhf \
netbase \
&& \
# Simple checks qemu
qemu-arm-static --version && \
qemu-aarch64-static --version && \
# RTL-SDR
cd /tmp && \
mkdir -p /etc/modprobe.d && \
Expand Down Expand Up @@ -313,6 +384,9 @@ RUN arch=$(dpkg --print-architecture) && \
ar vx ./*.deb && \
tar xvf data.tar.xz -C / && \
mkdir -p /var/lib/openskyd/conf.d && \
# Radarbox : create symlink for rbfeeder wrapper
mv /build/rbfeeder_wrapper.sh /usr/bin/rbfeeder_wrapper.sh && \
ln -s /usr/bin/rbfeeder_wrapper.sh /usr/bin/rbfeeder && \
# THTTPD
find /usr/lib/fr24/public_html -type d -print0 | xargs -0 chmod 0755 && \
find /usr/lib/fr24/public_html -type f -print0 | xargs -0 chmod 0644 && \
Expand All @@ -326,6 +400,9 @@ RUN arch=$(dpkg --print-architecture) && \
# PLANEFINDER
/build/planefinder.sh && \
/planefinder/pfclient --version && \
# RADARBOX
/usr/local/share/radarbox-mlat-client/venv/bin/mlat-client --help && \
/usr/bin/rbfeeder --version && \
# CONFD
/opt/confd/bin/confd --version && \
# S6 OVERLAY
Expand All @@ -334,11 +411,11 @@ RUN arch=$(dpkg --print-architecture) && \
rm -rf /build && \
apt-get purge -y \
xz-utils \
build-essential \
devscripts \
pkg-config \
git-core \
cmake \
build-essential && \
cmake && \
apt autoremove -y && \
rm -rf /var/lib/apt/lists/*

Expand Down
70 changes: 61 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ docker run -d -p 8080:8080 -p 8754:8754 \
-e "SERVICE_ENABLE_ADSBFI=true" \
-e "ADSBFI_UUID=MY_UUID" \
-e "ADSBFI_STATION_NAME=MY_STATION_NAME" \
-e "SERVICE_ENABLE_RADARBOX=true" \
-e "RADARBOX_SHARING_KEY=MY_RADARBOX_SHARING_KEY" \
--tmpfs /run:exec,size=32M \
--tmpfs /planefinder/log:exec,size=32M \
--tmpfs /usr/lib/fr24/public_html/data:size=32M \
Expand Down Expand Up @@ -83,6 +85,7 @@ To disable starting a service you can add an environement variable :
| `SERVICE_ENABLE_PLANEFINDER` | `false` | Disable plane finder feed | `false` |
| `SERVICE_ENABLE_OPENSKY` | `false` | Disable opensky feeder | `false` |
| `SERVICE_ENABLE_ADSBFI` | `false` | Disable adsb.fi feeder | `false` |
| `SERVICE_ENABLE_RADARBOX` | `false` | Disable radarbox feeder | `false` |


Ex : `-e "SERVICE_ENABLE_HTTP=false"`
Expand Down Expand Up @@ -182,9 +185,9 @@ Add the environment variable `SERVICE_ENABLE_ADSBFI` and set it to `true`.

| Environment Variable | Description | Default value |
| ----------------------------- | ------------------------- | ------------- |
| `ADSBFI_UUID` | uuid (required) | empty |
| `ADSBFI_STATION_NAME` | station name | empty |
| `ADSBFI_MLAT` | mlat | `true` |
| `ADSBFI_UUID` | Uuid (required) | empty |
| `ADSBFI_STATION_NAME` | Station name | empty |
| `ADSBFI_MLAT` | Enable/disable MLAT | `true` |

Configure the MLAT coordinates so that adsbfi MLAT can work. (see its own section below)
If you don't want to supply your exact coordinates, please set the `ADSBFI_MLAT` environment variable to `false`. (you won't get MLAT results and won't contribute to MLAT)
Expand All @@ -208,9 +211,9 @@ It's important for MLAT accuracy that these aren't off by more than about 10 m /

| Environment Variable | Description | Default value |
| -------------------------- | ------------------------- | ------------- |
| `MLAT_EXACT_LAT` | decimal latitude | empty |
| `MLAT_EXACT_LON` | decimal longitude | empty |
| `MLAT_ALTITUDE_MSL_METERS` | altitude above MSL in m | empty |
| `MLAT_EXACT_LAT` | Decimal latitude | empty |
| `MLAT_EXACT_LON` | Decimal longitude | empty |
| `MLAT_ALTITUDE_MSL_METERS` | Altitude above MSL in m | empty |

## Plane Finder

Expand Down Expand Up @@ -254,7 +257,7 @@ Ex : `-e "SERVICE_ENABLE_PLANEFINDER=true" -e "PLANEFINDER_SHARECODE=65dsfsd56f"

First-time users should obtain a Opensky serial.

In order to obtain a Opensky serial, we will start a temporary container running minimal configuration to have opensky up and running, which will generate it.
In order to obtain an Opensky serial, we will start a temporary container running minimal configuration to have opensky up and running, which will generate it.

Run :

Expand Down Expand Up @@ -297,6 +300,55 @@ Add the environment variable `SERVICE_ENABLE_OPENSKY` and set it to `true`.

Ex : `-e "SERVICE_ENABLE_OPENSKY=true" -e "OPENSKY_USERNAME=MyUserName" -e "OPENSKY_SERIAL=-462168426854"`

## Radarbox

First-time users should obtain a sharing key.

In order to obtain a sharing key, we will start a temporary container running minimal configuration to have radarbox up and running, which will generate it.

Run :

```
docker run -it --rm \
-e "SERVICE_ENABLE_RADARBOX=true" \
-e "SERVICE_ENABLE_DUMP1090=false" \
-e "SERVICE_ENABLE_HTTP=false" \
-e "SERVICE_ENABLE_PIAWARE=false" \
-e "SERVICE_ENABLE_FR24FEED=false" \
-e "HTML_SITE_LAT=45" \
-e "HTML_SITE_LON=9" \
-e "HTML_SITE_ALT=0" \
thomx/fr24feed-piaware /bin/bash
```

Once the container has started, you should see a message such as:

```text
[radarbox-feeder] [2023-06-20 18:51:01] CPU Serial empty. Use MAC address instead.
[radarbox-feeder] [2023-06-20 18:51:02] Your new key is 35345bf2258aea6b9c7280fbe4467fcd. Please save this key for future use. You will have to know this key to link this receiver to your account in RadarBox24.com. This key is also saved in configuration file (/etc/rbfeeder.ini)
```

Note the serial and add it for next run to `RADARBOX_SHARING_KEY` environement variable.

You can now kill the container by pressing `CTRL-D`.

Add the environment variable `SERVICE_ENABLE_RADARBOX` and set it to `true`.

| Environment Variable | Default value | Description |
| ----------------------- | ------------- | ------------------------------------------------ |
| `RADARBOX_SHARING_KEY` | empty | Generated sharing key (required after first run) |
| `RADARBOX_INPUT_HOST` | `127.0.0.1` | Input host |
| `RADARBOX_INPUT_PORT` | `30005` | Input port |
| `RADARBOX_MLAT ` | `false` | Enable/disable MLAT |
| `HTML_SITE_LAT` | `45.0` | Receiver latitude |
| `HTML_SITE_LON` | `9.0` | Receiver longitude |
| `HTML_SITE_ALT` | `0` | Receiver altitude |

Ex : `-e "SERVICE_ENABLE_RADARBOX=true" -e "RADARBOX_SHARING_KEY=35345bf2258aea6b9c7280fbe4467fcd"`

_Note : You may have this error on windows `[radarbox-feeder] /usr/bin/rbfeeder: line 17: 208 Segmentation fault /usr/bin/rbfeeder_armhf "$@"`, there is no solution to it._
_Note : You may have seg fault error, see https://github.com/mikenye/docker-radarbox/issues/9#issuecomment-633068833 for resolution_

## Add custom properties

**Note** : you can add any property to either fr24feed or piaware configuration file by adding an environment variable starting with `PIAWARE_...` or `FR24FEED_...`.
Expand Down Expand Up @@ -356,7 +408,7 @@ Create a panorama for your receiver location on http://www.heywhatsthat.com.

| Environment Variable | Default value | Description |
| -------------------- | ------------- | ------------------------------------------ |
| `PANORAMA_ID` | | Panorama id |
| `PANORAMA_ID` | empty | Panorama id |
| `PANORAMA_ALTS` | `1000,10000` | Comma seperated list of altitudes in meter |

_Note : the panorama id value correspond to the URL at the top of the panorama http://www.heywhatsthat.com/?view=XXXX, altitudes are in meters, you can specify a list of altitudes._
Expand All @@ -376,7 +428,7 @@ See: https://openweathermap.org/price

| Environment Variable | Default value | Description |
| -------------------- | ------------- | ------------------------ |
| `LAYERS_OWM_API_KEY` | | Open Weather Map API Key |
| `LAYERS_OWM_API_KEY` | empty | Open Weather Map API Key |

Ex : `-e "LAYERS_OWM_API_KEY=dsf1ds65f4d2f65g"`

Expand Down
17 changes: 17 additions & 0 deletions build/rbfeeder_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# This wrapper file will determine how to run rbfeeder, either natively or via qemu-arm-static.
# All command line arguments passed to this script will be passed directly to rbfeeder_armhf.

# attempt to run natively
if /usr/bin/rbfeeder_armhf --no-start --version >/dev/null 2>&1; then
/usr/bin/rbfeeder_armhf "$@"
elif qemu-arm-static /usr/bin/rbfeeder_armhf --no-start --version >/dev/null 2>&1; then
qemu-arm-static /usr/bin/rbfeeder_armhf "$@"
else
for i in {1..5}; do
echo "FATAL: Could not run rbfeeder natively or via qemu!" | mawk -W interactive '{printf "%c[34m[radarbox-feeder]%c[0m %s\n", 27, 27, $0}'
done
kill 1
exit 1
fi
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ services:
- "SERVICE_ENABLE_ADSBFI=true"
- "ADSBFI_UUID=MY_UUID"
- "ADSBFI_STATION_NAME=MY_STATION_NAME"
- "SERVICE_ENABLE_RADARBOX=true"
- "RADARBOX_SHARING_KEY=MY_SHARING_KEY"
devices:
- "/dev/bus/usb"
# ports
Expand Down
11 changes: 11 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/adsbfi-mlat/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/command/with-contenv bash

if [ "$SERVICE_ENABLE_ADSBFI" != "false" ]; then

default_value() {
key=${1//\-/_DASH_}
key=ADSBFI_${key^^}
eval "value=\${$key:-\$2}"
printf -v $key -- "$value"
export $key
}

default_value "mlat" "false"

if [ "$ADSBFI_MLAT" == "no" ] || [ "$ADSBFI_MLAT" == "false" ]; then
tail -f /dev/null
exit 0
Expand Down
4 changes: 0 additions & 4 deletions root/etc/s6-overlay/s6-rc.d/conf-opensky/script
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ if [ "$SERVICE_ENABLE_OPENSKY" != "false" ]; then
default_value_html "site_lon" "9.0"
default_value_html "site_alt" "0"

default_value "site_alt" "0"
default_value "site_alt" "0"
default_value "site_alt" "0"

default_value "device_type" "default"
default_value "input_host" "127.0.0.1"
default_value "input_port" "30005"
Expand Down
Loading

0 comments on commit 912c641

Please sign in to comment.