Skip to content

Commit

Permalink
feat(feed): add adsbhub support (#142)
Browse files Browse the repository at this point in the history
* feat(feed): add adsbhub support
  • Loading branch information
Thom-x authored Oct 23, 2023
1 parent f45b667 commit 4403f18
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ ENV SERVICE_ENABLE_PLANEFINDER false
ENV SERVICE_ENABLE_OPENSKY false
ENV SERVICE_ENABLE_ADSBFI false
ENV SERVICE_ENABLE_RADARBOX false
ENV SERVICE_ENABLE_ADSBHUB false

# System properties
ENV SYSTEM_HTTP_ULIMIT_N -1
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ docker run -d -p 8080:8080 -p 8754:8754 \
-e "ADSBFI_STATION_NAME=MY_STATION_NAME" \
-e "SERVICE_ENABLE_RADARBOX=true" \
-e "RADARBOX_SHARING_KEY=MY_RADARBOX_SHARING_KEY" \
-e "SERVICE_ENABLE_ADSBHUB=true" \
-e "ADSBHUB_CKEY=MY_ADSBHUB_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 @@ -86,6 +88,7 @@ To disable starting a service you can add an environement variable :
| `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` |
| `SERVICE_ENABLE_ADSBHUB` | `false` | Disable adsbhub feeder | `false` |


Ex : `-e "SERVICE_ENABLE_HTTP=false"`
Expand Down Expand Up @@ -349,6 +352,22 @@ Ex : `-e "SERVICE_ENABLE_RADARBOX=true" -e "RADARBOX_SHARING_KEY=35345bf2258aea6
_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_

## Adsbhub

First-time users should obtain a sharing key.

In order to obtain a sharing key, you need to register on https://www.adsbhub.org/ and create a new station under settings.

Add the environment variable `ADSBHUB_CKEY` and set it to to the value under "Station dynamic IP update ckey".
Add the environment variable `SERVICE_ENABLE_ADSBHUB` and set it to `true`.


| Environment Variable | Default value | Description |
| ----------------------- | ------------- | -------------------------------------------------- |
| `ADSBHUB_CKEY` | empty | Sharing key for your station to connect to adsbhub |

Ex : `-e "SERVICE_ENABLE_ADSBHUB=true" -e "ADSBHUB_CKEY=803BHyyxe)HP(%da%DCJfM,}%ftp[9?_j%XR+NktQJUKQ9&UAwQSCWWT&#vWfPAJQW%i){p2:ih!Y&=wMr*qRDrnC{C,L.C&UgYwB_rw.YG["`

## 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
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ services:
- "ADSBFI_STATION_NAME=MY_STATION_NAME"
- "SERVICE_ENABLE_RADARBOX=true"
- "RADARBOX_SHARING_KEY=MY_SHARING_KEY"
- "SERVICE_ENABLE_ADSBHUB=true"
- "ADSBHUB_CKEY=MY_SHARING_KEY"
devices:
- "/dev/bus/usb"
# ports
Expand Down
Empty file.
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/adsbhub-bundle/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bundle
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/adsbhub/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/command/with-contenv bash

# exit container stop s6
kill 1
9 changes: 9 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/adsbhub/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/command/with-contenv bash

if [ "$SERVICE_ENABLE_ADSBHUB" != "false" ]; then
set -eo pipefail
/usr/bin/adsbhub.sh 2>&1 | mawk -W interactive '{printf "%c[33m[adsbhub]%c[0m %s\n", 27, 27, $0}'
# awk -W interactive ... (prefix log messages with color and "[adsbhub]")
else
tail -f /dev/null
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/adsbhub/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
16 changes: 16 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/conf-adsbhub/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/command/with-contenv bash

if [ "$SERVICE_ENABLE_ADSBHUB" != "false" ]; then
set -eo pipefail
if [ -z "$ADSBHUB_CKEY" ]; then
for i in {1..5}; do
echo "FATAL: ADSBHUB_CKEY not set!" | mawk -W interactive '{printf "%c[33m[adsbhub]%c[0m %s\n", 27, 27, $0}'
done
kill 1
exit 1
fi
wget https://www.adsbhub.org/downloads/adsbhub.php --no-check-certificate -O /usr/bin/adsbhub.sh
awk -v new_CKEY="$ADSBHUB_CKEY" '/^ckey=/ {$0 = "ckey=\"" new_CKEY "\""} 1' "/usr/bin/adsbhub.sh" > "/usr/bin/adsbhub.sh.tmp"
mv /usr/bin/adsbhub.sh.tmp /usr/bin/adsbhub.sh
chmod 755 /usr/bin/adsbhub.sh
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/conf-adsbhub/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/conf-adsbhub/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/conf-adsbhub/script
Empty file modified root/etc/s6-overlay/s6-rc.d/radarbox/run
100644 → 100755
Empty file.
Empty file.

0 comments on commit 4403f18

Please sign in to comment.