feat(cdn): sync release metadata through BunnyCDN

Replace the legacy sync:bunny flags with an interactive CDN sync flow for service templates and release metadata. Serve official service templates from the Coollabs CDN, update version metadata, and remove obsolete helper scripts.
This commit is contained in:
Andras Bacsai
2026-07-10 14:29:11 +02:00
parent e4f925ebbf
commit d3fbb32c52
10 changed files with 475 additions and 256 deletions
-97
View File
@@ -1,97 +0,0 @@
#!/bin/bash
set -e
# Validate CONDUCTOR_ROOT_PATH is set and valid before any operations
if [ -z "$CONDUCTOR_ROOT_PATH" ]; then
echo "ERROR: CONDUCTOR_ROOT_PATH environment variable is not set"
echo "This script must be run by Conductor with CONDUCTOR_ROOT_PATH set to the main repository path"
exit 1
fi
if [ ! -d "$CONDUCTOR_ROOT_PATH" ]; then
echo "ERROR: CONDUCTOR_ROOT_PATH ($CONDUCTOR_ROOT_PATH) is not a valid directory"
exit 1
fi
# Copy .env file
cp "$CONDUCTOR_ROOT_PATH/.env" .env
# Setup shared dependencies via symlinks to main repo
echo "Setting up shared node_modules and vendor directories..."
# Ensure main repo has the directories
mkdir -p "$CONDUCTOR_ROOT_PATH/node_modules"
mkdir -p "$CONDUCTOR_ROOT_PATH/vendor"
# Get current worktree path
WORKTREE_PATH=$(pwd)
# Safety check 1: ensure WORKTREE_PATH is valid
if [ -z "$WORKTREE_PATH" ]; then
echo "ERROR: WORKTREE_PATH is empty"
exit 1
fi
# Safety check 2: CRITICAL FIRST - blacklist system directories
# This check runs BEFORE the positive check to prevent dangerous operations
# even if someone misconfigures CONDUCTOR_ROOT_PATH
case "$WORKTREE_PATH" in
/|/bin|/sbin|/usr|/usr/*|/etc|/etc/*|/var|/var/*|/System|/System/*|/Library|/Library/*|/Applications|/Applications/*|"$HOME")
echo "ERROR: WORKTREE_PATH ($WORKTREE_PATH) is in a dangerous system location"
exit 1
;;
esac
# Safety check 3: positive check - verify we're under CONDUCTOR_ROOT_PATH
case "$WORKTREE_PATH" in
"$CONDUCTOR_ROOT_PATH"|"$CONDUCTOR_ROOT_PATH"/.conductor/*)
# Valid: either main repo or under .conductor/
;;
*)
echo "ERROR: WORKTREE_PATH ($WORKTREE_PATH) is not under CONDUCTOR_ROOT_PATH ($CONDUCTOR_ROOT_PATH)"
exit 1
;;
esac
# Safety check 4: verify we're in a git repository
if [ ! -f ".git" ] && [ ! -d ".git" ]; then
echo "ERROR: Not in a git repository"
exit 1
fi
# Remove existing directories/symlinks if they exist
# For symlinks: use 'rm' without -r to remove the symlink itself (not following it)
# For directories: use 'rm -rf' to remove the directory and contents
if [ -L "node_modules" ]; then
# It's a symlink - remove it without following (no -r flag)
rm "$WORKTREE_PATH/node_modules"
elif [ -e "node_modules" ]; then
# It's a regular directory or file - safe to use -rf
rm -rf "$WORKTREE_PATH/node_modules"
fi
if [ -L "vendor" ]; then
# It's a symlink - remove it without following (no -r flag)
rm "$WORKTREE_PATH/vendor"
elif [ -e "vendor" ]; then
# It's a regular directory or file - safe to use -rf
rm -rf "$WORKTREE_PATH/vendor"
fi
# Calculate relative path from worktree to main repo
# Use bash-native approach: try realpath first (GNU coreutils), fallback to perl
if command -v realpath &> /dev/null && realpath --relative-to / / &> /dev/null 2>&1; then
# GNU coreutils realpath with --relative-to support
RELATIVE_PATH=$(realpath --relative-to="$WORKTREE_PATH" "$CONDUCTOR_ROOT_PATH")
else
# Fallback: use perl which is standard on macOS and most Unix systems
RELATIVE_PATH=$(perl -e 'use File::Spec; print File::Spec->abs2rel($ARGV[0], $ARGV[1])' "$CONDUCTOR_ROOT_PATH" "$WORKTREE_PATH")
fi
# Create symlinks to main repo's node_modules and vendor
ln -sf "$RELATIVE_PATH/node_modules" node_modules
ln -sf "$RELATIVE_PATH/vendor" vendor
echo "✓ Shared dependencies linked successfully"
echo " node_modules -> $RELATIVE_PATH/node_modules"
echo " vendor -> $RELATIVE_PATH/vendor"
-57
View File
@@ -1,57 +0,0 @@
#!/bin/bash
# Sync docker volumes between two servers
VERSION="1.0.0"
SOURCE=$1
DESTINATION=$2
set -e
if [ -z "$SOURCE" ]; then
echo "Source server is not specified."
exit 1
fi
if [ -z "$DESTINATION" ]; then
echo "Destination server is not specified."
exit 1
fi
SOURCE_USER=$(echo $SOURCE | cut -d@ -f1)
SOURCE_SERVER=$(echo $SOURCE | cut -d: -f1 | cut -d@ -f2)
SOURCE_PORT=$(echo $SOURCE | cut -d: -f2 | cut -d/ -f1)
SOURCE_VOLUME_NAME=$(echo $SOURCE | cut -d/ -f2)
if ! [[ "$SOURCE_PORT" =~ ^[0-9]+$ ]]; then
echo "Invalid source port: $SOURCE_PORT"
exit 1
fi
DESTINATION_USER=$(echo $DESTINATION | cut -d@ -f1)
DESTINATION_SERVER=$(echo $DESTINATION | cut -d: -f1 | cut -d@ -f2)
DESTINATION_PORT=$(echo $DESTINATION | cut -d: -f2 | cut -d/ -f1)
DESTINATION_VOLUME_NAME=$(echo $DESTINATION | cut -d/ -f2)
if ! [[ "$DESTINATION_PORT" =~ ^[0-9]+$ ]]; then
echo "Invalid destination port: $DESTINATION_PORT"
exit 1
fi
echo "Generating backup file to ./$SOURCE_VOLUME_NAME.tgz"
ssh -p $SOURCE_PORT $SOURCE_USER@$SOURCE_SERVER "docker run -v $SOURCE_VOLUME_NAME:/volume --rm --log-driver none loomchild/volume-backup backup -c pigz -v" >./$SOURCE_VOLUME_NAME.tgz
echo ""
if [ -f "./$SOURCE_VOLUME_NAME.tgz" ]; then
echo "Uploading backup file to $DESTINATION_SERVER:~/$DESTINATION_VOLUME_NAME.tgz"
scp -P $DESTINATION_PORT ./$SOURCE_VOLUME_NAME.tgz $DESTINATION_USER@$DESTINATION_SERVER:~/$DESTINATION_VOLUME_NAME.tgz
echo ""
echo "Restoring backup file on remote ($DESTINATION_SERVER:/~/$DESTINATION_VOLUME_NAME.tgz)"
ssh -p $DESTINATION_PORT $DESTINATION_USER@$DESTINATION_SERVER "docker run -i -v $DESTINATION_VOLUME_NAME:/volume --log-driver none --rm loomchild/volume-backup restore -c pigz -vf < ~/$DESTINATION_VOLUME_NAME.tgz"
echo ""
echo "Deleting backup file on remote ($DESTINATION_SERVER:/~/$DESTINATION_VOLUME_NAME.tgz)"
ssh -p $DESTINATION_PORT $DESTINATION_USER@$DESTINATION_SERVER "rm ~/$DESTINATION_VOLUME_NAME.tgz"
echo ""
echo "Local file ./$SOURCE_VOLUME_NAME.tgz is not deleted."
echo ""
echo "WARNING: If you are copying a database volume, you need to set the right users/passwords on the destination service's environment variables."
echo "Why? Because we are copying the volume as-is, so the database credentials will bethe same as on the source volume."
fi