Skip to content

Commit 35d9515

Browse files
authored
Merge pull request #934 from projecthorus/testing
auto_rx 1.8.0 release - Full ka9q-radio support!
2 parents 757925e + eba2a08 commit 35d9515

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1399
-590
lines changed

.devcontainer.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/container.yml

Lines changed: 110 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,142 @@
1-
name: Container Images
1+
name: Container image
22

33
on:
44
push:
55
branches:
6+
- 'master'
67
- 'testing'
78
tags:
89
- 'v*'
910
pull_request:
1011
workflow_dispatch:
12+
schedule:
13+
- cron: '25 4 * * 3'
1114

1215
jobs:
13-
main:
16+
build:
17+
name: Build container image
1418
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
platform: [linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7]
1522
steps:
16-
- name: Checkout Repository
17-
uses: actions/checkout@v2
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
1825

19-
- name: Calculate Container Metadata
20-
id: meta
21-
uses: docker/metadata-action@v4
26+
- name: Declare platform
27+
run: |
28+
platform=${{ matrix.platform }}
29+
echo "PLATFORM=${platform//\//-}" >> $GITHUB_ENV
30+
31+
- name: Cache wheels
32+
uses: actions/cache@v4
2233
with:
23-
images: ghcr.io/${{ github.repository }}
34+
path: ${{ github.workspace }}/wheels
35+
key: wheels-${{ env.PLATFORM }}-${{ github.run_id }}
36+
restore-keys: |
37+
wheels-${{ env.PLATFORM }}-
38+
39+
- name: List wheels
40+
run: ls -lR ${{ github.workspace }}/wheels || true
2441

2542
- name: Setup QEMU
26-
uses: docker/setup-qemu-action@v2
43+
uses: docker/setup-qemu-action@v3
2744

2845
- name: Setup Buildx
29-
uses: docker/setup-buildx-action@v2
46+
uses: docker/setup-buildx-action@v3
3047

3148
- name: Login to GitHub Container Registry
32-
if: ${{ github.event_name != 'pull_request' }}
33-
uses: docker/login-action@v2
49+
uses: docker/login-action@v3
3450
with:
3551
registry: ghcr.io
3652
username: ${{ github.repository_owner }}
3753
password: ${{ secrets.GITHUB_TOKEN }}
3854

39-
- name: Build Images
40-
if: ${{ github.event_name == 'pull_request' }}
41-
uses: docker/build-push-action@v3
55+
- name: Calculate container metadata
56+
id: meta
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ghcr.io/${{ github.repository }}
60+
61+
- name: Build stage
62+
id: build
63+
uses: docker/build-push-action@v6
4264
with:
4365
context: .
44-
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7
45-
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
46-
tags: ${{ steps.meta.outputs.tags }}
66+
platforms: ${{ matrix.platform }}
67+
provenance: false
4768
labels: ${{ steps.meta.outputs.labels }}
48-
49-
- name: Build and Push Images
50-
if: ${{ github.event_name != 'pull_request' }}
51-
uses: docker/build-push-action@v3
69+
outputs: type=local,dest=/tmp/build-output
70+
cache-to: type=local,dest=/tmp/build-cache,mode=max
71+
target: build
72+
73+
- name: Final stage and push by digest
74+
id: final
75+
uses: docker/build-push-action@v6
5276
with:
5377
context: .
54-
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7
55-
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
56-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
57-
push: true
58-
tags: ${{ steps.meta.outputs.tags }}
78+
platforms: ${{ matrix.platform }}
79+
provenance: false
5980
labels: ${{ steps.meta.outputs.labels }}
81+
outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' && 'true' || 'false' }}
82+
cache-from: type=local,src=/tmp/build-cache
83+
84+
- name: Export digest
85+
if: ${{ github.event_name != 'pull_request' }}
86+
run: |
87+
mkdir -p /tmp/digests
88+
digest="${{ steps.final.outputs.digest }}"
89+
touch "/tmp/digests/${digest#sha256:}"
90+
91+
- name: Upload digest
92+
if: ${{ github.event_name != 'pull_request' }}
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: digests-${{ env.PLATFORM }}
96+
path: /tmp/digests/*
97+
if-no-files-found: error
98+
retention-days: 1
99+
100+
- name: Move and list wheels
101+
run: |
102+
mv -f /tmp/build-output/root/.cache/pip/wheels ${{ github.workspace }}/ || true
103+
ls -lR ${{ github.workspace }}/wheels || true
104+
105+
merge:
106+
name: Publish multi-platform image
107+
if: ${{ github.event_name != 'pull_request' }}
108+
runs-on: ubuntu-latest
109+
needs: [build]
110+
steps:
111+
- name: Download digests
112+
uses: actions/download-artifact@v4
113+
with:
114+
path: /tmp/digests
115+
pattern: digests-*
116+
merge-multiple: true
117+
118+
- name: Calculate container metadata
119+
id: meta
120+
uses: docker/metadata-action@v5
121+
with:
122+
images: ghcr.io/${{ github.repository }}
123+
124+
- name: Setup Buildx
125+
uses: docker/setup-buildx-action@v2
126+
127+
- name: Login to GitHub Container Registry
128+
uses: docker/login-action@v3
129+
with:
130+
registry: ghcr.io
131+
username: ${{ github.repository_owner }}
132+
password: ${{ secrets.GITHUB_TOKEN }}
133+
134+
- name: Create and push manifest
135+
working-directory: /tmp/digests
136+
run: |
137+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
138+
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
139+
140+
- name: Inspect container image
141+
run: |
142+
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}

Dockerfile

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
11
# -------------------
22
# The build container
33
# -------------------
4-
FROM debian:bullseye-slim AS build
4+
FROM debian:bookworm-slim AS build
55

66
# Upgrade base packages.
77
RUN apt-get update && \
88
apt-get upgrade -y && \
99
apt-get install -y --no-install-recommends \
10+
autoconf \
11+
automake \
1012
build-essential \
1113
cmake \
1214
git \
1315
libatlas-base-dev \
1416
libsamplerate0-dev \
1517
libusb-1.0-0-dev \
18+
ninja-build \
1619
pkg-config \
1720
python3 \
1821
python3-dev \
1922
python3-pip \
2023
python3-setuptools \
21-
python3-wheel && \
24+
python3-wheel \
25+
libavahi-client-dev \
26+
libbsd-dev \
27+
libfftw3-dev \
28+
libiniparser-dev \
29+
libopus-dev && \
2230
rm -rf /var/lib/apt/lists/*
2331

32+
# Copy in existing wheels.
33+
COPY wheel[s]/ /root/.cache/pip/wheels/
34+
35+
# No wheels might exist.
36+
RUN mkdir -p /root/.cache/pip/wheels/
37+
2438
# Copy in requirements.txt.
2539
COPY auto_rx/requirements.txt \
2640
/root/radiosonde_auto_rx/auto_rx/requirements.txt
2741

2842
# Install Python packages.
29-
RUN --mount=type=cache,target=/root/.cache/pip pip3 install \
30-
--user --no-warn-script-location --ignore-installed --no-binary numpy \
43+
RUN pip3 install \
44+
--user --break-system-packages --no-warn-script-location --ignore-installed \
3145
-r /root/radiosonde_auto_rx/auto_rx/requirements.txt
3246

3347
# Compile rtl-sdr from source.
@@ -44,6 +58,15 @@ RUN git clone https://github.com/miweber67/spyserver_client.git /root/spyserver_
4458
cd /root/spyserver_client && \
4559
make
4660

61+
# Compile ka9q-radio from source
62+
RUN git clone https://github.com/ka9q/ka9q-radio.git /root/ka9q-radio && \
63+
cd /root/ka9q-radio && \
64+
git checkout ff7fe26a12909317b26bdb24a0576db87c15baf2 && \
65+
make \
66+
-f Makefile.linux \
67+
"COPTS=-std=gnu11 -pthread -Wall -funsafe-math-optimizations -fno-math-errno -fcx-limited-range -D_GNU_SOURCE=1" \
68+
tune powers pcmcat
69+
4770
# Copy in radiosonde_auto_rx.
4871
COPY . /root/radiosonde_auto_rx
4972

@@ -54,7 +77,7 @@ RUN /bin/sh build.sh
5477
# -------------------------
5578
# The application container
5679
# -------------------------
57-
FROM debian:bullseye-slim
80+
FROM debian:bookworm-slim
5881

5982
EXPOSE 5000/tcp
6083

@@ -69,6 +92,10 @@ RUN apt-get update && \
6992
rng-tools \
7093
sox \
7194
tini \
95+
libbsd0 \
96+
avahi-utils \
97+
libnss-mdns \
98+
avahi-utils \
7299
usbutils && \
73100
rm -rf /var/lib/apt/lists/*
74101

@@ -88,6 +115,18 @@ COPY --from=build /root/spyserver_client/ss_client /opt/auto_rx/
88115
RUN ln -s ss_client /opt/auto_rx/ss_iq && \
89116
ln -s ss_client /opt/auto_rx/ss_power
90117

118+
# Copy ka9q-radio utilities
119+
COPY --from=build /root/ka9q-radio/tune /usr/local/bin/
120+
COPY --from=build /root/ka9q-radio/powers /usr/local/bin/
121+
COPY --from=build /root/ka9q-radio/pcmcat /usr/local/bin/
122+
123+
# Allow mDNS resolution for ka9q-radio utilities
124+
RUN sed -i -e 's/files dns/files mdns4_minimal [NOTFOUND=return] dns/g' /etc/nsswitch.conf
125+
126+
# NOTE: These volume flags must be set for avahi to talk to the local host:
127+
# -v /var/run/dbus:/var/run/dbus
128+
# -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
129+
91130
# Set the working directory.
92131
WORKDIR /opt/auto_rx
93132

auto_rx/auto_rx.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ def email_error(message="foo"):
708708
else:
709709
logging.debug("Not sending Email notification, as Email not configured.")
710710

711-
712711
def main():
713712
"""Main Loop"""
714713
global config, exporter_objects, exporter_functions, logging_level, rs92_ephemeris, gpsd_adaptor, email_exporter
@@ -971,18 +970,30 @@ def main():
971970

972971
# OziExplorer
973972
if config["ozi_enabled"] or config["payload_summary_enabled"]:
974-
if config["ozi_enabled"]:
973+
if config["ozi_host"]:
974+
_ozi_host = config["ozi_host"]
975+
else:
976+
_ozi_host = None
977+
978+
if config["ozi_enabled"]: # Causes port to be set to None which disables the export.
975979
_ozi_port = config["ozi_port"]
976980
else:
977981
_ozi_port = None
978982

979-
if config["payload_summary_enabled"]:
983+
if config["payload_summary_host"]:
984+
_summary_host = config["payload_summary_host"]
985+
else:
986+
_summary_host = None
987+
988+
if config["payload_summary_enabled"]: # Causes port to be set to None which disables the export.
980989
_summary_port = config["payload_summary_port"]
981990
else:
982991
_summary_port = None
983992

984993
_ozimux = OziUploader(
994+
ozimux_host=_ozi_host,
985995
ozimux_port=_ozi_port,
996+
payload_summary_host=_summary_host,
986997
payload_summary_port=_summary_port,
987998
update_rate=config["ozi_update_rate"],
988999
station=config["habitat_uploader_callsign"],
@@ -1009,11 +1020,14 @@ def main():
10091020
config["rotator_home_azimuth"],
10101021
config["rotator_home_elevation"],
10111022
],
1023+
azimuth_only=config["rotator_azimuth_only"]
10121024
)
10131025

10141026
exporter_objects.append(_rotator)
10151027
exporter_functions.append(_rotator.add)
10161028

1029+
autorx.rotator_object = _rotator
1030+
10171031
# Sondehub v2 Database
10181032
if config["sondehub_enabled"]:
10191033
if config["habitat_upload_listener_position"] is False:

auto_rx/autorx/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
1313
# PATCH - Small changes, or minor feature additions.
1414

15-
__version__ = "1.7.4"
15+
__version__ = "1.8.0"
1616

1717
# Global Variables
1818

@@ -44,5 +44,8 @@
4444
# Global scan inhibit flag, used by web interface.
4545
scan_inhibit = False
4646

47+
# Rotator object
48+
rotator_object = None
49+
4750
# Logging Directory
4851
logging_path = "./log/"

0 commit comments

Comments
 (0)