feat: Add IndexNow submission and sitemap updates
- Add IndexNow submit script + state tracking - Update deploy script to notify IndexNow after healthy deploy - Publish IndexNow verification file in public - Update sitemaps and add env placeholders - Pass analytics/ads/IndexNow env vars into frontend build
This commit is contained in:
@@ -28,20 +28,44 @@ if [ ! -f ".env" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}1/7 — Pulling latest code...${NC}"
|
||||
read_env_value() {
|
||||
local key="$1"
|
||||
local fallback="${2:-}"
|
||||
local shell_value="${!key-}"
|
||||
local file_value
|
||||
|
||||
file_value="$(grep -E "^${key}=" .env 2>/dev/null | tail -n 1 | cut -d= -f2- || true)"
|
||||
|
||||
if [ -n "$shell_value" ]; then
|
||||
printf '%s' "$shell_value"
|
||||
elif [ -n "$file_value" ]; then
|
||||
printf '%s' "$file_value"
|
||||
else
|
||||
printf '%s' "$fallback"
|
||||
fi
|
||||
}
|
||||
|
||||
normalize_bool() {
|
||||
printf '%s' "$1" | tr '[:upper:]' '[:lower:]'
|
||||
}
|
||||
|
||||
INDEXNOW_AUTO_SUBMIT_VALUE="$(normalize_bool "$(read_env_value INDEXNOW_AUTO_SUBMIT 1)")"
|
||||
INDEXNOW_STRICT_VALUE="$(normalize_bool "$(read_env_value INDEXNOW_STRICT false)")"
|
||||
|
||||
echo -e "${YELLOW}1/8 — Pulling latest code...${NC}"
|
||||
git pull origin main 2>/dev/null || echo "Not a git repo or no remote, skipping pull."
|
||||
|
||||
echo -e "${YELLOW}2/7 — Building Docker images...${NC}"
|
||||
echo -e "${YELLOW}2/8 — Building Docker images...${NC}"
|
||||
docker compose -f docker-compose.prod.yml build --no-cache
|
||||
|
||||
echo -e "${YELLOW}3/7 — Stopping old containers...${NC}"
|
||||
echo -e "${YELLOW}3/8 — Stopping old containers...${NC}"
|
||||
docker compose -f docker-compose.prod.yml down --remove-orphans
|
||||
|
||||
echo -e "${YELLOW}4/7 — Starting services...${NC}"
|
||||
echo -e "${YELLOW}4/8 — Starting services...${NC}"
|
||||
docker compose -f docker-compose.prod.yml up -d
|
||||
|
||||
if [ "${SKIP_AI_RUNTIME_CHECKS:-0}" != "1" ]; then
|
||||
echo -e "${YELLOW}5/7 — Verifying AI runtime in backend + worker...${NC}"
|
||||
echo -e "${YELLOW}5/8 — Verifying AI runtime in backend + worker...${NC}"
|
||||
for service in backend celery_worker; do
|
||||
if ! docker compose -f docker-compose.prod.yml exec -T "$service" python - <<'PY'
|
||||
import importlib.util
|
||||
@@ -69,10 +93,10 @@ PY
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${YELLOW}5/7 — Skipping AI runtime checks (SKIP_AI_RUNTIME_CHECKS=1).${NC}"
|
||||
echo -e "${YELLOW}5/8 — Skipping AI runtime checks (SKIP_AI_RUNTIME_CHECKS=1).${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}6/7 — Waiting for health check...${NC}"
|
||||
echo -e "${YELLOW}6/8 — Waiting for health check...${NC}"
|
||||
sleep 10
|
||||
|
||||
# Health check
|
||||
@@ -84,7 +108,23 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}7/7 — Current containers:${NC}"
|
||||
if [ "${INDEXNOW_AUTO_SUBMIT_VALUE:-1}" = "1" ] || [ "${INDEXNOW_AUTO_SUBMIT_VALUE:-true}" = "true" ]; then
|
||||
echo -e "${YELLOW}7/8 — Submitting URLs to IndexNow...${NC}"
|
||||
if docker compose -f docker-compose.prod.yml run --rm frontend_build_step node scripts/submit-indexnow.mjs; then
|
||||
echo -e "${GREEN}✓ IndexNow notification completed.${NC}"
|
||||
else
|
||||
if [ "$INDEXNOW_STRICT_VALUE" = "1" ] || [ "$INDEXNOW_STRICT_VALUE" = "true" ]; then
|
||||
echo -e "${RED}✗ IndexNow notification failed and INDEXNOW_STRICT is enabled.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}! IndexNow notification failed; deployment will continue.${NC}"
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}7/8 — Skipping IndexNow notification (INDEXNOW_AUTO_SUBMIT=0).${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}8/8 — Current containers:${NC}"
|
||||
docker compose -f docker-compose.prod.yml ps
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user