Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto substandard.blog
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051#!/usr/bin/env bash# Build and push the stansite labeler image, then point the ECS service at# that tag and apply the infrastructure.## The labeler is off by default: infra/labeler.tf creates nothing until# labeler_enabled is true and the DID, PDS and signing-key secret are set in# infra/terraform.tfvars.json. The key itself is the operator's; this script# never reads or writes it.set -euo pipefail
repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"region="us-east-1"tofu_args=()for arg in "$@"; do tofu_args+=("${arg}")done
if ! identity="$(aws sts get-caller-identity --output text --query Arn 2>&1)"; then echo "deploy-stansite: AWS credential check failed:" >&2 echo " ${identity}" >&2 exit 1fiecho "deploy-stansite: deploying as ${identity}"
repository="$(tofu -chdir="${repo_root}/infra" output -raw labeler_repository_url 2>/dev/null || true)"if [[ -z "${repository}" || "${repository}" == "null" ]]; then echo "deploy-stansite: the labeler is not enabled." >&2 echo " Set labeler_enabled = true, labeler_pds, and" >&2 echo " labeler_signing_key_secret_arn in infra/terraform.tfvars.json," >&2 echo " then run: tofu -chdir=infra apply" >&2 echo " and run this script again." >&2 exit 1firegistry="${repository%%/*}"
tag="$(git -C "${repo_root}" rev-parse --short=12 HEAD)"aws ecr get-login-password --region "${region}" \ | docker login --username AWS --password-stdin "${registry}" >/dev/null
docker build --platform linux/amd64 -t "${repository}:${tag}" \ -f "${repo_root}/labeler/Dockerfile" "${repo_root}/labeler"docker push "${repository}:${tag}"
node "${repo_root}/scripts/patch-tfvars.mjs" \ "${repo_root}/infra/terraform.tfvars.json" labeler_image_tag "${tag}"tofu -chdir="${repo_root}/infra" apply "${tofu_args[@]}"
echo "deploy-stansite: deployed. Check https://stansite.substandard.blog/health"echo "deploy-stansite: publish the service record after the DID document answers:"echo " ATP_PDS=... ATP_IDENTIFIER=... ATP_APP_PASSWORD=... npm --prefix labeler run publish-service-record"