1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 04:38:48 +03:00
Files
ac-deploy/sim/cluster0/scripts/deploy-ac-url-shortener.sh
Anton Afanasyeu 02ef6bc7c0 cluster0: sync ac-workspace and url-shortener on lab deploy
Add deploy-ac-workspace, deploy-ac-url-shortener, validate-ac-repos;
wire into populate app phase and verify_lab_setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 12:49:40 +02:00

29 lines
1016 B
Bash
Executable File

#!/bin/sh
# Deploy ac-ms-url-shortener (replaces monolith submodule path on lab nodes).
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=/dev/null
. "$ROOT/scripts/lib/common.sh"
load_cluster_env
URL_ROOT="${URL_SHORTENER_ROOT:-/var/www/url-shortener}"
ORIGIN="${URL_SHORTENER_ORIGIN:-git://f0xx.org/ac/ac-ms-url-shortener}"
BRANCH="${AC_GIT_BRANCH:-next}"
mkdir -p "$(dirname "$URL_ROOT")"
git config --global --add safe.directory "$URL_ROOT" 2>/dev/null || true
if [ -d "${URL_ROOT}/.git" ]; then
log "url-shortener pull ${BRANCH}"
git -C "$URL_ROOT" fetch origin
git -C "$URL_ROOT" checkout "$BRANCH"
git -C "$URL_ROOT" pull --ff-only origin "$BRANCH" || git -C "$URL_ROOT" reset --hard "origin/${BRANCH}"
else
log "url-shortener clone ${ORIGIN}"
rm -rf "$URL_ROOT"
git clone --branch "$BRANCH" --depth 1 "$ORIGIN" "$URL_ROOT"
fi
chown -R nginx:nginx "$URL_ROOT" 2>/dev/null || true
log "deploy-ac-url-shortener_ok $(host_short) $(git -C "$URL_ROOT" rev-parse --short HEAD)"