fix: restore ComfyUI as workflow frontend with BoosAPI backend integration

ComfyUI is kept as a visual workflow editor (node-based). All actual
generation goes through BoosAPI's own API via boosapi_comfy_nodes.py
custom nodes (now defaulting to localhost:4000/v1).

Architecture:
  BoosAPI (Node.js, port 4000)
    ├── /video-agent → iframe → ComfyUI (Python, port 8188, CPU)
    │                              └── custom_nodes/boosapi_comfy_nodes.py
    │                                   └── calls BoosAPI /v1/... API
    ├── /comfyui-agent → chat interface (direct API calls)
    └── /v1/... → API endpoints (LLM, image, TTS, video)

Signed-off-by: boos <boos@boos.lat>
This commit is contained in:
boos
2026-05-16 00:26:07 +08:00
parent bd06698c8e
commit 0f3ff82147
8 changed files with 453 additions and 14 deletions
+27 -3
View File
@@ -23,15 +23,17 @@ ARG NO_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_ENV=production
ENV COMFYUI_BASE=http://127.0.0.1:8188
ENV HTTP_PROXY=${HTTP_PROXY}
ENV HTTPS_PROXY=${HTTPS_PROXY}
ENV ALL_PROXY=${ALL_PROXY}
ENV NO_PROXY=${NO_PROXY}
# Install system deps: Node.js 22, supervisor
# Install system deps: Node.js 22, Python 3, supervisor
RUN echo 'Acquire::http::Proxy "false";' > /etc/apt/apt.conf.d/99no-proxy && apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates gnupg \
supervisor \
python3 python3-pip python3-venv \
supervisor git \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
@@ -40,6 +42,18 @@ RUN echo 'Acquire::http::Proxy "false";' > /etc/apt/apt.conf.d/99no-proxy && apt
COPY rtk /usr/local/bin/rtk
RUN chmod +x /usr/local/bin/rtk
# Set up ComfyUI (workflow editor frontend, calls BoosAPI API via custom nodes)
# CPU PyTorch is fine — all generation goes through BoosAPI's API
WORKDIR /app/comfy
RUN git clone https://github.com/comfyanonymous/ComfyUI.git . \
&& python3 -m venv venv \
&& . venv/bin/activate \
&& pip install --upgrade pip \
&& pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& grep -v kornia_rs requirements.txt | pip install -r /dev/stdin \
&& rm -rf ~/.cache/pip
ENV PATH="/app/comfy/venv/bin:${PATH}"
# Copy metapi (built)
WORKDIR /app/metapi
COPY --from=metapi-builder /app/dist ./dist
@@ -48,6 +62,9 @@ COPY --from=metapi-builder /app/package.json ./
COPY --from=metapi-builder /app/drizzle ./drizzle
RUN mkdir -p data
# Copy BoosAPI custom nodes for ComfyUI (call local BoosAPI API)
COPY --from=metapi-builder /app/boosapi_comfy_nodes.py /app/comfy/custom_nodes/boosapi_comfy_nodes.py
# Supervisor config
RUN mkdir -p /var/log/supervisor
COPY <<'SUPERVISOR' /etc/supervisor/conf.d/all.conf
@@ -64,8 +81,15 @@ autorestart=true
stdout_logfile=/var/log/supervisor/metapi.log
stderr_logfile=/var/log/supervisor/metapi.err
[program:comfyui]
command=python3 main.py --listen 0.0.0.0 --port 8188 --cpu
directory=/app/comfy
autorestart=true
startretries=3
stdout_logfile=/var/log/supervisor/comfyui.log
stderr_logfile=/var/log/supervisor/comfyui.err
SUPERVISOR
EXPOSE 4000
EXPOSE 4000 8188
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/all.conf"]