README rewritten around three steps (table SQL, secrets, self-contained workflow), with a vendored full-script workflow, a crontab example and an npx-from-git CLI. Every link and uses: line that pointed at the 404 GitHub repo is gone. keepalive.sh no longer prints the anon key outside GitHub Actions (::add-mask:: only when GITHUB_ACTIONS=true). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
35 lines
1.3 KiB
Bash
Executable File
35 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Keep-alive from any machine with cron: a VPS, a Raspberry Pi, a NAS. No GitHub involved,
|
|
# so GitHub's "schedules stop after 60 days without a push" rule cannot bite.
|
|
#
|
|
# One-time setup:
|
|
# mkdir -p ~/supabase-keep-alive && cd ~/supabase-keep-alive
|
|
# curl -fsSL -O https://git.ereboslab.com/caelum0x/supabase-keep-alive-action/raw/tag/v1/keepalive.sh
|
|
# curl -fsSL -O https://git.ereboslab.com/caelum0x/supabase-keep-alive-action/raw/tag/v1/examples/cron.sh
|
|
# chmod 700 cron.sh
|
|
# printf 'SUPABASE_URL=https://YOUR-REF.supabase.co\nSUPABASE_ANON_KEY=YOUR-ANON-KEY\n' > .env
|
|
# chmod 600 .env
|
|
#
|
|
# Then add one line with `crontab -e` (daily at 06:17):
|
|
# 17 6 * * * $HOME/supabase-keep-alive/cron.sh >> $HOME/supabase-keep-alive/keepalive.log 2>&1
|
|
#
|
|
# Exit code 0 = project awake, 1 = paused (HTTP 540) or failed; the log says which.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "missing .env next to cron.sh (SUPABASE_URL and SUPABASE_ANON_KEY)" >&2
|
|
exit 1
|
|
fi
|
|
set -a
|
|
# shellcheck disable=SC1091
|
|
. ./.env
|
|
set +a
|
|
|
|
echo "--- $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
|
INPUT_URL="${SUPABASE_URL:?SUPABASE_URL is not set in .env}" \
|
|
INPUT_ANON_KEY="${SUPABASE_ANON_KEY:?SUPABASE_ANON_KEY is not set in .env}" \
|
|
INPUT_TABLE="${KEEPALIVE_TABLE:-keepalive}" \
|
|
INPUT_RPC="${KEEPALIVE_RPC:-}" \
|
|
bash ./keepalive.sh
|