#!/usr/bin/env bash # ============================================================================= # Regenerate the PYRE dev-status page and deploy it to the nginx webroot. # ============================================================================= # Usage: bash scripts/deploy-status.sh # # Workflow: edit infra/status/status.json -> run this -> the live page at # https://feedthepyre.com updates. # # After a ONE-TIME `sudo chown -R pyre:pyre /var/www/feedthepyre`, this runs # WITHOUT sudo (nginx/www-data still serves the world-readable files fine). # Until then, run it with sudo. # ============================================================================= set -euo pipefail REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" WEBROOT="/var/www/feedthepyre/status" node "${REPO_DIR}/scripts/gen-status.mjs" if [[ -d "${WEBROOT}" && -w "${WEBROOT}" ]]; then install -m 0644 "${REPO_DIR}/infra/status/index.html" "${WEBROOT}/index.html" install -m 0644 "${REPO_DIR}/infra/status/status.json" "${WEBROOT}/status.json" echo "Deployed status page -> ${WEBROOT}" else echo "ERROR: ${WEBROOT} is missing or not writable by '$(whoami)'." >&2 echo "Run this script with sudo, OR make updates sudo-free once with:" >&2 echo " sudo chown -R pyre:pyre /var/www/feedthepyre" >&2 exit 1 fi