Skip to content

Commit

Permalink
Add UAT support; build and logging improvements (#237)
Browse files Browse the repository at this point in the history
* initial commit with new UAT feeder

* add signup script, update README

* saveguarding around signup-uat.sh

* temp thing

* more experiments

* more experiments

* update

* updates

* updates

* updates

* typo

* updates

* update

* debug

* updates

* update

* update

* update

* updates

* silence wget

* make wget less verbose

* updates

* update

* move file

* Update fr24feed

* Update fr24uat-feed

* Update Dockerfile

* reduce logging

* dockerfile improvements

* bugfix

* updates to readme

* improve logging

* logging improvements

* logging improvements

* make x86 use qemu to ensure latest version is used

* update

* Update fr24feed

* Update fr24uat-feed

* Update fr24feed-log

* Update fr24feed-log

* Update fr24feed-log

* Update fr24feed-log

* updates

* Update fr24uat-feed

* Update Dockerfile

* Update fr24feed-log

* Update fr24feed

* Update fr24feed

* Update fr24uat-feed

* Update fr24feed

* Update fr24uat-feed

* Update fr24uat-feed

* Update fr24uat-feed

* Update fr24feed

* Update install_feeder.sh

* Update install_feeder.sh

* Update install_feeder.sh

* Update install_feeder.sh

* Update install_feeder.sh

* Update get_adsb_key.sh

* Update get_uat_key.sh

* Update install_feeder.sh

* script improvements (#236)

* safeguard against fast loop in fr24feed_check_traffic

output potential errors of tcpdump in fr24feed_check_traffic

* remove redundant things from fr24feed start scripts

* Update fr24feed_check_traffic

* Update fr24feed_check_traffic

---------

Co-authored-by: kx1t <[email protected]>

* remove separate logging; updated healthscript; other minor changes

* fixing file names

* typos

* updates

---------

Co-authored-by: wiedehopf <[email protected]>
  • Loading branch information
kx1t and wiedehopf authored Feb 14, 2024
1 parent d650d80 commit 6b96d48
Show file tree
Hide file tree
Showing 25 changed files with 411 additions and 201 deletions.
66 changes: 18 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base as build
COPY install_feeder.sh /
RUN /install_feeder.sh

FROM ghcr.io/sdr-enthusiasts/docker-baseimage:qemu

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand All @@ -10,7 +14,8 @@ ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \

ARG TARGETPLATFORM

COPY rootfs/ /
COPY --from=build /usr/bin/fr24feed /usr/bin/fr24feed
COPY --from=build /usr/bin/fr24feed-status /usr/bin/fr24feed-status

# NEW STUFF BELOW
# hadolint ignore=DL3008,SC2086,SC2039,SC2068
Expand All @@ -19,62 +24,25 @@ RUN set -x && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
# 'expect' required for signup
KEPT_PACKAGES+=(expect) && \
#KEPT_PACKAGES+=(expect) && \
# required monitor incoming traffic from beasthost
KEPT_PACKAGES+=(tcpdump) && \
# required for adding fr24 repo
TEMP_PACKAGES+=(gnupg) && \
#KEPT_PACKAGES+=(gnupg) && \
# required to extract .deb file
TEMP_PACKAGES+=(binutils) && \
#KEPT_PACKAGES+=(binutils) && \
# required to figure out fr24feed for amd64
TEMP_PACKAGES+=(jq) && \
KEPT_PACKAGES+=(jq) && \
# install packages
#KEPT_PACKAGES+=(dirmngr) && \
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" \
&& \
# import flightradar24 gpg key
gpg --list-keys && \
gpg \
--no-default-keyring \
--keyring /usr/share/keyrings/flightradar24.gpg \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys C969F07840C430F5 \
&& \
gpg --list-keys && \
# get fr24feed:
# instead of apt-get install, we use apt-get download.
# this is done because the package has dependencies,
# which we don't want in a container.
# also, there are pre/post install tasks that won't work cross platform.
# instead, we download, extract and manually install rbfeeder,
# and install the dependencies manually.
# add flightradar24 repo
mkdir -p /tmp/fr24feed && \
pushd /tmp/fr24feed && \
if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
curl -sSLO "$(curl -sSL "https://repo-feed.flightradar24.com/fr24feed_versions.json" | jq -r '.platform["linux_x86_64_deb"]["url"]["software"]')"; \
elif [ "$TARGETPLATFORM" = "linux/386" ] ; then \
curl -sSLO "$(curl -sSL "https://repo-feed.flightradar24.com/fr24feed_versions.json" | jq -r '.platform["linux_x86_deb"]["url"]["software"]')"; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
curl -sSLO "$(curl -sSL "https://repo-feed.flightradar24.com/fr24feed_versions.json" | jq -r '.platform["linux_arm64_deb"]["url"]["software"]')"; \
else \
echo 'deb [arch=armhf signed-by=/usr/share/keyrings/flightradar24.gpg] http://repo.feed.flightradar24.com flightradar24 raspberrypi-stable' > /etc/apt/sources.list.d/flightradar24.list && \
apt-get update && \
apt-get download fr24feed:armhf; \
fi && \
popd && \
# extract .deb file
ar x --output=/tmp/fr24feed -- /tmp/fr24feed/*.deb && \
# extract data.tar.gz file
mkdir -p /tmp/fr24feed/extracted && \
tar xvf /tmp/fr24feed/data.tar.gz -C /tmp/fr24feed/extracted && \
# copy required files
cp -v /tmp/fr24feed/extracted/usr/bin/fr24feed /usr/local/bin/fr24feed && \
cp -v /tmp/fr24feed/extracted/usr/bin/fr24feed-status /usr/local/bin/fr24feed-status && \
chmod -v a+x /usr/local/bin/fr24feed /usr/local/bin/fr24feed-status && \
# Clean up
"${TEMP_PACKAGES[@]}" && \
#
ln -s /usr/bin/fr24feed /usr/local/bin/fr24feed && \
ln -s /usr/bin/fr24feed-status /usr/local/bin/fr24feed-status && \
sed -i 's|systemctl status fr24feed|grep -q /bin/fr24feed <<< $(ps -ef)|g' /usr/bin/fr24feed-status && \
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -y && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/* && \
Expand All @@ -86,6 +54,8 @@ RUN set -x && \
&& \
cat /CONTAINER_VERSION

COPY rootfs/ /

EXPOSE 30334/tcp 8754/tcp 30003/tcp

# Add healthcheck
Expand Down
134 changes: 62 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# sdr-enthusiasts/docker-flightradar24

[![Docker Image Size (tag)](https://img.shields.io/docker/image-size/mikenye/fr24feed/latest)](https://hub.docker.com/r/mikenye/fr24feed)
![Build Passing](https://img.shields.io/github/actions/workflow/status/sdr-enthusiasts/docker-flightradar24/deploy.yml?branch=main)
![Contributors](https://img.shields.io/github/contributors/sdr-enthusiasts/docker-flightradar24)
![Last Commit](https://img.shields.io/github/last-commit/sdr-enthusiasts/docker-planefence)
[![Discord](https://img.shields.io/discord/734090820684349521)](https://discord.gg/sTf9uYF)

Docker container running FlightRadar24's `fr24feed`. Designed to work in tandem with [sdr-enthusiasts/docker-readsb-protobuf](https://github.com/sdr-enthusiasts/docker-readsb-protobuf). Builds and runs on `x86_64`, `arm32v6`, `arm32v7` & `arm64`.
Docker container running FlightRadar24's `fr24feed`. Designed to work in tandem with [ultrafeeder](https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder) or any other BEAST formal data source. Builds and runs on `x86_64`, `armhf` & `arm64`.

`fr24feed` pulls ModeS/BEAST information from the [sdr-enthusiasts/docker-readsb-protobuf](https://github.com/sdr-enthusiasts/docker-readsb-protobuf) (or another host providing ModeS/BEAST data), and sends data to FlightRadar24.
`docker-flightradar24` pulls ModeS/BEAST information from the [ultrafeeder container](https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder) (or another host providing ModeS/BEAST data), and sends data to FlightRadar24.

For more information on what fr24feed is, see here: [share-your-data](https://www.flightradar24.com/share-your-data).

Expand All @@ -15,82 +17,27 @@ For more information on what fr24feed is, see here: [share-your-data](https://ww
- `latest_nohealthcheck` is the same as the `latest` version above. However, this version has the docker healthcheck removed. This is done for people running platforms (such as [Nomad](https://www.nomadproject.io)) that don't support manually disabling healthchecks, where healthchecks are not wanted.
- Version and architecture specific tags available

## Obtaining a Flightradar24 Sharing Key
## Obtaining a Flightradar24 Sharing Key for ADSB

First-time users should obtain a Flightradar24 sharing key.

In order to obtain a Flightradar24 sharing key, initially run the container as-per one of the methods below.
If you don't already have a FlightRadar24 account, then first go to the [FlightRadar24](https://flightradar24.com) website and create an account. Remember the email address you used; you will be asked for it later.
Then copy and paste the following command on your target machine (or really any armhf/arm64/x86_64 linux machine with Docker installed):

### Script Method

Run the following command to temporarily start the container and complete the automated signup process:

```shell
docker run \
--rm \
-it \
-e FEEDER_LAT="YOUR_FEEDER_LAT" \
-e FEEDER_LONG="YOUR_FEEDER_LONG" \
-e FEEDER_ALT_FT="YOUR_FEEDER_ALT_FT" \
-e FR24_EMAIL="[email protected]" \
-e FR24_SIGNUP=1 \
ghcr.io/sdr-enthusiasts/docker-flightradar24:latest
```

Remember to replace:

- `YOUR_FEEDER_LAT` with the latitude of your feeder's antenna
- `YOUR_FEEDER_LONG` with the longitude of your feeder's antenna
- `YOUR_FEEDER_ALT_FT` with the altitude of your feeder's antenna above sea level **in feet**
- `[email protected]` with your email address.

After 30 seconds or so, you should see the following output:

```
FR24_SHARING_KEY=5fa9ca2g9049b615
FR24_RADAR_ID=T-XXXX123
```

Take a note of the sharing key, as you'll need it when launching the container.

### Manual Method

### THIS APPEARS TO BE BROKEN FOR NOW

If the script method fails (please let me know so I can fix it), you can sign up manually.

Temporarily run the container with the following command:

**For ARM platforms:**

```shell
docker run --rm -it --entrypoint /usr/local/bin/fr24feed ghcr.io/sdr-enthusiasts/docker-flightradar24:latest --signup
```

**For other platforms:**

```shell
docker run --rm -it --entrypoint qemu-arm-static ghcr.io/sdr-enthusiasts/docker-flightradar24:latest /usr/local/bin/fr24feed --signup
```bash
docker run -it --rm ghcr.io/sdr-enthusiasts/docker-baseimage:qemu bash -c "$(curl -sSL https://raw.githubusercontent.com/sdr-enthusiasts/docker-flightradar24/main/get_adsb_key.sh)"
```

This will take you through the signup process. Most of the answers don't matter as during normal operation the configuration will be set with environment variables. I would suggest answering as follows:
This will start up a container. After installing a bunch of software (which may take a while depending on the speed of your machine and internet connection), it will take you through the signup process. Most of the answers don't matter as during normal operation the configuration will be set with environment variables. I would suggest answering as follows:

- `Step 1.1 - Enter your email address ([email protected])`: Enter your email address.
- `Step 1.2 - If you used to feed FR24 with ADS-B data before, enter your sharing key.`: Leave blank and press enter.
- `Step 1.3 - Would you like to participate in MLAT calculations?`: Answer `no`.
- `Would you like to continue using these settings?`: Answer `yes`.
- `Step 1.1 - Enter your email address ([email protected])`: Enter your FlightRadar24 account email address
- `Step 1.2 - If you used to feed FR24 with ADS-B data before, enter your sharing key.`: Leave blank and press enter
- `Step 1.3 - Would you like to participate in MLAT calculations?`: Answer `no`
- `Would you like to continue using these settings?`: Answer `yes`
- `Step 4.1 - Receiver selection (in order to run MLAT please use DVB-T stick with dump1090 utility bundled with fr24feed)... Enter your receiver type (1-7)`: Answer `7`.
- `Step 6 - Please select desired logfile mode... Select logfile mode (0-2)`: Answer `0`.

At the end of the signup process, you'll be presented with:

```
Congratulations! You are now registered and ready to share ADS-B data with Flightradar24.
+ Your sharing key (xxxxxxxxxxxx) has been configured and emailed to you for backup purposes.
+ Your radar id is X-XXXXXXX, please include it in all email communication with us.
```

Take a note of the sharing key, as you'll need it when launching the container.
Note that there is a limit of 3 feeders per FR24 account. ADSB and UAT (see below) both count as 1 feeder. If you have more than 3 feeders, you will need to contact <[email protected]> to request an additional Feeder Key. Make sure to send them your account email-address, latitude, longitude, altitude, and if the key is for an ADSB or UAT feeder.

## Up-and-Running with `docker run`

Expand Down Expand Up @@ -135,22 +82,65 @@ There are a series of available environment variables:
| `MLAT` | Set to `yes` to enable MLAT (optional) | `no` |
| `BIND_INTERFACE` | Optional. Set a bind interface such as `0.0.0.0` to allow access from non-private IP addresses | _none_ |
| `VERBOSE_LOGGING` | Set to `true` to enable verbose logging (optional) | `false` |
| `FR24KEY_UAT` | Optional. Only used if you are feeding UAT data - see section below | _empty_ |
| `UATHOST` | Optional. Only used if you are feeding UAT data and you don't use the default value | `dump978` |
| `UATPORT` | Optional. Only used if you are feeding UAT data and you don't use the default value | `30978` |

## Ports

The following ports are used by this container:

- `8754` - fr24feed web interface - optional but recommended
- `8754` - fr24feed (adsb) web interface - optional but recommended
- `8755` - fr24feed-uat web interface - optional, only interesting if you are feeding UAT data
- `30003` - fr24feed TCP BaseStation output listen port - optional, recommended to leave unmapped unless explicitly needed
- `30334` - fr24feed TCP Raw output listen port - optional, recommended to leave unmapped unless explicitly needed

## UAT configuration (USA only)

UAT is a second channel (978 MHz) on which ADSB data is transmitted by some aircraft that only fly at lower altitudes. It is only used in the US. **If you are not in the US (or on its borders), then you can safely skip this section.**

If you have a UAT receiver with an existing `dump978` container or `dump978-fa` deployment, you can add this to your feed following the steps below. Note - if you don't already have a UAT receiver deployed, you should first read and implement [this container](https://github.com/sdr-enthusiasts/docker-dump978) before going any further. We only support UAT deployments with a separate `dump978` container or a separately installed `dump978-fa` instance.

1. Signup for a UAT sharing key. Note - you CANNOT reuse your existing ADSB sharing key. To do so, copy and paste the following command on your target machine (or really any armhf/arm64/x86_64 linux machine with Docker installed):

```bash
docker run -it --rm ghcr.io/sdr-enthusiasts/docker-baseimage:qemu bash -c "$(curl -sSL https://raw.githubusercontent.com/sdr-enthusiasts/docker-flightradar24/main/get_uat_key.sh)"
```

- Step 1.1: Enter the email address associated with your existing (ADSB) FlightRadar24 account.
- Step 1.2: Leave this BLANK - you will get assigned a new key. You cannot reuse your existing ADSB `FR24KEY`.
- Steps 3.A/3.B/3.C: enter your latitude/longitude/height (ft)
- Step 4.1: Enter `2` (DVBT Stick (DUMP978-FA RAW TCP))
- Step 4.2: You can leave the default value of `30978`
- Now you see a text like this:

```text
Congratulations! You are now registered and ready to share UAT data with Flightradar24.
+ Your sharing key (fxxxxxxxxxxx4) has been configured and emailed to you for backup purposes.
+ Your radar id is T-XXXX120, please include it in all email communication with us.
+ Please make sure to start sharing data within one month from now as otherwise your ID/KEY will be deleted.
```

- Make note of your Sharing Key value (`fxxxxxxxxxxx4` in the example above) and add it to the `FR24KEY_UAT` variable
- If your UAT receiver is not the `dump978` container and port `30978`, you can set those as optionally as well:

```yaml
- FR24KEY_UAT=fxxxxxxxxxxx4
- UATHOST=hostname
- UATPORT=12345
```
Note that there is a limit of 3 feeders per FR24 account. ADSB and UAT each count as 1 feeder. If you have more than 3 feeders, you will need to contact <[email protected]> to request an additional Feeder Key. Make sure to send them your account email-address, latitude, longitude, altitude, and if the key is for an ADSB or UAT feeder.
Restart the container. After a few minutes, you can see on [https://www.flightradar24.com/account/data-sharing](https://www.flightradar24.com/account/data-sharing) that data is received.
## Logging
- The `fr24feed` process is logged to the container's stdout, and can be viewed with `docker logs [-f] container`.
- `fr24feed` log file exists at `/var/log/fr24feed.log`, with automatic log rotation.

## Getting Help

Having troubles with the container or have questions? Please [create a new issue](https://github.com/sdr-enthusiasts/docker-flightradar24/issues).
Having troubles with the container or have questions? Best support is available on the #adsb-containers channel of the [SDR-Enthusiasts Discord seerver](https://discord.gg/sTf9uYF). Feel free to [join](https://discord.gg/sTf9uYF) and converse.

I also have a [Discord channel](https://discord.gg/sTf9uYF), feel free to [join](https://discord.gg/sTf9uYF) and converse.
Alternatively, you can [create a new issue](https://github.com/sdr-enthusiasts/docker-flightradar24/issues) but sometimes it takes a while for us to notice and respond. Support on Discord is much faster!
15 changes: 15 additions & 0 deletions get_adsb_key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

mkdir -p /run/tmp

curl -sSL https://raw.githubusercontent.com/sdr-enthusiasts/docker-flightradar24/new-uat/install_feeder.sh > /run/tmp/install_feeder.sh
chmod a+x /run/tmp/install_feeder.sh
INSTALL_X86_FROMDEB=true /run/tmp/install_feeder.sh

if /usr/bin/fr24feed --version >/dev/null 2>&1; then
exec /usr/bin/fr24feed --signup --configfile=/tmp/config.txt
else
exec qemu-arm-static /usr/bin/fr24feed --signup --configfile=/tmp/config.txt
fi

rm -f /run/tmp/install_feeder.sh
15 changes: 15 additions & 0 deletions get_uat_key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

mkdir -p /run/tmp

curl -sSL https://raw.githubusercontent.com/sdr-enthusiasts/docker-flightradar24/new-uat/install_feeder.sh > /run/tmp/install_feeder.sh
chmod a+x /run/tmp/install_feeder.sh
INSTALL_X86_FROMDEB=true /run/tmp/install_feeder.sh

if /usr/bin/fr24feed --version >/dev/null 2>&1; then
exec /usr/bin/fr24feed --signup --uat --configfile=/tmp/config.txt
else
exec qemu-arm-static /usr/bin/fr24feed --signup --uat --configfile=/tmp/config.txt
fi

rm -f /run/tmp/install_feeder.sh
Loading

0 comments on commit 6b96d48

Please sign in to comment.