pull/2/head
Steven Honson 2021-08-22 17:33:14 +10:00
rodzic 31ae9836bf
commit 725717c469
3 zmienionych plików z 214 dodań i 0 usunięć

63
.github/workflows/container.yml vendored 100644
Wyświetl plik

@ -0,0 +1,63 @@
name: Container Images
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:
schedule:
- cron: '45 10 * * 2'
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Calculate Container Metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=true
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Layers
uses: actions/cache@v2
with:
path: /tmp/buildx-cache
key: buildx-cache-${{ github.sha }}
restore-keys: |
buildx-cache-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Images
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7
cache-from: type=local,src=/tmp/buildx-cache
cache-to: type=local,dest=/tmp/buildx-cache-new,mode=max
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Move Cache
run: |
rm -rf /tmp/buildx-cache
mv /tmp/buildx-cache-new /tmp/buildx-cache

90
Dockerfile 100644
Wyświetl plik

@ -0,0 +1,90 @@
# -------------------
# The build container
# -------------------
FROM debian:buster-slim AS build
# Install build dependencies.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libusb-1.0-0-dev \
pkg-config \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
# Compile and install rtl-sdr.
RUN git clone https://github.com/steve-m/librtlsdr.git /root/librtlsdr && \
mkdir -p /root/librtlsdr/build && \
cd /root/librtlsdr/build && \
cmake -DCMAKE_INSTALL_PREFIX=/root/target/usr/local -Wno-dev ../ && \
make && \
make install && \
rm -rf /root/librtlsdr
# Compile and install ssdv.
RUN git clone https://github.com/fsphil/ssdv.git /root/ssdv && \
cd /root/ssdv && \
make && \
DESTDIR=/root/target make install && \
rm -rf /root/ssdv
# Install Python packages.
RUN --mount=type=cache,target=/root/.cache/pip pip3 install \
--user --no-warn-script-location --ignore-installed --no-binary numpy \
crcmod \
flask \
flask-socketio \
requests \
numpy
# Copy in radiosonde_auto_rx.
COPY . /root/wenet
# Build the binaries.
WORKDIR /root/wenet/src
RUN make
# -------------------------
# The application container
# -------------------------
FROM debian:buster-slim
EXPOSE 5003/tcp
# Install application dependencies.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
bc \
libusb-1.0-0 \
python3 \
tini && \
rm -rf /var/lib/apt/lists/*
# Copy compiled dependencies from the build container.
COPY --from=build /root/target /
RUN ldconfig
# Copy any additional Python packages from the build container.
COPY --from=build /root/.local /root/.local
# Copy wenet from the build container to /opt.
COPY --from=build /root/wenet/rx/ /opt/wenet/
COPY --from=build /root/wenet/LICENSE.txt /opt/wenet/
# Set the working directory.
WORKDIR /opt/wenet
# Ensure scripts from Python packages are in PATH.
ENV PATH=/root/.local/bin:$PATH
# Use tini as init.
ENTRYPOINT ["/usr/bin/tini", "--"]
# Run start_rx_docker.sh.
CMD ["/opt/wenet/start_rx_docker.sh"]

Wyświetl plik

@ -0,0 +1,61 @@
#!/bin/bash
#
# Wenet RX-side Initialisation Script - HEADLESS DOCKER VERSION
# 2019 Mark Jessop <vk5qi@rfhead.net>
#
# This code mostly assumes an RTLSDR will be used for RX.
#
# This version of the startup script is intended to be run as a Docker container
# on a headless Raspberry Pi 3B+ or newer.
# A display of imagery and telemetry can be accessed at http://<pi_ip>:5003/
#
# Check that a callsign has been set.
if [ -z "$MYCALL" ]; then
echo "ERROR: MYCALL has not been set."
exit 1
fi
# Defaults
: "${RXFREQ:=441200000}"
: "${DEVICE:=0}"
: "${GAIN:=0}"
: "${BIAS:=0}"
: "${BAUD_RATE:=115177}"
: "${OVERSAMPLING:=8}"
# Start up the SSDV Uploader script and push it into the background.
python3 ssdvuploader.py "$MYCALL" &
SSDV_UPLOAD_PID=$!
# Start the Web Interface Server
python3 wenetserver.py &
WEB_VIEWER_PID=$!
# Calculate the SDR sample rate required.
SDR_RATE=$(("$BAUD_RATE" * "$OVERSAMPLING"))
# Calculate the SDR centre frequency.
# The fsk_demod acquisition window is from Rs/2 to Fs/2 - Rs.
# Given Fs is Rs * Os (Os = oversampling), we can calculate the required tuning offset with the equation:
# Offset = Fcenter - Rs*(Os/4 - 0.25)
RX_SSB_FREQ=$(echo "$RXFREQ - $BAUD_RATE * ($OVERSAMPLING/4 - 0.25)" | bc)
echo "Using SDR Sample Rate: $SDR_RATE Hz"
echo "Using SDR Centre Frequency: $RX_SSB_FREQ Hz"
if [ "$BIAS" = "1" ]; then
echo "Enabling Bias Tee"
rtl_biast -d "$DEVICE" -b 1
fi
# Start up the receive chain.
echo "Using Complex Samples."
rtl_sdr -d "$DEVICE" -s "$SDR_RATE" -f "$RX_SSB_FREQ" -g "$GAIN" - | \
./fsk_demod --cu8 -s --stats=100 2 "$SDR_RATE" "$BAUD_RATE" - - 2> >(python3 fskstatsudp.py --rate 1) | \
./drs232_ldpc - - -vv 2> /dev/null | \
python3 rx_ssdv.py --partialupdate 16 --headless
# Kill off the SSDV Uploader and the GUIs
kill $SSDV_UPLOAD_PID
kill $WEB_VIEWER_PID