22 lines
1.7 KiB
Bash
22 lines
1.7 KiB
Bash
# pushsink: a Web Push service as pushsink.test, for scenarios/push.sh (tools/pasture/pushsink/pushsink.cs, a .NET
|
|||
|
|
# file-based app published once into .pushsink and run on the runtime image PrivaPub uses). It makes each subscription's
|
||
|
|
# keys itself, takes PrivaPub's pushes as a push service would (the VAPID JWT checked against the instance API's key, the
|
||
|
|
# aes128gcm or aesgcm body decrypted) and keeps what it took for the scenario to read: https://pushsink.test:6443/
|
||
|
|
# subscriptions/<id>/received. It can be told to answer the next push otherwise (/subscriptions/<id>/answer, a 410).
|
||
|
|
# PrivaPub reaches it through Caddy as it reaches every peer: its push client honours appsettings.Pasture.json's
|
||
|
|
# Federation exceptions (AcceptAnyCertificate for Caddy's CA, AllowPrivateNetworks), which production refuses at start.
|
||
|
|
pushsink_up() {
|
||
|
|
local dotnet=${DOTNET:-$(command -v dotnet || echo ~/.dotnet/dotnet)}
|
||
|
|
if [ ! -x "$here/.pushsink/pushsink" ] || [ "$here/pushsink/pushsink.cs" -nt "$here/.pushsink/pushsink" ]; then
|
||
|
|
"$dotnet" publish "$here/pushsink/pushsink.cs" -r linux-x64 --self-contained true -o "$here/.pushsink" -v quiet
|
||
|
|
fi
|
||
|
|
podman run -d --replace --name pasture-pushsink --network $net --label pasture=1 -w /app -v "$here/.pushsink:/app:Z,ro" \
|
||
|
|
-v "$ca/bundle.pem:/etc/ssl/certs/ca-certificates.crt:z,ro" -e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
|
||
|
|
-e PUSHSINK_BASE=https://pushsink.test -e PUSHSINK_INSTANCE=https://privapub.test \
|
||
|
|
mcr.microsoft.com/dotnet/runtime-deps:10.0 /app/pushsink >/dev/null
|
||
|
|
for _ in $(seq 1 60); do
|
||
|
|
site pushsink.test -s -o /dev/null -w '%{http_code}' https://pushsink.test:6443/health 2>/dev/null | grep -q 200 && break
|
||
|
|
sleep 1
|
||
|
|
done
|
||
|
|
echo "pushsink: https://pushsink.test:6443"
|
||
|
|
}
|