The stack for portal 1.0: a store of its own, gdo and kron dialling the site
Portal 1.0 keeps everything in one file (portal_data) and has no NATS. gdo and kron dial it over dhd/1 from loopback, so the three share one network namespace, held by a container of its own: held by portal, a restart of portal cut the other two off. NATS stays behind a profile nothing turns on, for going back; the chat (cnats) is out. The deploy writes DHD_KEYS and the hash of LOAD_TOKEN, and no NATS or chat settings. gdo is built from uhhm/gdo at GDO_RELEASE, since the gdo that dials a site is not in the registry. move.sh reads the programs' keys and prints what the deploy wants. Run on kasse beside the live stack, on other ports, with made-up records: mail out, a payment settled, content loaded over /dhd/1/load, and both programs back after portal was restarted and made anew. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5fbDjTQg4CJsNqEo7hhE7
This commit is contained in:
8 files changed
+368
-260
No files matched your search
+36
-30
@@ -1,36 +1,42 @@
|
||||
# gdo, the mailer, from the [uhhm] Arch registry - the same package the
|
||||
# bare-metal hosts install. Arch base rather than Debian because that is
|
||||
# how every uhhm binary is published; portal ships a release tarball and
|
||||
# is built from that instead.
|
||||
FROM archlinux:base
|
||||
ARG GDO_RELEASE
|
||||
|
||||
# The registry's signing key, vendored beside this file. A fresh
|
||||
# container trusts nothing, and the key is on no public keyserver, so
|
||||
# `pacman-key --recv-keys` cannot find it - which is why this is here
|
||||
# rather than fetched. It is a public key: checked in, not a secret.
|
||||
# gdo, the mailer, built from uhhm/gdo at GDO_RELEASE: a tag, or a commit.
|
||||
#
|
||||
# Vendored rather than turning the signature check off: the packages
|
||||
# come over HTTPS from a host we run, and it would be easy to call that
|
||||
# good enough, but then nothing would notice a package that host did
|
||||
# not sign. Locally signed, the check stays real.
|
||||
COPY uhhm-registry.asc /tmp/uhhm-registry.asc
|
||||
RUN pacman-key --init \
|
||||
&& pacman-key --populate archlinux \
|
||||
&& pacman-key --add /tmp/uhhm-registry.asc \
|
||||
&& pacman-key --lsign-key 1BCBE90F04AD9859D7BCC9BB53CBF90AA4C56211 \
|
||||
&& rm /tmp/uhhm-registry.asc \
|
||||
&& printf '%s\n' \
|
||||
'[uhhm]' \
|
||||
'SigLevel = Required DatabaseOptional' \
|
||||
'Server = https://project.uhhm.no/api/packages/bl/arch/$repo/$arch' \
|
||||
>> /etc/pacman.conf \
|
||||
&& pacman -Syu --noconfirm --needed ca-certificates gdo \
|
||||
# Built here rather than installed from the [uhhm] Arch registry, as it
|
||||
# was while the site ran portal 0.19: the gdo that dials a portal 1.0
|
||||
# site (0.4, which reads no NATS) is not in the registry yet, and is
|
||||
# held back from it on purpose. A host that upgraded to it while it
|
||||
# still has a 0.x site would stop sending that site's mail. Once 0.4 is
|
||||
# published, this can install the package again (uhhm-registry.asc
|
||||
# beside this file is the registry's key, kept for then).
|
||||
#
|
||||
# Arch for both stages, because that is what every uhhm binary is built
|
||||
# on and run on: the runtime's glibc is then never older than the
|
||||
# builder's.
|
||||
FROM archlinux:base AS build
|
||||
ARG GDO_RELEASE
|
||||
# -Syu, never -Sy: a partial upgrade pulls a library newer than what the
|
||||
# base image's own pacman was built against and refuses to install.
|
||||
RUN pacman -Syu --noconfirm --needed git rust gcc \
|
||||
&& pacman -Scc --noconfirm
|
||||
WORKDIR /src
|
||||
# The ref by name, so a tag and a commit both do; --locked, so the build
|
||||
# is the one the repo's own lock file describes.
|
||||
RUN test -n "$GDO_RELEASE" \
|
||||
&& git init -q . \
|
||||
&& git fetch -q --depth 1 https://project.uhhm.no/uhhm/gdo.git "$GDO_RELEASE" \
|
||||
&& git checkout -q FETCH_HEAD \
|
||||
&& cargo build --release --locked \
|
||||
&& install -Dm755 target/release/gdo /out/gdo
|
||||
|
||||
FROM archlinux:base
|
||||
RUN pacman -Syu --noconfirm --needed ca-certificates \
|
||||
&& pacman -Scc --noconfirm \
|
||||
&& rm -rf /var/cache/pacman/pkg/* /var/lib/pacman/sync/*
|
||||
COPY --from=build /out/gdo /usr/bin/gdo
|
||||
|
||||
# A non-root user; gdo writes nothing and holds no state - what it has
|
||||
# not yet delivered is on the stream, not on disk.
|
||||
RUN useradd --system --no-create-home gdo
|
||||
# A non-root user. gdo keeps its key on dhd/1 in /var/lib/gdo, a volume
|
||||
# (GDO_KEY in compose.yml); what it has not yet delivered waits with the
|
||||
# site, not here.
|
||||
RUN useradd --system --no-create-home gdo \
|
||||
&& mkdir -p /var/lib/gdo && chown gdo /var/lib/gdo && chmod 700 /var/lib/gdo
|
||||
USER gdo
|
||||
CMD ["/usr/bin/gdo"]
|
||||
Reference in new issue
Block a user