Skip to content

Commit

Permalink
add easy option to write traces (#240)
Browse files Browse the repository at this point in the history
and move tar1090 files to /run/tar1090
  • Loading branch information
wiedehopf authored Nov 4, 2024
1 parent fd37b3e commit 9d0e79a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ RUN \
rm /etc/nginx/sites-enabled/default && \
# tar1090: install using project copy of original script
bash /app/rootfs/tar1090-install.sh /run/readsb webroot "${TAR1090_INSTALL_DIR}" && \
# change some /run/tar1090-webroot to /run/readsb to make work with existing docker scripting
sed -i -e 's#/run/tar1090-webroot/#/run/readsb/#' /usr/local/share/tar1090/nginx-tar1090-webroot.conf && \
# tar1090-db: document version
echo "tar1090-db $(cat ${TAR1090_UPDATE_DIR}/git-db/version)" >> VERSIONS && \
# tar1090: document version
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ All of the variables below are optional.
| `TAR1090_IMAGE_CONFIG_TEXT` | Text to display for the config link | `null` |
| `TAR1090_DISABLE` | Set to `true` to disable the web server and all websites (including the map, `graphs1090`, `heatmap`, `pTracks`, etc.) | Unset |
| `READSB_ENABLE_HEATMAP` | Set to `true` or leave unset to enable the HeatMap function available at `http://myip/?Heatmap`; set to `false` to disable the HeapMap function | `true` (enabled) |
| `READSB_ENABLE_TRACES` | Save detailed globe history traces (1 gzip compressed json file per day and airframe, use MAX_GLOBE_HISTORY so you don't run out of inodes / diskspace) | `false` |
| `TAR1090_ENABLE_ACTUALRANGE` | Set to `true` or leave unset to enable the outline of the actual range of your station on the map; set to `false` to disable the this outline | `true` (enabled) |
| `TAR1090_AISCATCHER_SERVER` | If you want to show vessels from your AIS-Catcher instance on the map, put the (externally reachable) URL of your AIS-Catcher or ShipFeeder website in this parameter (incl. `https://`). Note - if you are using "barebones" AIS-Catcher you should add `GEOJSON on` after the `-N` parameter on the `AIS-Catcher` command line. If you use [docker-shipfeeder](https://github.com/sdr-enthusiasts/docker-shipfeeder), no change is needed for that container | Empty |
| `TAR1090_AISCATCHER_REFRESH` | Refresh rate (in seconds) of reading vessels from your AIS-Catcher instance. Defaults to 15 (secs) if omitted | `15` |
Expand Down Expand Up @@ -458,7 +459,7 @@ Where the default value is "Unset", `readsb`'s default will be used.
| `READSB_STATS_EVERY` | Number of seconds between showing and resetting stats. | `--stats-every=<sec>` | Unset |
| `READSB_STATS_RANGE` | Set this to any value to collect range statistics for polar plot. | `--stats-range` | Unset |
| `READSB_RANGE_OUTLINE_HOURS` | Change which past timeframe the range outline is based on | `--range-outline-hours` | `24` |
| `MAX_GLOBE_HISTORY` | Maximum number of days that `globe_history` data (used to produce heatmaps and ptracks) is retained. Note - this parameter doesn't affect the data used to produce `graphs1090` statistics | | Unset |
| `MAX_GLOBE_HISTORY` | Maximum number of days that `globe_history` data (used to produce heatmaps and replay) is retained. Note - this parameter doesn't affect the data used to produce `graphs1090` statistics | | Unset |

### AutoGain for RTLSDR Devices

Expand Down
2 changes: 2 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/tar1090/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
rm -rf /run/tar1090
14 changes: 8 additions & 6 deletions rootfs/etc/s6-overlay/scripts/cleanup_globe_history
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ fi
cutoffepoch="$(date -d"-${MAX_GLOBE_HISTORY} days" +%s)"

"${s6wrap[@]}" echo "Purging globe_history older than $MAX_GLOBE_HISTORY days (before $(date -d"-${MAX_GLOBE_HISTORY} days" +%d-%b-%Y))"
for dir in $(find /var/globe_history -maxdepth 3 -mindepth 3 -type d | grep -o -E -e '[0-9]{4}/[0-9]{2}/[0-9]{2}$'); do
if (( $(date -d "$dir" +%s) < cutoffepoch )); then
"${s6wrap[@]}" echo Removing "/var/globe_history/$dir"
rm -rf "/var/globe_history/$dir"
fi
done

find /var/globe_history -maxdepth 3 -mindepth 3 -type d | grep -o -E -e '[0-9]{4}/[0-9]{2}/[0-9]{2}$' | \
while read -r dir; do
if (( $(date -d "$dir" +%s) < cutoffepoch )); then
"${s6wrap[@]}" echo Removing "/var/globe_history/$dir"
rm -rf "/var/globe_history/$dir"
fi
done

# delete empty year / month directories
# make sure the directories haven't been touched for 3 days so freshly created directories aren't removed
Expand Down
5 changes: 5 additions & 0 deletions rootfs/etc/s6-overlay/scripts/readsb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ if chk_enabled "${READSB_ENABLE_HEATMAP:-true}"; then
READSB_CMD+=("--heatmap=${READSB_HEATMAP_INTERVAL:-15}")
fi

if chk_enabled "${READSB_ENABLE_TRACES}"; then
READSB_CMD+=("--write-globe-history=/var/globe_history")
fi


if chk_enabled "${READSB_FORWARD_MLAT}"; then
"${s6wrap[@]}" echo "WARNING -- READSB_FORWARD_MLAT has been set! Do not feed the output of this container to any aggregators!"
READSB_CMD+=("--forward-mlat")
Expand Down
6 changes: 3 additions & 3 deletions rootfs/etc/s6-overlay/scripts/tar1090
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ if chk_enabled "${TAR1090_DISABLE}"; then
stop_service
fi

mkdir -p /run/tar1090
rundir="/run/tar1090"
mkdir -p "$rundir"
sleep 5

# shellcheck source=/dev/null
#source "${TAR1090_INSTALL_DIR}/default"

srcdir=/run/readsb
service=readsb

exec s6wrap --quiet --prepend=tar1090 --timestamps --args bash /usr/local/share/tar1090/tar1090.sh \
"/run/$service" \
"$rundir" \
"$srcdir"

# "$INTERVAL" \
Expand Down
3 changes: 2 additions & 1 deletion rootfs/etc/s6-overlay/startup.d/04-tar1090-configure
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ else
fi

# Add in CORS header for tar1090 data/aircraft.json file
# adjust the tar1090 runtime directory to /run/tar1090

sed -i \
-e 's/location ~ aircraft\\.json$ {/location ~ aircraft\.json$ {\n add_header Access-Control-Allow-Origin "\*";/g' \
-e 's#/run/tar1090-webroot/#/run/readsb/#' \
-e 's#/run/tar1090-webroot/#/run/tar1090/#' \
"${TAR1090_INSTALL_DIR}/nginx-tar1090-webroot.conf"


Expand Down

0 comments on commit 9d0e79a

Please sign in to comment.