Some checks are pending
offline / test (push) Waiting to run
Fleet/keep/middleware NATS_URL lists 10.10.10.21–23. Product streams are replicas=3. px-worker worm/tree run on that cluster. Backup timer and px-worker uptime watch are on. MOCK_VERAE and Zapier push unchanged.
34 lines
1.4 KiB
Bash
Executable file
34 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Create product JetStream streams with replicas=3 on the Proxmox cluster.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# shellcheck disable=SC1091
|
|
. "$ROOT/client.env"
|
|
export PATH="/usr/sbin:/usr/bin:/bin:/usr/local/bin:$PATH"
|
|
VMID="${1:-511}"
|
|
sudo pct exec "$VMID" -- bash -lc "
|
|
set -e
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
export PATH=/usr/local/bin:/usr/bin:/bin
|
|
export NATS_URL=nats://10.10.10.21:4222
|
|
if [[ ! -x /usr/local/bin/nats ]]; then
|
|
apt-get install -y --no-install-recommends unzip >/dev/null
|
|
curl -fsSL https://github.com/nats-io/natscli/releases/download/v0.1.6/nats-0.1.6-linux-amd64.zip -o /tmp/natscli.zip
|
|
rm -rf /tmp/natscli && mkdir -p /tmp/natscli
|
|
unzip -o /tmp/natscli.zip -d /tmp/natscli >/dev/null
|
|
BIN=\$(find /tmp/natscli -type f -name nats | head -1)
|
|
install -m 0755 \"\$BIN\" /usr/local/bin/nats
|
|
fi
|
|
add() {
|
|
local name=\$1 subj=\$2
|
|
nats stream info \"\$name\" >/dev/null 2>&1 && return 0
|
|
nats stream add \"\$name\" --subjects=\"\$subj\" --replicas=3 --storage=file --retention=limits --discard=old --max-msgs=-1 --max-bytes=-1 --max-age=24h --dupe-window=2m --defaults
|
|
}
|
|
add ZAPIER_JOBS 'verae.zapier.jobs.watch'
|
|
add ZAPIER_EVENTS 'verae.zapier.jobs.events'
|
|
add ZAPIER_WEBHOOKS 'verae.zapier.webhooks.deliver'
|
|
add ZAPIER_USAGE 'verae.zapier.usage'
|
|
add VERAE_ARCHIVE 'verae.archive.>'
|
|
nats stream ls
|
|
"
|
|
echo "streams ready on cluster (replicas=3)"
|