crypto: fetch p2pool binary at runtime

This commit is contained in:
Brad Stein 2025-12-24 19:06:40 -03:00
parent 0db786c343
commit 7876e4389c

View File

@ -30,11 +30,37 @@ spec:
- key: hardware
operator: In
values: ["rpi4"]
initContainers:
- name: fetch-p2pool
image: alpine:3.20
command: ["/bin/sh","-c"]
args:
- |
set -euo pipefail
apk add --no-cache curl tar openssl >/dev/null
test -n "${P2POOL_URL}"
echo "Downloading ${P2POOL_URL}"
curl -fsSL "${P2POOL_URL}" -o /tmp/p2pool.tgz
if [ -n "${P2POOL_SHA256}" ]; then
echo "${P2POOL_SHA256} /tmp/p2pool.tgz" | sha256sum -c -
fi
mkdir -p /opt/p2pool
tar -xzf /tmp/p2pool.tgz -C /opt/p2pool
BIN="$(find /opt/p2pool -maxdepth 1 -type f -name 'p2pool*' | head -n1)"
test -n "${BIN}"
install -m0755 "${BIN}" /opt/p2pool/p2pool
env:
- name: P2POOL_URL
valueFrom: { configMapKeyRef: { name: xmr-miner-sources, key: P2POOL_URL } }
- name: P2POOL_SHA256
valueFrom: { configMapKeyRef: { name: xmr-miner-sources, key: P2POOL_SHA256, optional: true } }
volumeMounts:
- { name: p2pool-bin, mountPath: /opt/p2pool }
containers:
- name: monero-p2pool
image: registry.bstein.dev/crypto/monero-p2pool:4.9
imagePullPolicy: Always
command: ["p2pool"]
image: debian:bookworm-slim
imagePullPolicy: IfNotPresent
command: ["/opt/p2pool/p2pool"]
args:
- "--host"
- "monerod.crypto.svc.cluster.local"
@ -61,3 +87,8 @@ spec:
tcpSocket: { port: 3333 }
initialDelaySeconds: 10
periodSeconds: 10
volumeMounts:
- { name: p2pool-bin, mountPath: /opt/p2pool }
volumes:
- name: p2pool-bin
emptyDir: {}