|
1 | 1 | # ComfyUI Helper Scripts
|
2 | 2 |
|
3 |
| -This directory contains various helper scripts designed to streamline working with ComfyStream: |
| 3 | +This directory contains helper scripts to simplify the deployment and management of **ComfyStream**: |
4 | 4 |
|
5 |
| -- `spinup_comfystream_tensordock.py`: Spins up a ComfyStream instance on a [Tensordock server](https://tensordock.com/), installs dependencies, and starts the server. |
| 5 | +- **Ansible Playbook (`ansible/plays/setup_comfystream.yml`)** – Deploys ComfyStream on any cloud provider. |
| 6 | +- **`spinup_comfystream_tensordock.py`** – Fully automates VM creation and ComfyStream setup on a [TensorDock server](https://tensordock.com/). |
6 | 7 |
|
7 | 8 | ## Usage Instructions
|
8 | 9 |
|
9 |
| -### Spinup TensorDock ComfyStream Instance |
| 10 | +### Ansible Playbook (Cloud-Agnostic Deployment) |
10 | 11 |
|
11 |
| -1. **Create a Tensordock Account**: Register at [Tensordock](https://dashboard.tensordock.com/register), attach a credit card, and create an API key and token. |
12 |
| -2. **Set Up a Python Virtual Environment**: |
13 |
| - Create and activate a virtual environment using [Conda](https://docs.anaconda.com/miniconda/) and install the required dependencies: |
| 12 | +This repository includes an [Ansible playbook](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html) to deploy ComfyStream on any cloud provider. Follow the steps below: |
| 13 | + |
| 14 | +1. **Create a VM**: |
| 15 | + Deploy a VM on a cloud provider such as [TensorDock](https://marketplace.tensordock.com/deploy?gpu=geforcertx4090-pcie-24gb&gpuCount=1&ramAmount=16&vcpuCount=4&storage=100&os=Ubuntu-22.04-LTS), AWS, Google Cloud, or Azure with the following minimum specifications: |
| 16 | + - **GPU**: 20GB VRAM |
| 17 | + - **RAM**: 16GB |
| 18 | + - **CPU**: 4 vCPUs |
| 19 | + - **Storage**: 100GB |
| 20 | + |
| 21 | + > [!TIP] |
| 22 | + > You can use the `spinup_comfystream_tensordock.py --bare-vm` script to create a [compatible VM on TensorDock](https://marketplace.tensordock.com/deploy?gpu=geforcertx4090-pcie-24gb&gpuCount=1&ramAmount=16&vcpuCount=4&storage=100&os=Ubuntu-22.04-LTS) |
| 23 | +
|
| 24 | +2. **Open Required Ports**: |
| 25 | + Ensure the following ports are open **inbound and outbound** on the VM's firewall/security group: |
| 26 | + - **SSH (Port 22)** – Remote access |
| 27 | + - **HTTPS (Port 8189)** – ComfyStream access |
| 28 | + |
| 29 | +3. **Install Ansible**: |
| 30 | + Follow the [official Ansible installation guide](https://docs.ansible.com/ansible/latest/installation_guide/index.html). |
| 31 | + |
| 32 | +4. **Configure the Inventory File**: |
| 33 | + Add the VM’s public IP to `ansible/inventory.yml`. |
| 34 | + |
| 35 | +5. **Change the ComfyUI Password:** |
| 36 | + Open the `ansible/plays/setup_comfystream.yaml` file and replace the `comfyui_password` value with your own secure password. |
| 37 | + |
| 38 | +6. **Run the Playbook**: |
| 39 | + Execute: |
14 | 40 |
|
15 | 41 | ```bash
|
16 |
| - conda create -n comfystream python=3.8 |
17 |
| - conda activate comfystream |
18 |
| - pip install -r requirements.txt |
| 42 | + ansible-playbook -i ansible/inventory.yaml ansible/plays/setup_comfystream.yaml |
19 | 43 | ```
|
20 | 44 |
|
21 |
| -3. **Check Available Options** *(Optional but Recommended)*: |
22 |
| - To see all available script options, run: |
| 45 | + > [!IMPORTANT] |
| 46 | + > When using a non-sudo user, add `--ask-become-pass` to provide the sudo password or use an Ansible vault for secure storage. |
| 47 | + |
| 48 | +7. **Access the Server**: |
| 49 | + After the playbook completes, **ComfyStream** will start, and you can access **ComfyUI** at `https://<VM_IP>:<PORT_FOR_8189>`. Credentials are shown in the output and regenerated each time. To persist the password, set the `comfyui_password` variable when running the playbook: |
| 50 | + |
| 51 | + ```bash |
| 52 | + ansible-playbook -i ansible/inventory.yaml ansible/plays/setup_comfystream.yaml -e "comfyui_password=YourSecurePasswordHere" |
| 53 | + ``` |
| 54 | + |
| 55 | +> [!IMPORTANT] |
| 56 | +> If you encounter a `toomanyrequests` error while pulling the Docker image, either wait a few minutes or provide your Docker credentials when running the playbook: |
| 57 | +> |
| 58 | +> ```bash |
| 59 | +> ansible-playbook -i ansible/inventory.yaml ansible/plays/setup_comfystream.yaml -e "docker_hub_username=your_dockerhub_username docker_hub_password=your_dockerhub_pat" |
| 60 | +> ``` |
| 61 | + |
| 62 | +> [!TIP] |
| 63 | +> The [ComfyStream Docker image](https://hub.docker.com/r/livepeer/comfystream/tags) is **~20GB**. To check download progress, SSH into the VM and run: |
| 64 | +> |
| 65 | +> ```bash |
| 66 | +> docker pull livepeer/comfystream:latest |
| 67 | +> ``` |
| 68 | + |
| 69 | +### TensorDock Spinup Script (Fully Automated) |
| 70 | + |
| 71 | +The `spinup_comfystream_tensordock.py` script automates VM provisioning, setup, and server launch on [TensorDock](https://tensordock.com/). Follow the steps below: |
| 72 | + |
| 73 | +1. **Create a TensorDock Account**: Sign up at [Tensordock](https://dashboard.tensordock.com/register), add a payment method, and generate API credentials. |
| 74 | + |
| 75 | +2. **Set Up a Python Virtual Environment**: |
| 76 | + To prevent dependency conflicts, create and activate a virtual environment with [Conda](https://docs.anaconda.com/miniconda/) and install the required dependencies: |
| 77 | + |
| 78 | + ```bash |
| 79 | + conda create -n comfystream python=3.8 |
| 80 | + conda activate comfystream |
| 81 | + pip install -r requirements.txt |
| 82 | + ``` |
| 83 | + |
| 84 | +3. **View Available Script Options** *(Optional)*: |
| 85 | + To see all available options, run: |
23 | 86 |
|
24 | 87 | ```bash
|
25 | 88 | python spinup_comfystream_tensordock.py --help
|
26 | 89 | ```
|
27 | 90 |
|
28 | 91 | 4. **Run the Script**:
|
29 |
| - Execute the following command to spin up a ComfyStream instance: |
| 92 | + Execute the following command to provision a VM and set up ComfyStream automatically: |
30 | 93 |
|
31 | 94 | ```bash
|
32 | 95 | python spinup_comfystream_tensordock.py --api-key <API_KEY> --api-token <API_TOKEN>
|
33 | 96 | ```
|
34 | 97 |
|
35 | 98 | 5. **Access the Server**:
|
36 |
| - The script will set up the instance, install dependencies, and start the server. This process will take a few minutes. Once completed, you can access the ComfyStream server and UI using the provided URLs. |
| 99 | + Once the setup is complete, the script will display the URLs to access ComfyStream. |
37 | 100 |
|
38 |
| -6. **Stop the Server**: |
39 |
| - To stop the server, run: |
| 101 | +6. **Stop & Delete the VM** *(When No Longer Needed)*: |
| 102 | + To stop and remove the instance, run: |
40 | 103 |
|
41 | 104 | ```bash
|
42 | 105 | python spinup_comfystream_tensordock.py --delete <VM_ID>
|
43 | 106 | ```
|
44 | 107 |
|
45 |
| - Replace `<VM_ID>` with the ID of the VM you want to delete. You can find the VM ID in the script logs or the [Tensordock dashboard](https://dashboard.tensordock.com/). |
| 108 | + Replace `<VM_ID>` with the VM ID found in the script logs or the [TensorDock dashboard](https://dashboard.tensordock.com/instances). |
46 | 109 |
|
47 | 110 | > [!WARNING]
|
48 |
| -> If you see `max retries exceeded with url` errors, the VM was likely created but is inaccessible. Check the [TensorDock dashboard](https://dashboard.tensordock.com/instances), delete the VM, wait 2-3 minutes, then run the script again. |
| 111 | +> If you encounter `max retries exceeded with URL` errors, the VM might have been created but is inaccessible. |
| 112 | +> Check the [TensorDock dashboard](https://dashboard.tensordock.com/instances), delete the VM manually, wait **2-3 minutes**, then rerun the script. |
0 commit comments