{"slug": "provision-sh", "title": "provision.sh", "summary": "A developer published a bash provisioning script for Vast.ai that automates first-boot setup of a ComfyUI environment, cloning the ComfyUI repository, installing prebuilt llama-cpp-python and FlashAttention wheels, downloading a set of MiniMax-H3 models and LoRAs from Hugging Face, and pulling ten custom nodes. The script wraps installs and downloads in a three-attempt retry helper with 5- and 10-second backoff, falls back between uv and pip or hf commands, and records missing prerequisites such as the virtualenv or uv in a failures array.", "body_md": "|  | #!/usr/bin/env bash | \n|  | # Vast.ai ComfyUI first-boot provisioning script. | \n|  | # Set PROVISIONING_SCRIPT to the public raw URL for this file. | \n|  | set -uo pipefail | \n|  | WORKSPACE=\"${WORKSPACE:-/workspace}\" | \n|  | COMFYUI_DIR=\"${WORKSPACE}/ComfyUI\" | \n|  | COMFYUI_REPO_URL=\"${COMFYUI_REPO_URL:-https://github.com/Comfy-Org/ComfyUI.git}\" | \n|  | COMFYUI_BRANCH=\"${COMFYUI_BRANCH:-master}\" | \n|  | MODELS_DIR=\"${COMFYUI_DIR}/models\" | \n|  | VENV_PYTHON=\"/venv/main/bin/python\" | \n|  | export HF_HUB_DOWNLOAD_TIMEOUT=\"${HF_HUB_DOWNLOAD_TIMEOUT:-60}\" | \n|  | export HF_HUB_ETAG_TIMEOUT=\"${HF_HUB_ETAG_TIMEOUT:-30}\" | \n|  | WHEEL_URLS=( | \n|  | \"https://github.com/JamePeng/llama-cpp-python/releases/download/v0.3.49-cu131-linux-20260831/llama_cpp_python-0.3.49+cu131-cp312-cp312-linux_x86_64.whl\" | \n|  | \"https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.9.0/flash_attn-2.8.3+cu130torch2.10-cp312-cp312-linux_x86_64.whl\" | \n|  | ) | \n|  | MODEL_DOWNLOADS=( | \n|  | \"hf://lightx2v/Minimax-h3-Turbo/minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors\\|loras\" | \n|  | \"hf://Comfy-Org/MiniMax-H3/vae/minimax_h3_audio_vae_fp32.safetensors\\|vae\" | \n|  | \"hf://Kijai/MiniMax-H3-experimental/minimax_h3_video_vae_int8_convrot.safetensors\\|vae\" | \n|  | \"hf://Comfy-Org/MiniMax-H3/loras/minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors\\|loras\" | \n|  | \"hf://Momoking/Qwen3-VL-32B-Heretic-MiniMax-H3-NVFP4/qwen3vl_32b_heretic_minimax_h3_nvfp4.safetensors\\|text_encoders\" | \n|  | \"hf://Comfy-Org/MiniMax-H3/diffusion_models/minimax_h3_ref2va_int8_convrot.safetensors\\|diffusion_models\" | \n|  | \"hf://TenStrip/10Eros-Max/10Eros_Max_h3_TURBO-hybrid_beta5_int8.safetensors\\|diffusion_models\" | \n|  | \"hf://larryvrh/MiniMax-H3-Turbo-Lora/minimax_h3_turbo_v4_step600_ema.safetensors\\|loras\" | \n|  | ) | \n|  | CUSTOM_NODES=( | \n|  | \"https://github.com/city96/ComfyUI-GGUF.git\" | \n|  | \"https://github.com/rgthree/rgthree-comfy.git\" | \n|  | \"https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI.git\" | \n|  | \"https://github.com/willmiao/ComfyUI-Lora-Manager.git\" | \n|  | \"https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git\" | \n|  | \"https://github.com/kijai/ComfyUI-KJNodes.git\" | \n|  | \"https://github.com/yolain/ComfyUI-Easy-Use.git\" | \n|  | \"https://github.com/Comfy-Org/Nvidia_RTX_Nodes_ComfyUI.git\" | \n|  | \"https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git\" | \n|  | \"https://github.com/dreevelle/ComfyUI-ResolutionTools.git\" | \n|  | \"https://github.com/vrgamegirl19/comfyui-vrgamedevgirl.git\" | \n|  | # \"https://github.com/owner/ComfyUI-Custom-Node.git\" | \n|  | ) | \n|  | failures=() | \n|  | # Three attempts, with 5- and 10-second delays between failures. | \n|  | retry() { | \n|  | local attempt | \n|  | for attempt in 1 2 3; do | \n|  | if \"$@\"; then | \n|  | return 0 | \n|  | fi | \n|  | if ((attempt < 3)); then | \n|  | echo \"Warning: attempt ${attempt}/3 failed; retrying in $((attempt * 5)) seconds.\" | \n|  | sleep \"$((attempt * 5))\" | \n|  | fi | \n|  | done | \n|  | return 1 | \n|  | } | \n|  | if [[ -f /venv/main/bin/activate ]]; then | \n|  | # shellcheck disable=SC1091 | \n|  | source /venv/main/bin/activate | \n|  | else | \n|  | echo \"Warning: /venv/main/bin/activate was not found.\" | \n|  | failures+=(\"main virtual environment\") | \n|  | fi | \n|  | if command -v uv >/dev/null 2>&1; then | \n|  | HF_COMMAND=(uv tool run hf) | \n|  | elif command -v hf >/dev/null 2>&1; then | \n|  | echo \"Warning: uv was not found; using the existing hf command.\" | \n|  | failures+=(\"uv\") | \n|  | HF_COMMAND=(hf) | \n|  | else | \n|  | echo \"Warning: neither uv nor hf was found; model downloads will fail.\" | \n|  | failures+=(\"uv and hf\") | \n|  | HF_COMMAND=(hf) | \n|  | fi | \n|  | if command -v uv >/dev/null 2>&1; then | \n|  | PIP_COMMAND=(uv pip install --python \"${VENV_PYTHON}\") | \n|  | else | \n|  | PIP_COMMAND=(\"${VENV_PYTHON}\" -m pip install) | \n|  | fi | \n|  | echo \"Updating ComfyUI to latest (${COMFYUI_BRANCH})...\" | \n|  | COMFYUI_GIT=(git -c safe.directory='*' -C \"${COMFYUI_DIR}\") | \n|  | comfyui_updated=false | \n|  | if [[ -d \"${COMFYUI_DIR}/.git\" ]]; then | \n|  | if retry \"${COMFYUI_GIT[@]}\" fetch origin \"+refs/heads/${COMFYUI_BRANCH}:refs/remotes/origin/${COMFYUI_BRANCH}\" && \\ | \n|  | \"${COMFYUI_GIT[@]}\" checkout -f -B \"${COMFYUI_BRANCH}\" \"refs/remotes/origin/${COMFYUI_BRANCH}\"; then | \n|  | comfyui_updated=true | \n|  | else | \n|  | echo \"Warning: failed to update ComfyUI in ${COMFYUI_DIR}; continuing.\" | \n|  | failures+=(\"ComfyUI update\") | \n|  | fi | \n|  | elif [[ ! -e \"${COMFYUI_DIR}\" ]]; then | \n|  | if retry git clone --branch \"${COMFYUI_BRANCH}\" \"${COMFYUI_REPO_URL}\" \"${COMFYUI_DIR}\"; then | \n|  | comfyui_updated=true | \n|  | else | \n|  | echo \"Warning: failed to clone ComfyUI into ${COMFYUI_DIR}; continuing.\" | \n|  | failures+=(\"ComfyUI clone\") | \n|  | fi | \n|  | else | \n|  | echo \"Warning: ${COMFYUI_DIR} exists but is not a git repository; skipping ComfyUI update.\" | \n|  | failures+=(\"ComfyUI update (not a git repo)\") | \n|  | fi | \n|  | if [[ \"${comfyui_updated}\" == true ]]; then | \n|  | comfyui_commit=\"$(\"${COMFYUI_GIT[@]}\" rev-parse --short HEAD 2>/dev/null \\|\\| true)\" | \n|  | if [[ -n \"${comfyui_commit}\" ]]; then | \n|  | echo \"ComfyUI is now at ${comfyui_commit}.\" | \n|  | fi | \n|  | if [[ -f \"${COMFYUI_DIR}/requirements.txt\" ]]; then | \n|  | echo \"Installing ComfyUI requirements...\" | \n|  | if ! retry \"${PIP_COMMAND[@]}\" -r \"${COMFYUI_DIR}/requirements.txt\"; then | \n|  | echo \"Warning: failed to install ComfyUI requirements; continuing.\" | \n|  | failures+=(\"ComfyUI requirements\") | \n|  | fi | \n|  | fi | \n|  | if [[ -f \"${COMFYUI_DIR}/manager_requirements.txt\" ]] && \\ | \n|  | [[ -x \"${VENV_PYTHON}\" ]] && \\ | \n|  | \"${VENV_PYTHON}\" -c \"import importlib.metadata; importlib.metadata.version('comfyui-manager')\" >/dev/null 2>&1; then | \n|  | echo \"Installing ComfyUI Manager requirements...\" | \n|  | if ! retry \"${PIP_COMMAND[@]}\" -r \"${COMFYUI_DIR}/manager_requirements.txt\"; then | \n|  | echo \"Warning: failed to install ComfyUI Manager requirements; continuing.\" | \n|  | failures+=(\"ComfyUI Manager requirements\") | \n|  | fi | \n|  | fi | \n|  | fi | \n|  | for entry in \"${MODEL_DOWNLOADS[@]}\"; do | \n|  | uri=\"${entry%%\\|*}\" | \n|  | model_subdir=\"${entry#*\\|}\" | \n|  | destination=\"${MODELS_DIR}/${model_subdir}\" | \n|  | # hf preserves repository paths. Avoid vae/vae, loras/loras, etc. | \n|  | repo_path=\"${uri#hf://}\" | \n|  | repo_path=\"${repo_path#*/}\" | \n|  | repo_path=\"${repo_path#*/}\" | \n|  | download_dir=\"${destination}\" | \n|  | if [[ \"${repo_path}\" == \"${model_subdir}/\"* ]]; then | \n|  | download_dir=\"${MODELS_DIR}\" | \n|  | fi | \n|  | if ! mkdir -p \"${destination}\"; then | \n|  | failures+=(\"${uri}: destination directory\") | \n|  | continue | \n|  | fi | \n|  | echo \"Downloading ${uri} to ${destination}\" | \n|  | if ! retry \"${HF_COMMAND[@]}\" download \"${uri}\" --local-dir \"${download_dir}\"; then | \n|  | echo \"Warning: download failed; continuing with the next model.\" | \n|  | failures+=(\"${uri}\") | \n|  | fi | \n|  | done | \n|  | # Install prebuilt CUDA wheels before custom-node requirements so pip/uv | \n|  | # does not try to compile packages like llama-cpp-python from source. | \n|  | for wheel_url in \"${WHEEL_URLS[@]}\"; do | \n|  | echo \"Installing wheel ${wheel_url##*/}\" | \n|  | if ! retry \"${PIP_COMMAND[@]}\" \"${wheel_url}\"; then | \n|  | echo \"Warning: wheel installation failed; continuing.\" | \n|  | failures+=(\"${wheel_url##*/}\") | \n|  | fi | \n|  | done | \n|  | CUSTOM_NODES_DIR=\"${COMFYUI_DIR}/custom_nodes\" | \n|  | mkdir -p \"${CUSTOM_NODES_DIR}\" | \n|  | for repo_url in \"${CUSTOM_NODES[@]}\"; do | \n|  | node_name=\"${repo_url%/}\" | \n|  | node_name=\"${node_name##*/}\" | \n|  | node_name=\"${node_name%.git}\" | \n|  | node_dir=\"${CUSTOM_NODES_DIR}/${node_name}\" | \n|  | if [[ -d \"${node_dir}/.git\" ]]; then | \n|  | echo \"Custom node ${node_name} already exists; skipping clone.\" | \n|  | elif ! retry git clone \"${repo_url}\" \"${node_dir}\"; then | \n|  | echo \"Warning: failed to clone ${repo_url}; continuing.\" | \n|  | failures+=(\"${repo_url}\") | \n|  | continue | \n|  | fi | \n|  | node_requirements=\"${node_dir}/requirements.txt\" | \n|  | if [[ -f \"${node_requirements}\" ]]; then | \n|  | echo \"Installing requirements for ${node_name}...\" | \n|  | if ! retry \"${PIP_COMMAND[@]}\" -r \"${node_requirements}\"; then | \n|  | echo \"Warning: failed to install requirements for ${node_name}; continuing.\" | \n|  | failures+=(\"${node_name} requirements\") | \n|  | fi | \n|  | fi | \n|  | done | \n|  | if ((${#failures[@]} > 0)); then | \n|  | echo | \n|  | echo \"Provisioning finished with ${#failures[@]} warning(s):\" | \n|  | printf ' - %s\\n' \"${failures[@]}\" | \n|  | else | \n|  | echo \"Provisioning completed successfully.\" | \n|  | fi | \n|  | # Always succeed so one unavailable download or custom node does not stop setup. | \n|  | exit 0 |", "url": "https://wpnews.pro/news/provision-sh", "canonical_source": "https://gist.github.com/Marcus-Arcadius/dfab99cdaa7a2457019f6f5bd77b0972", "published_at": "2026-12-04 09:33:34+00:00", "updated_at": "2026-12-04 10:17:32.614395+00:00", "lang": "en", "topics": ["generative-ai", "ai-tools", "ai-infrastructure", "developer-tools"], "entities": ["Vast.ai", "ComfyUI", "Hugging Face", "MiniMax", "Qwen", "uv"], "also_reported_by": [], "takeaway": "A first-boot provisioning script can make a GPU rental reproducible by pinning prebuilt wheels, model URLs and custom nodes, and wrapping each network step in a three-attempt retry with 5- and 10-second backoff while logging missing prerequisites to a failures array.", "recommendation": {"advice": "Pin prebuilt CUDA wheels and model URLs in a provisioning script and wrap each download or install in a retry with backoff so a single network failure doesn't leave a rented GPU half-configured.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/provision-sh", "markdown": "https://wpnews.pro/news/provision-sh.md", "text": "https://wpnews.pro/news/provision-sh.txt", "jsonld": "https://wpnews.pro/news/provision-sh.jsonld"}}