Subscribes to mqtt.pskreporter.info:1883 over plain TCP and folds every reception report into hourly aggregates per (band, sender_grid_4, receiver_grid_4). Each spot is the empirical "propagation actually occurred on this path right now" signal we'll correlate against HRRR atmospheric state to recalibrate the scoring weights. Aggregating at the path-hour bucket collapses 50-reporter QSOs to one row instead of 50. Topic filter anchors on USA (DXCC 291) on either sender or receiver side so the broker pre-filters out everything outside our HRRR domain. Bands subscribed: VHF and up (6m, 2m, 70cm, 23cm, + microwave) — HF is dominated by ionospheric propagation, which this project doesn't model. Pskr.Client cluster-elects a singleton via :global.register_name — all replicas start the GenServer but only one connects to MQTT; the rest stay in :standby and watch for the leader's nodedown to re-run election. Off in dev/test, on by default in prod (PSKR_MQTT_ENABLED=false as kill-switch). Pskr.Aggregator buffers in memory keyed by Pskr.path_key/1 and flushes every 60s via Repo.insert_all/3 with an additive ON CONFLICT (count summed, SNR envelope by GREATEST/LEAST, modes unioned via unnest+DISTINCT). Idempotent across overlapping flushes and across leader handover. Dockerfile sets BUILD_WITHOUT_QUIC=1 — emqtt's transitive quicer dep wants CMake + OpenSSL headers we'd otherwise have to add to the builder image just to never use QUIC over plain MQTT. Base image is unchanged; the new dep compiles cleanly into the existing prop-base runtime.
116 lines
3.8 KiB
Docker
116 lines
3.8 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
|
|
# instead of Alpine to avoid DNS resolution issues in production.
|
|
#
|
|
# https://hub.docker.com/r/hexpm/elixir/tags?name=ubuntu
|
|
# https://hub.docker.com/_/ubuntu/tags
|
|
#
|
|
# This file is based on these images:
|
|
#
|
|
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
|
|
# - git.mcintire.me/graham/prop-base - prebuilt runtime base (see Dockerfile.base)
|
|
# - Ex: docker.io/hexpm/elixir:1.19.5-erlang-28.4.1-debian-trixie-20260316-slim
|
|
#
|
|
ARG ELIXIR_VERSION=1.19.5
|
|
ARG OTP_VERSION=28.4.1
|
|
ARG DEBIAN_VERSION=trixie-20260316-slim
|
|
|
|
ARG BUILDER_IMAGE="docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
|
|
# Prebuilt runtime base contains wgrib2 + cdo + gdal-bin + locale + the
|
|
# BEAM runtime apt deps. Built by .forgejo/workflows/build-base.yaml
|
|
# only when Dockerfile.base changes, so this Dockerfile pulls a
|
|
# ready-made layer instead of recompiling wgrib2 + reinstalling cdo
|
|
# (~10 min) on every push.
|
|
ARG BASE_IMAGE="git.mcintire.me/graham/prop-base:latest"
|
|
|
|
# ---- Elixir build stage ----
|
|
FROM ${BUILDER_IMAGE} AS builder
|
|
|
|
# install build dependencies
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends build-essential git
|
|
|
|
# prepare build dir
|
|
WORKDIR /app
|
|
|
|
# install hex + rebar
|
|
RUN mix local.hex --force \
|
|
&& mix local.rebar --force
|
|
|
|
# set build ENV
|
|
ENV MIX_ENV="prod"
|
|
|
|
# Skip the QUIC native build inside emqtt's transitive `quicer` dep.
|
|
# We only need plain TCP MQTT (port 1883) for the PSK Reporter
|
|
# firehose, and quicer's CMake-driven build pulls in extra
|
|
# toolchain requirements (cmake, OpenSSL headers) that aren't worth
|
|
# adding to the slim build image just to leave the support
|
|
# unused.
|
|
ENV BUILD_WITHOUT_QUIC="1"
|
|
|
|
# install mix dependencies (changes only when mix.exs/mix.lock change)
|
|
COPY mix.exs mix.lock ./
|
|
COPY vendor vendor
|
|
RUN mix deps.get --only $MIX_ENV
|
|
|
|
# copy compile-time config before compiling deps
|
|
RUN mkdir config
|
|
COPY config/config.exs config/${MIX_ENV}.exs config/
|
|
RUN mix deps.compile
|
|
|
|
# install esbuild + tailwind binaries (cached until mix.exs changes)
|
|
RUN mix assets.setup
|
|
|
|
# create priv dir so :code.priv_dir works at compile time
|
|
# (actual contents copied after compile to avoid cache busting)
|
|
RUN mkdir -p priv/models priv/static
|
|
|
|
# copy application code and compile
|
|
COPY lib lib
|
|
COPY algo.md algo.md
|
|
# agent-skills markdown is read at compile time by AgentSkillsController
|
|
# (sha256 digests are baked into the module attribute)
|
|
COPY priv/agent-skills priv/agent-skills
|
|
RUN mix compile
|
|
|
|
# copy assets and build (JS/CSS changes don't require recompilation)
|
|
COPY assets assets
|
|
RUN mix assets.deploy
|
|
|
|
# copy priv contents (migrations, ML model, static files)
|
|
# after compile so model retraining doesn't bust the compile cache
|
|
COPY priv priv
|
|
|
|
# runtime config doesn't require recompilation
|
|
COPY config/runtime.exs config/
|
|
|
|
COPY rel rel
|
|
RUN mix release
|
|
|
|
# ---- Final runtime stage ----
|
|
# Pulls the prebuilt prop-base image (Dockerfile.base) which already
|
|
# carries wgrib2 + g2c libs + cdo + gdal-bin + locale + BEAM runtime
|
|
# apt deps. We just COPY the Elixir release on top.
|
|
FROM ${BASE_IMAGE} AS final
|
|
|
|
# Build timestamp baked in by CI (--build-arg BUILD_TIMESTAMP=...).
|
|
# Only consumed in this final stage, so it never busts the earlier
|
|
# compile cache. Read at runtime by Microwaveprop.Application.build_timestamp/0.
|
|
ARG BUILD_TIMESTAMP=unknown
|
|
|
|
ENV MIX_ENV="prod"
|
|
|
|
WORKDIR "/app"
|
|
RUN chown nobody /app
|
|
|
|
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/microwaveprop ./
|
|
|
|
RUN echo "${BUILD_TIMESTAMP}" > /app/BUILD_TIMESTAMP \
|
|
&& chown nobody /app/BUILD_TIMESTAMP
|
|
|
|
USER nobody
|
|
|
|
CMD ["/app/bin/server"]
|