Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,5 @@ CLAUDE.local.md
# ignore merged schema
data/merged_schema.graphql

# webui release download temp directories
temp-webui-*
backend.ai-webui-bundle-*.zip
# webui release download temp directories (safe to delete)
scripts/temp-releases/
30 changes: 22 additions & 8 deletions scripts/serve-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@ VERSION="$1"
# Remove 'v' prefix if present
VERSION="${VERSION#v}"

# Get script directory and project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")"

# Create temp directory structure
TEMP_BASE="${SCRIPT_DIR}/temp-releases"
mkdir -p "${TEMP_BASE}"

# Construct the download URL and filename
FILENAME="backend.ai-webui-bundle-${VERSION}.zip"
URL="https://github.com/lablup/backend.ai-webui/releases/download/v${VERSION}/${FILENAME}"

# Create a temporary directory for extraction
TEMP_DIR="temp-webui-${VERSION}"
# Set paths in temp directory
DOWNLOAD_PATH="${TEMP_BASE}/${FILENAME}"
TEMP_DIR="${TEMP_BASE}/webui-${VERSION}"

# Check if the version folder already exists
if [ -d "${TEMP_DIR}" ]; then
Expand All @@ -32,28 +41,33 @@ if [ -d "${TEMP_DIR}" ]; then
EXTRACTED_FOLDER="${TEMP_DIR}"
fi
else
echo "Downloading ${FILENAME}..."
curl -L -o "${FILENAME}" "${URL}"
echo "Downloading ${FILENAME} to ${TEMP_BASE}..."
curl -L -o "${DOWNLOAD_PATH}" "${URL}"

if [ ! -f "${FILENAME}" ]; then
if [ ! -f "${DOWNLOAD_PATH}" ]; then
echo "Error: Failed to download ${FILENAME}"
exit 1
fi

echo "Extracting ${FILENAME}..."
rm -rf "${TEMP_DIR}"
unzip -q "${FILENAME}" -d "${TEMP_DIR}"
unzip -q "${DOWNLOAD_PATH}" -d "${TEMP_DIR}"

# Find the extracted folder (it might be nested)
EXTRACTED_FOLDER=$(find "${TEMP_DIR}" -type d -name "*webui*" | head -1)
if [ -z "${EXTRACTED_FOLDER}" ]; then
# If no webui folder found, use the temp directory itself
EXTRACTED_FOLDER="${TEMP_DIR}"
fi

# Optionally remove the zip file after extraction to save space
echo "Removing downloaded zip file..."
rm "${DOWNLOAD_PATH}"
fi

echo "Copying config.toml to extracted folder..."
cp config.toml "${EXTRACTED_FOLDER}/"
echo "Overwriting config.toml and plugins to extracted folder..."
cp "${PROJECT_ROOT}/config.toml" "${EXTRACTED_FOLDER}/"
cp -r "${PROJECT_ROOT}/dist/plugins" "${EXTRACTED_FOLDER}/dist/"

echo "Starting server in ${EXTRACTED_FOLDER}..."
cd "${EXTRACTED_FOLDER}"
Expand Down