Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
33
research/zapier/scripts/ensure-mongo-tunnel.sh
Executable file
33
research/zapier/scripts/ensure-mongo-tunnel.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
# Start the NS1 Mongo SSH tunnel if nothing is already listening on 127.0.0.1:27017.
|
||||
set -eu
|
||||
ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
|
||||
TUNNEL="$ROOT/scripts/mongo-tunnel.sh"
|
||||
LOG="${ZAPIER_TUNNEL_LOG:-$HOME/.grok/zapier-mongo-tunnel.log}"
|
||||
|
||||
if nc -z 127.0.0.1 27017 2>/dev/null; then
|
||||
echo "mongo tunnel: already up (127.0.0.1:27017)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x "$TUNNEL" ]; then
|
||||
echo "missing $TUNNEL" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$LOG")"
|
||||
nohup "$TUNNEL" >>"$LOG" 2>&1 &
|
||||
echo $! >"${ZAPIER_TUNNEL_PIDFILE:-$HOME/.grok/zapier-mongo-tunnel.pid}"
|
||||
|
||||
i=0
|
||||
while [ "$i" -lt 20 ]; do
|
||||
if nc -z 127.0.0.1 27017 2>/dev/null; then
|
||||
echo "mongo tunnel: started (pid $(cat "${ZAPIER_TUNNEL_PIDFILE:-$HOME/.grok/zapier-mongo-tunnel.pid}"))"
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 0.25
|
||||
done
|
||||
|
||||
echo "mongo tunnel: failed to bind 127.0.0.1:27017 — see $LOG" >&2
|
||||
exit 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue