Skip to content

Commit

Permalink
Renewed Autogain and fixes to HealthCheck (#80)
Browse files Browse the repository at this point in the history
* initial commit - new autogain

* updates

* updates

* updates

* update

* update

* updates

* bug fix

* reset stats on dump978 restart

* make stats gen after restart smoother

* cleanup

* more changes

* logging improvements

* logging change

* don't increment counter if stats aren't ready

* Avoid error traps

* Start counting runs from 1 instead of 0

* allow suspension of autogain outside certain hours

* typo and other stuff

* yet another typo :(

* stupid errors fixed

* stupid errors fixed

* ensure directories are created

* fix resume time

* fix resume time

* fix resume time

* improve Dockerfile

* improve flow

* readme updates

* made message type (raw v accepted) and count configurable

* make `DUMP978_AUTOGAIN_ADJUSTMENT_LIMITS` default true

* up READSB_AUTOGAIN_HIGH_PCT to 12.0

* simplify rssi data collection

* updated autogain collection mechanism

* updated autogain collection mechanism

* updated autogain collection mechanism

* updated autogain collection mechanism

* updated autogain collection mechanism

* updated autogain collection mechanism

* updated autogain collection mechanism

* more stuff

* more stuff

* more stuff

* more stuff

* more stuff

* autogain updates

* update autogain

* remove some debug code

* updates

* update to flow

* recognize `$READSB_AUTOGAIN_USE_RAW` parameter for autogain

* always collect autogain msgs until at least READSB_AUTOGAIN_MIN_SAMPLES is reached

* fix for RSSIs that are in the -0.9 - 0.0 range

* respect `DUMP978_AUTOGAIN_INITIAL_GAIN` on startup with autogain

* set agreed default values

* multiple fixes for HealthCheck

* Prep for future telegraf-less container

* final cleanup before merging

* linting "fix"
  • Loading branch information
kx1t authored Nov 1, 2023
1 parent 809b3c7 commit 607c6da
Show file tree
Hide file tree
Showing 38 changed files with 528 additions and 262 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: Pull markdownlint/markdownlint:latest Image
run: docker pull markdownlint/markdownlint:latest
- name: Run markdownlint against *.md files
run: docker run --rm -i -v "$(pwd)":/workdir --workdir /workdir markdownlint/markdownlint:latest --rules ~MD004,~MD013,~MD033,~MD026,~MD002,~MD022 $(find . -type f -iname '*.md' | grep -v '/.git/')
run: docker run --rm -i -v "$(pwd)":/workdir --workdir /workdir markdownlint/markdownlint:latest --rules ~MD004,~MD013,~MD033,~MD026,~MD002,~MD022,~MD007,~MD029,~MD012,~MD034 $(find . -type f -iname '*.md' | grep -v '/.git/')
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"MD033": false
"MD033": false,
"MD013": false
}
54 changes: 2 additions & 52 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,7 @@ FROM ghcr.io/sdr-enthusiasts/docker-baseimage:dump978-full

ENV PROMETHEUSPORT=9273 \
PROMETHEUSPATH="/metrics" \
###########################################################################
##### AUTOGAIN ENVIRONMENT VARS #####
# How often the autogain.sh is run (in seconds)
AUTOGAIN_SERVICE_PERIOD=900 \
# The autogain state file (init/finetune/finish)
AUTOGAIN_STATE_FILE="/run/autogain/state" \
# The current gain figure as-set by autogain
AUTOGAIN_CURRENT_VALUE_FILE="/run/autogain/autogain_current_value" \
# The timestamp (seconds since epoch) when the current gain figure was set
AUTOGAIN_CURRENT_TIMESTAMP_FILE="/run/autogain/autogain_current_timestamp" \
# The timestamp (seconds since epoch) when the current gain figure should be reviewed
AUTOGAIN_REVIEW_TIMESTAMP_FILE="/run/autogain/autogain_review_timestamp" \
# The maximum allowable percentage of strong messages
AUTOGAIN_PERCENT_STRONG_MESSAGES_MAX=10.0 \
# The minimum allowable percentage of strong messages
AUTOGAIN_PERCENT_STRONG_MESSAGES_MIN=0.5 \
# The number of seconds that autogain "init" stage should run for, for each gain level
AUTOGAIN_INITIAL_PERIOD=7200 \
# The minimum number of local_accepted messages that autogain "init" stage should run for, for each gain level
AUTOGAIN_INITIAL_MSGS_ACCEPTED=100000 \
# The number of seconds that autogain "finetune" stage should run for, for each gain level
AUTOGAIN_FINETUNE_PERIOD=604800 \
# The minimum number of local_accepted messages that autogain "finetune" stage should run for, for each gain level
AUTOGAIN_FINETUNE_MSGS_ACCEPTED=700000 \
# How long to run once finetune stage has finished before we start the process over (1 year)
AUTOGAIN_FINISHED_PERIOD=31536000 \
# Maximum gain level that autogain should use
AUTOGAIN_MAX_GAIN_VALUE=49.6 \
# Minimum gain level that autogain should use
AUTOGAIN_MIN_GAIN_VALUE=0.0 \
# State file that will disappear when the container is rebuilt/restarted - so autogain can detect container restart/rebuild
AUTOGAIN_RUNNING_FILE="/tmp/.autogain_running" \
# maximum accepted gain value
AUTOGAIN_MAX_GAIN_VALUE_FILE="/run/autogain/autogain_max_value" \
# minimum accepted gain value
AUTOGAIN_MIN_GAIN_VALUE_FILE="/run/autogain/autogain_min_value" \
# Current gain value
GAIN_VALUE_FILE="/tmp/.gain_current"
GAIN_VALUE_FILE="/var/globe_history/autogain/gain"

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

Expand Down Expand Up @@ -95,17 +58,7 @@ RUN set -x && \
&& \
# grab the bias t scripts
curl -o /etc/s6-overlay/scripts/05-rtlsdr-biastee-init https://raw.githubusercontent.com/sdr-enthusiasts/sdre-bias-t-common/main/09-rtlsdr-biastee-init && \
curl -o /etc/s6-overlay/scripts/05-rtlsdr-biastee-down https://raw.githubusercontent.com/sdr-enthusiasts/sdre-bias-t-common/main/09-rtlsdr-biastee-down && \
# fix bias t init
sed -i 's/READSB_DEVICE_TYPE/DUMP978_DEVICE_TYPE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-init && \
sed -i 's/READSB_RTLSDR_DEVICE/DUMP978_RTLSDR_DEVICE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-init && \
sed -i 's/READSB_ENABLE_BIASTEE/DUMP978_ENABLE_BIASTEE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-init && \
sed -i 's/09-rtlsdr-biastee/05-rtlsdr-biastee/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-init && \
# fix bias t down
sed -i 's/READSB_DEVICE_TYPE/DUMP978_DEVICE_TYPE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-down && \
sed -i 's/READSB_RTLSDR_DEVICE/DUMP978_RTLSDR_DEVICE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-down && \
sed -i 's/READSB_ENABLE_BIASTEE/DUMP978_ENABLE_BIASTEE/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-down && \
sed -i 's/09-rtlsdr-biastee/05-rtlsdr-biastee/g' /etc/s6-overlay/scripts/05-rtlsdr-biastee-down && \
curl -o /etc/s6-overlay/scripts/05-rtlsdr-biastee-down https://raw.githubusercontent.com/sdr-enthusiasts/sdre-bias-t-common/main/09-rtlsdr-biastee-down && \
chmod +x /etc/s6-overlay/scripts/05-rtlsdr-biastee-init && \
chmod +x /etc/s6-overlay/scripts/05-rtlsdr-biastee-down && \
git config --global advice.detachedHead false && \
Expand Down Expand Up @@ -153,6 +106,3 @@ EXPOSE 30978/tcp 30979/tcp 37981/tcp

# Add healthcheck
HEALTHCHECK --timeout=60s --start-period=7200s --interval=600s CMD /scripts/healthcheck.sh

# TODO
# - work out a way to test - maybe capture some output and parse it?
Loading

0 comments on commit 607c6da

Please sign in to comment.