diigo binds the session cookie to the IP it was issued to, so a Cloudflare deployment can't use a cookie minted in the browser. Run diigo-cache and webapp in one workerd on bldbox instead. The flake bundles each worker with wrangler's dry run, so the modules match what `wrangler deploy` ships, and generates the workerd config from the bundles. workerd comes from nixpkgs' wrangler, the only packaged one. A smoke check serves the home page and mints a webapp instance, which covers the WEBAPP binding and Durable Object storage. The service is a system unit with DynamicUser, so the webapp state holding the cookie isn't readable by processes running as the user. It listens on loopback behind tailscale serve: HTTPS, which PasswordCredential needs, at the tailnet name only. Operator docs in doc/; unsettled points recorded as IBIS issues. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
28 lines
1023 B
Bash
Executable File
28 lines
1023 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Serve a built package under the service unit's syscall filter, as a
|
|
# transient user unit, on a scratch port and state; check the home page.
|
|
# The flake's smoke check can't: the nix sandbox has no systemd.
|
|
# usage: probe-unit.sh <package out path>
|
|
set -euo pipefail
|
|
out=$1
|
|
state=$(mktemp -d)
|
|
trap 'systemctl --user stop diigo-cache-probe 2>/dev/null; rm -rf "$state"' EXIT
|
|
mkdir "$state/cache" "$state/webapp"
|
|
|
|
props=()
|
|
while IFS= read -r line; do props+=(-p "$line"); done \
|
|
< <(grep '^SystemCallFilter=' "$out/lib/systemd/system/diigo-cache.service")
|
|
|
|
systemd-run --user -q --collect --unit=diigo-cache-probe "${props[@]}" \
|
|
"$out/bin/diigo-cache-serve" -s http=127.0.0.1:18791 \
|
|
-d cache-state="$state/cache" -d webapp-state="$state/webapp"
|
|
for _ in $(seq 30); do
|
|
if curl -sf -m 2 http://127.0.0.1:18791/ | grep -q _connect; then
|
|
echo "probe: ok"
|
|
exit 0
|
|
fi
|
|
sleep 0.3
|
|
done
|
|
echo "probe: no home page; see journalctl --user -u diigo-cache-probe and journalctl -k | grep syscall=" >&2
|
|
exit 1
|