diff --git a/ct/comfyui.sh b/ct/comfyui.sh new file mode 100644 index 000000000..c21e010bb --- /dev/null +++ b/ct/comfyui.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: jdacode +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/comfyanonymous/ComfyUI + +APP="ComfyUI" +var_tags="${var_tags:-ai}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-8192}" +var_disk="${var_disk:-25}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/${APP} ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_error "To update use the ${APP} Manager." + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8188${CL}" diff --git a/frontend/public/json/comfyui.json b/frontend/public/json/comfyui.json new file mode 100644 index 000000000..fe6574f25 --- /dev/null +++ b/frontend/public/json/comfyui.json @@ -0,0 +1,47 @@ +{ + "name": "ComfyUI", + "slug": "comfyui", + "categories": [ + 20 + ], + "date_created": "2025-08-01", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8188, + "documentation": "https://github.com/comfyanonymous/ComfyUI", + "website": "https://www.comfy.org/", + "logo": "https://framerusercontent.com/images/3cNQMWKzIhIrQ5KErBm7dSmbd2w.png", + "description": "ComfyUI is a node-based interface and inference engine for generative AI. Users can combine various AI models and operations through nodes to achieve highly customizable and controllable content generation. ComfyUI is completely open source and can run on your local device", + "install_methods": [ + { + "type": "default", + "script": "ct/comfyui.sh", + "resources": { + "cpu": 4, + "ram": 8192, + "hdd": 25, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Application takes long time to install. Please be patient!", + "type": "warning" + }, + { + "text": "Please check that you have installed the drivers for your GPU.", + "type": "info" + }, + { + "text": "You can always skip manual configuration by using dynamic variables. For example: `comfyui_skip_user_config=\"Y|y\" comfyui_python_version_uv=\"3.12\" comfyui_python_args=\"--cpu\" comfyui_gpu_type=\"None|NVIDIA|AMD|Intel\" comfyui_index_url_nvidia=\"URL\" comfyui_index_url_amd=\"URL\" comfyui_index_url_intel=\"URL\" comfyui_manager_enabled=\"N|n\" bash -c \"$(curl -fsSL ...comfyui.sh)\"`", + "type": "info" + } + ] +} diff --git a/install/comfyui-install.sh b/install/comfyui-install.sh new file mode 100644 index 000000000..9e33fa7c3 --- /dev/null +++ b/install/comfyui-install.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: jdacode +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/comfyanonymous/ComfyUI + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + git \ + nvtop +msg_ok "Installed Dependencies" + +application_name="${APPLICATION}" +comfyui_path="/opt/${application_name}" +comfyui_python_path="${comfyui_path}/venv/bin/python" +comfyui_port_arg="8188" +comfyui_skip_user_config="${comfyui_skip_user_config:-N}" +comfyui_python_version_uv="${comfyui_python_version_uv:-3.12}" +comfyui_python_args="${comfyui_python_args:---cpu}" +comfyui_gpu_type="${comfyui_gpu_type:-none}" +comfyui_index_url_nvidia="${comfyui_index_url_nvidia:-https://download.pytorch.org/whl/cu128}" +comfyui_index_url_amd="${comfyui_index_url_amd:-https://download.pytorch.org/whl/rocm6.3}" +comfyui_index_url_intel="${comfyui_index_url_intel:-https://download.pytorch.org/whl/xpu}" +comfyui_manager_enabled="${comfyui_manager_enabled:-Y}" + +if ! [[ "${comfyui_skip_user_config,,}" =~ ^(y|yes)$ ]]; then + echo + echo + echo "${TAB3}${TAB3}Choose the GPU type for ComfyUI:" + echo "${TAB3}${TAB3}-------------------------------" + echo "${TAB3}${TAB3}${TAB3} 1. None" + echo "${TAB3}${TAB3}${TAB3} 2. NVIDIA" + echo "${TAB3}${TAB3}${TAB3} 3. AMD" + echo "${TAB3}${TAB3}${TAB3} 4. Intel" + echo + read -rp "${TAB3}${TAB3}${TAB3}Enter your choice [1-4] (default: 1): " gpu_choice + gpu_choice=${gpu_choice:-1} + case "$gpu_choice" in + 1) comfyui_gpu_type="none";; + 2) comfyui_gpu_type="nvidia";; + 3) comfyui_gpu_type="amd";; + 4) comfyui_gpu_type="intel";; + *) comfyui_gpu_type="none"; echo "${TAB3}${TAB3}${TAB3}${TAB3}Invalid choice. Defaulting to ${comfyui_gpu_type}." ;; + esac + echo + echo +fi + +echo -e "${CM}${BOLD}${DGN}Application name : ${BGN}${application_name}${CL}" +echo -e "${CM}${BOLD}${DGN}Application path : ${BGN}${comfyui_path}${CL}" +echo -e "${CM}${BOLD}${DGN}Skip User Config : ${BGN}${comfyui_skip_user_config}${CL}" +echo -e "${CM}${BOLD}${DGN}GPU : ${BGN}${comfyui_gpu_type}${CL}" +echo -e "${CM}${BOLD}${DGN}ComfyUI Manager : ${BGN}${comfyui_manager_enabled}${CL}" +echo -e "${CM}${BOLD}${DGN}Python version (uv) : ${BGN}${comfyui_python_version_uv}${CL}" +echo -e "${CM}${BOLD}${DGN}Python path (uv) : ${BGN}${comfyui_python_path}${CL}" +echo -e "${CM}${BOLD}${DGN}ComfyUI python args : ${BGN}${comfyui_python_args}${CL}" +echo -e "${CM}${BOLD}${DGN}Pip Nvidia index-url : ${BGN}${comfyui_index_url_nvidia}${CL}" +echo -e "${CM}${BOLD}${DGN}Pip AMD index-url : ${BGN}${comfyui_index_url_amd}${CL}" +echo -e "${CM}${BOLD}${DGN}Pip Intel index-url : ${BGN}${comfyui_index_url_intel}${CL}" +echo -e "${CM}${BOLD}${DGN}Preview ExecStart command : ${BGN}main.py --listen --port ${comfyui_port_arg} ${comfyui_python_args}${CL}" + +msg_info "Setup uv" +PYTHON_VERSION="${comfyui_python_version_uv}" setup_uv +msg_ok "Setup uv" + +fetch_and_deploy_gh_release "${application_name}" "comfyanonymous/ComfyUI" "tarball" "latest" "${comfyui_path}" + +msg_info "Python dependencies" +$STD uv venv "${comfyui_path}/venv" +if [[ "${comfyui_gpu_type,,}" == "nvidia" ]]; then + echo "NVIDIA GPU selected" + $STD uv pip install \ + torch \ + torchvision \ + torchaudio \ + --extra-index-url "${comfyui_index_url_nvidia}" \ + --python="${comfyui_python_path}" +elif [[ "${comfyui_gpu_type,,}" == "amd" ]]; then + echo "AMD GPU selected" + $STD uv pip install \ + torch \ + torchvision \ + torchaudio \ + --index-url "${comfyui_index_url_amd}" \ + --python="${comfyui_python_path}" +elif [[ "${comfyui_gpu_type,,}" == "intel" ]]; then + echo "Intel GPU selected" + $STD uv pip install \ + torch \ + torchvision \ + torchaudio \ + --index-url "${comfyui_index_url_intel}" \ + --python="${comfyui_python_path}" +else + echo "No GPU selected" +fi +$STD uv pip install -r "${comfyui_path}/requirements.txt" --python="${comfyui_python_path}" +msg_ok "Python dependencies" + +if [[ "${comfyui_manager_enabled,,}" =~ ^(y|yes)$ ]]; then + msg_info "Install ${application_name} Manager" + comfyui_manager_dir="${comfyui_path}/custom_nodes/comfyui-manager" + git clone https://github.com/ltdrdata/ComfyUI-Manager "${comfyui_manager_dir}" + $STD uv pip install -r "${comfyui_manager_dir}/requirements.txt" --python="${comfyui_python_path}" + msg_ok "Installed ${application_name} Manager" +else + msg_error "No installed ${application_name} Manager" +fi + +msg_info "Creating Service" +cat </etc/systemd/system/"${application_name}".service +[Unit] +Description=${application_name} Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=${comfyui_path} +ExecStart=${comfyui_python_path} ${comfyui_path}/main.py --listen --port ${comfyui_port_arg} ${comfyui_python_args} +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now "${application_name}" +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"