fix: replace startup sleep with readiness check, clean up stale env/config
- start.example.sh: replace fixed sleep 30 with /status poll loop (up to 2min) so the webmention poller waits exactly until indiekit is ready, not longer - indiekit.config.mjs: remove redundant webmentionIoMountPath variable and mountPath from webmention-io config (package default /webmentions is correct) - .env.example: remove all stale proxy and unused WEBMENTION_SENDER_* vars (HOST, PORT, ENDPOINT, READY_TIMEOUT, STOP_TIMEOUT, AUTO_POLL) that were never read by start.example.sh; keep only WEBMENTION_SENDER_POLL_INTERVAL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
44
.env.example
44
.env.example
@@ -10,53 +10,12 @@ PODROLL_EPISODES_URL=
|
||||
# Example: https://freshrss.example/api/query.php?user=USER&t=TOKEN&f=opml
|
||||
PODROLL_OPML_URL=
|
||||
|
||||
# Optional webmention sender endpoint settings
|
||||
# Default mount path in indiekit.config.mjs is /webmention-sender
|
||||
WEBMENTION_SENDER_MOUNT_PATH=/webmention-sender
|
||||
|
||||
# Endpoint discovery timeout (milliseconds)
|
||||
WEBMENTION_SENDER_TIMEOUT=10000
|
||||
|
||||
# User-Agent used for target endpoint discovery and sends
|
||||
WEBMENTION_SENDER_USER_AGENT=
|
||||
|
||||
# Enable start script auto-send polling loop (1=enabled, 0=disabled)
|
||||
WEBMENTION_SENDER_AUTO_POLL=1
|
||||
|
||||
# Polling interval in seconds
|
||||
WEBMENTION_SENDER_POLL_INTERVAL=300
|
||||
|
||||
# Internal host/port used by polling loop
|
||||
# Defaults in start script: host=127.0.0.1, port=$PORT (or 3000)
|
||||
WEBMENTION_SENDER_HOST="https://blog.giersig.eu"
|
||||
WEBMENTION_SENDER_PORT=3000
|
||||
|
||||
# Optional override for JWT me claim (defaults: PUBLICATION_URL -> SITE_URL)
|
||||
WEBMENTION_SENDER_ORIGIN=
|
||||
|
||||
# Optional full endpoint override (instead of host/port/mount path)
|
||||
# Example: http://127.0.0.1:3000/webmention-sender
|
||||
WEBMENTION_SENDER_ENDPOINT=
|
||||
|
||||
# Wait up to this many seconds for endpoint readiness before first poll
|
||||
WEBMENTION_SENDER_READY_TIMEOUT=60
|
||||
|
||||
# Graceful stop timeout for webmention poller during shutdown (seconds)
|
||||
WEBMENTION_SENDER_STOP_TIMEOUT=5
|
||||
|
||||
# Graceful stop timeout for Indiekit process during shutdown (seconds)
|
||||
INDIEKIT_STOP_TIMEOUT=20
|
||||
|
||||
# If parent process is FreeBSD daemon(8), terminate it during shutdown (1/0)
|
||||
KILL_DAEMON_PARENT_ON_SHUTDOWN=1
|
||||
|
||||
# Optional webmentions proxy endpoint settings
|
||||
# Default mount path in indiekit.config.mjs is /webmentions-api
|
||||
WEBMENTIONS_PROXY_MOUNT_PATH=/webmentions-api
|
||||
|
||||
# Cache TTL in seconds for proxied webmention.io API responses
|
||||
WEBMENTIONS_PROXY_CACHE_TTL=60
|
||||
|
||||
# Optional listening endpoint update cadence (milliseconds)
|
||||
# Lower values increase freshness but add upstream API load.
|
||||
LISTENING_CACHE_TTL=120000
|
||||
@@ -82,3 +41,6 @@ BLUESKY_PASSWORD=
|
||||
MASTODON_URL=
|
||||
MASTODON_USER=
|
||||
MASTODON_ACCESS_TOKEN=
|
||||
|
||||
# Poll interval for webmention-sender (seconds). Long enough for deploys to complete.
|
||||
WEBMENTION_SENDER_POLL_INTERVAL=600
|
||||
|
||||
@@ -125,8 +125,6 @@ const webmentionSenderTimeout = Number.isFinite(webmentionSenderTimeoutRaw)
|
||||
: 10000;
|
||||
const webmentionSenderUserAgent =
|
||||
process.env.WEBMENTION_SENDER_USER_AGENT || `${siteName} Webmention Sender`;
|
||||
const webmentionIoMountPath =
|
||||
process.env.WEBMENTION_IO_MOUNT_PATH || "/webmentions";
|
||||
const commentsMountPath = process.env.COMMENTS_MOUNT_PATH || "/comments";
|
||||
const commentsRateLimitPerHourRaw = Number.parseInt(
|
||||
process.env.COMMENTS_RATE_LIMIT_PER_HOUR || "5",
|
||||
@@ -342,7 +340,6 @@ export default {
|
||||
username: githubUsername,
|
||||
},
|
||||
"@rmdes/indiekit-endpoint-webmention-io": {
|
||||
mountPath: webmentionIoMountPath,
|
||||
token: process.env.WEBMENTION_IO_TOKEN,
|
||||
domain: webmentionDomain,
|
||||
},
|
||||
|
||||
@@ -67,7 +67,14 @@ WEBMENTION_ORIGIN="${PUBLICATION_URL:-${SITE_URL:-}}"
|
||||
|
||||
(
|
||||
echo "[webmention] Starting auto-send polling every ${WEBMENTION_POLL_INTERVAL}s (${WEBMENTION_ENDPOINT})"
|
||||
sleep 30 # Wait for indiekit to fully initialize before first poll
|
||||
# Wait for indiekit to be ready before first poll (up to 2 minutes)
|
||||
_i=0
|
||||
until curl -sf "http://127.0.0.1:${PORT:-3000}/status" -o /dev/null 2>&1; do
|
||||
_i=$((_i + 1))
|
||||
[ $_i -lt 60 ] || { echo "[webmention] Warning: indiekit not ready after 120s, proceeding anyway"; break; }
|
||||
sleep 2
|
||||
done
|
||||
echo "[webmention] Indiekit ready"
|
||||
while true; do
|
||||
TOKEN="$(
|
||||
WEBMENTION_ORIGIN="$WEBMENTION_ORIGIN" WEBMENTION_SECRET="$SECRET" \
|
||||
|
||||
Reference in New Issue
Block a user