Skip to content

Commit 35cbe93

Browse files
committed
Merge branch 'feat/audio_support' of https://github.com/varshith15/comfystream into feat/audio_support
2 parents 8024530 + da75565 commit 35cbe93

14 files changed

+358
-222
lines changed

.devcontainer/Dockerfile

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
FROM livepeer/comfyui-base:latest
2-
ENV PATH="/miniconda3/bin:${PATH}"
1+
ARG BASE_IMAGE=livepeer/comfyui-base:latest
2+
FROM ${BASE_IMAGE}
3+
4+
RUN echo "Using base image: ${BASE_IMAGE}"
5+
6+
ENV PATH="/workspace/miniconda3/bin:${PATH}"
37
EXPOSE 8188
4-
EXPOSE 8888
8+
EXPOSE 8889
59
EXPOSE 3000
610
EXPOSE 1024-65535/udp
11+
RUN apt-get update && apt-get install -y supervisor
712

813
WORKDIR /
914

@@ -21,4 +26,13 @@ RUN bash -c "source $NVM_DIR/nvm.sh \
2126
# Add node and npm to path so the commands are available
2227
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
2328
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
24-
RUN conda init bash
29+
RUN conda init bash
30+
31+
# Create the supervisor configuration file for ComfyUI and ComfyStream
32+
RUN mkdir -p /etc/supervisor/conf.d
33+
COPY .devcontainer/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
34+
35+
WORKDIR /workspace/comfystream
36+
COPY docker/entrypoint.sh /workspace/comfystream/docker/entrypoint.sh
37+
RUN chmod +x /workspace/comfystream/docker/entrypoint.sh
38+
ENTRYPOINT ["/workspace/comfystream/docker/entrypoint.sh"]

.devcontainer/README.md

+53-41
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ docker build -f docker/Dockerfile.base -t livepeer/comfyui-base:latest .
4040
On your **host** system, create directories to store models and engines:
4141

4242
```sh
43-
mkdir -p ~/models/ComfyUI--models && mkdir -p ~/models/ComfyUI--output
43+
mkdir -p ~/models/ComfyUI--models ~/models/ComfyUI--output
4444
```
4545

4646
> [!NOTE]
@@ -65,22 +65,68 @@ Replace `/path/to/your/model-files` and `path/to/your/output-files` with the pat
6565
2. From VS Code, reload the folder as a devcontainer:
6666
- Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS).
6767
- Select `Remote-Containers: Reopen in Container`.
68+
3. Wait for the container to build and start.
6869

69-
### Download models
70+
### Starting ComfyUI
71+
72+
Start ComfyUI:
73+
74+
```sh
75+
cd /workspace/comfystream/ComfyUI
76+
conda activate comfyui
77+
python main.py --listen
78+
```
79+
80+
When using TensorRT engine enabled workflows, you should include the `---disable-cuda-malloc` flag as shown below:
81+
82+
```sh
83+
cd /workspace/comfystream/ComfyUI
84+
conda activate comfyui
85+
python main.py --listen --disable-cuda-malloc
86+
```
87+
88+
### Starting ComfyStream
89+
90+
Start ComfyStream:
91+
92+
```sh
93+
cd /workspace/comfystream
94+
conda activate comfystream
95+
python server/app.py --workspace /workspace/ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8889
96+
```
97+
98+
Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:
99+
100+
```sh
101+
cd /workspace/comfystream/ui
102+
npm run dev:https
103+
```
104+
105+
### Running Example Workflows
106+
107+
To run example workflows, you need to download models and build TensorRT engines. You can do this from within the dev container by running the following command in the terminal:
108+
109+
```sh
110+
prepare_examples
111+
```
112+
113+
Alternatively, you can follow the steps below.
114+
115+
#### Download models
70116

71117
From within the **dev container**, download models to run the example workflows:
72118

73119
```sh
74-
cd /comfystream
120+
cd /workspace/comfystream
75121
conda activate comfystream
76-
python src/comfystream/scripts/setup_models.py --workspace /ComfyUI
122+
python src/comfystream/scripts/setup_models.py --workspace /workspace/ComfyUI
77123
```
78124

79125
For more info about configuring model downloads, see [src/comfystream/scripts/README.md](../src/comfystream/scripts/README.md)
80126

81127
By following these steps, you should be able to set up and run your development container for ComfyStream efficiently.
82128

83-
### Building the DepthAnything Engine
129+
#### Building the DepthAnything Engine
84130

85131
After downloading models, it is necessary to compile TensorRT engines for the example workflow.
86132

@@ -90,8 +136,8 @@ After downloading models, it is necessary to compile TensorRT engines for the ex
90136
1. Run the **export_trt.py** script from the directory of the onnx file:
91137

92138
```sh
93-
cd /ComfyUI/models/tensorrt/depth-anything
94-
python /ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
139+
cd /workspace/ComfyUI/models/tensorrt/depth-anything
140+
python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
95141
```
96142

97143
## Debugging ComfyStream and ComfyUI
@@ -113,40 +159,6 @@ Alternatively, you may activate an environment manually with `conda activate com
113159

114160
> [!NOTE] For more information, see [Python environments in VS Code](https://code.visualstudio.com/docs/python/environments)
115161

116-
### Starting ComfyUI
117-
118-
Start ComfyUI:
119-
120-
```sh
121-
cd /comfystream/ComfyUI
122-
conda activate comfyui
123-
python main.py --listen
124-
```
125-
126-
When using TensorRT engine enabled workflows, you should include the `---disable-cuda-malloc` flag as shown below:
127-
128-
```sh
129-
cd /comfystream/ComfyUI
130-
conda activate comfyui
131-
python main.py --listen --disable-cuda-malloc
132-
```
133-
134-
### Starting ComfyStream
135-
136-
Start ComfyStream:
137-
138-
```sh
139-
cd /comfystream
140-
conda activate comfystream
141-
python server/app.py --workspace /ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8888
142-
```
143-
144-
Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:
145-
146-
```sh
147-
cd /comfystream/ui
148-
npm run dev:https
149-
```
150162

151163
## Additional Resources
152164

.devcontainer/devcontainer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"customizations": {
1515
"vscode": {
1616
"settings": {
17-
"python.defaultInterpreterPath": "/miniconda3/envs/comfystream/bin/python",
18-
"python.venvPath": "/miniconda3/envs",
17+
"python.defaultInterpreterPath": "/workspace/miniconda3/envs/comfystream/bin/python",
18+
"python.venvPath": "/workspace/miniconda3/envs",
1919
"python.terminal.activateEnvInCurrentTerminal": false,
2020
"python.terminal.activateEnvironment": true,
2121
"terminal.integrated.shellIntegration.enabled": true
@@ -30,18 +30,18 @@
3030
},
3131
"appPort": [
3232
"8188:8188", // ComfyUI
33-
"8888:8888", // ComfyStream
33+
"8889:8889", // ComfyStream
3434
"3000:3000" // ComfyStream UI (optional)
3535
],
36-
"forwardPorts": [8188, 8888, 3000],
36+
"forwardPorts": [8188, 8889, 3000],
3737
// Use 'forwardPorts' to make a list of ports inside the container available locally.
3838
// Use 'mounts' to make a list of local folders available inside the container.
39-
"workspaceFolder": "/comfystream",
40-
"workspaceMount": "source=${localWorkspaceFolder},target=/comfystream,type=bind",
39+
"workspaceFolder": "/workspace/comfystream",
40+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/comfystream,type=bind",
4141
"mounts": [
4242
// Use 'mounts' to map to comfyui models on the host
43-
"source=${localEnv:HOME}/models/ComfyUI--models,target=/ComfyUI/models,type=bind,consistency=cached",
44-
"source=${localEnv:HOME}/models/ComfyUI--output,target=/ComfyUI/output,type=bind,consistency=cached"
43+
"source=${localEnv:HOME}/models/ComfyUI--models,target=/workspace/ComfyUI/models,type=bind,consistency=cached",
44+
"source=${localEnv:HOME}/models/ComfyUI--output,target=/workspace/ComfyUI/output,type=bind,consistency=cached"
4545
],
4646
"postCreateCommand": ".devcontainer/post-create.sh"
4747
}

.devcontainer/post-create.sh

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
#!/bin/bash
2+
chmod +x /workspace/comfystream/docker/entrypoint.sh
3+
cd /workspace/comfystream
24

3-
# Install npm packages if needed
4-
cd /comfystream/ui
5-
if [ ! -d "node_modules" ]; then
6-
npm install --legacy-peer-deps
7-
fi
5+
echo 'alias prepare_examples="/workspace/comfystream/docker/entrypoint.sh --download-models --build-engines"' >> ~/.bashrc
6+
echo -e "\e[32mContainer ready! Run 'prepare_examples' to download models and build engines for example workflows.\e[0m"
87

9-
# Create a symlink to the ComfyUI workspace
10-
if [ ! -d "/comfystream/ComfyUI" ]; then
11-
ln -s /ComfyUI /comfystream/ComfyUI
12-
fi
13-
14-
cd /comfystream
15-
/bin/bash
8+
/bin/bash

.devcontainer/supervisord.conf

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[supervisord]
2+
nodaemon=true
3+
user=root
4+
logfile=/var/log/supervisord.log
5+
logfile_maxbytes=50MB
6+
logfile_backups=10
7+
loglevel=info
8+
pidfile=/var/run/supervisord.pid
9+
10+
[program:comfyui]
11+
command=bash -c "source /workspace/miniconda3/bin/activate comfyui && python main.py --listen --disable-cuda-malloc"
12+
directory=/workspace/ComfyUI
13+
autostart=true
14+
autorestart=true
15+
stderr_logfile=/dev/fd/1
16+
stdout_logfile=/dev/fd/1
17+
stderr_logfile_maxbytes=0
18+
stdout_logfile_maxbytes=0
19+
loglevel=debug
20+
21+
[program:comfystream]
22+
command=bash -c "source /workspace/miniconda3/bin/activate comfystream && python server/app.py --workspace=/workspace/ComfyUI --media-ports=5678 --host=0.0.0.0 --port=8889 --log-level=DEBUG"
23+
directory=/workspace/comfystream
24+
autostart=true
25+
autorestart=true
26+
stderr_logfile=/dev/fd/1
27+
stdout_logfile=/dev/fd/1
28+
stderr_logfile_maxbytes=0
29+
stdout_logfile_maxbytes=0
30+
loglevel=debug
31+
32+
[program:ui]
33+
command=npm run dev:https
34+
directory=/workspace/comfystream/ui
35+
autostart=true
36+
autorestart=true
37+
stderr_logfile=/dev/fd/1
38+
stdout_logfile=/dev/fd/1
39+
stderr_logfile_maxbytes=0
40+
stdout_logfile_maxbytes=0
41+
loglevel=debug

.vscode/launch.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "Run ComfyUI",
99
"type": "debugpy",
1010
"request": "launch",
11-
"cwd": "/ComfyUI",
11+
"cwd": "/workspace/ComfyUI",
1212
"program": "main.py",
1313
"purpose": ["debug-in-terminal"],
1414
"env": {
@@ -18,28 +18,28 @@
1818
"--listen",
1919
"--disable-cuda-malloc",
2020
],
21-
"python": "/miniconda3/envs/comfyui/bin/python"
21+
"python": "/workspace/miniconda3/envs/comfyui/bin/python"
2222
},
2323
{
2424
"name": "Run ComfyStream",
2525
"type": "debugpy",
2626
"request": "launch",
27-
"cwd": "/comfystream/server",
27+
"cwd": "/workspace/comfystream/server",
2828
"program": "app.py",
2929
"args": [
30-
"--workspace=/ComfyUI",
30+
"--workspace=/workspace/ComfyUI",
3131
"--media-ports=5678",
3232
"--host=0.0.0.0",
33-
"--port=8888",
33+
"--port=8889",
3434
"--log-level=DEBUG",
3535
],
36-
"python": "/miniconda3/envs/comfystream/bin/python"
36+
"python": "/workspace/miniconda3/envs/comfystream/bin/python"
3737
},
3838
{
3939
"name": "Run ComfyStream UI (Node.js)",
4040
"type": "node",
4141
"request": "launch",
42-
"cwd": "/comfystream/ui",
42+
"cwd": "/workspace/comfystream/ui",
4343
"console": "integratedTerminal",
4444
"runtimeExecutable": "npm",
4545
"runtimeArgs": [

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This repo also includes a WebRTC server and UI that uses comfystream to support
77
- [comfystream](#comfystream)
88
- [Quick Start](#quick-start)
99
- [Docker DevContainer](#docker-devcontainer)
10+
- [Docker Image](#docker-image)
1011
- [Download Models](#download-models)
1112
- [Install package](#install-package)
1213
- [Custom Nodes](#custom-nodes)
@@ -26,6 +27,16 @@ For other installation options, refer to [Install ComfyUI and ComfyStream](https
2627

2728
For additional information, refer to the remaining sections below.
2829

30+
### Docker Image
31+
32+
You can quickly deploy ComfyStream using the docker image `livepeer/comfystream`
33+
34+
Refer to the documentation at [https://pipelines.livepeer.org/docs/technical/getting-started/install-comfystream](https://pipelines.livepeer.org/docs/technical/getting-started/install-comfystream) for instructions to run locally or on a remote server.
35+
36+
#### RunPod
37+
38+
The RunPod template [livepeer-comfystream](https://runpod.io/console/deploy?template=w01m180vxx&ref=u8tlskew) can be used to deploy to RunPod.
39+
2940
## Download Models
3041

3142
Refer to [src/comfystream/scripts/README.md](src/comfystream/scripts/README.md) for instructions to download commonly used models.

configs/nodes.yaml

-10
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ nodes:
1919
dependencies:
2020
- "scikit-image"
2121

22-
comfyui-manager:
23-
name: "ComfyUI Manager"
24-
url: "https://github.com/ltdrdata/ComfyUI-Manager.git"
25-
type: "utility"
26-
2722
comfyui-misc-effects:
2823
name: "ComfyUI Misc Effects"
2924
url: "https://github.com/ryanontheinside/ComfyUI-Misc-Effects.git"
@@ -62,11 +57,6 @@ nodes:
6257
url: "https://github.com/rgthree/rgthree-comfy.git"
6358
type: "utility"
6459

65-
comfyui-kjnodes:
66-
name: "ComfyUI KJNodes"
67-
url: "https://github.com/kijai/ComfyUI-KJNodes.git"
68-
type: "utility"
69-
7060
comfyui-background-edit:
7161
name: "ComfyUI Background Edit"
7262
url: "https://github.com/yondonfu/ComfyUI-Background-Edit"

0 commit comments

Comments
 (0)