Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.2 - fixes to restart behavior #18

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build API Docker Images

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker images
working-directory: ./docker
run: |
./build-api-images

- name: Push Docker images
working-directory: ./docker
run: |
./push-api-images

10 changes: 4 additions & 6 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ jobs:

- name: Get version from package.json
id: version
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"

- name: Get the PR that was merged into main
id: pr-output
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
info=$(gh pr list --state merged --limit 1 --json title --json body)
echo "title=$(echo $info | jq -r '.title')" >> $GITHUB_OUTPUT
echo "body=$(echo $info | jq -r '.body')" >> $GITHUB_OUTPUT
info=$(gh pr list --state merged --limit 1 --json title,body | jq -r '.[0]')
echo "title=$(echo $info | jq '.title')" >> "$GITHUB_OUTPUT"
echo "body=$(echo $info | jq '.body')" >> "$GITHUB_OUTPUT"

- name: Create a release
uses: actions/create-release@v1
Expand All @@ -62,5 +62,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.version.outputs.version }} ./bin/comfyui-api#Linux_x64


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you have your own ComfyUI dockerfile, you can add the comfyui-api server to i

```dockerfile
# Change this to the version you want to use
ARG api_version=1.7.1
ARG api_version=1.7.2


# Download the comfyui-api binary, and make it executable
Expand Down Expand Up @@ -388,7 +388,7 @@ The tag pattern is `saladtechnologies/comfyui:comfy<comfy-version>-api<api-versi

## Considerations for Running on SaladCloud

- **SaladCloud's Container Gateway has a 100s timeout.** It is possible to construct very long running workflows, such for video generation, with ComfyUI that would exceed this timeout. In this scenario, you will need to either use a webhook to receive the results, or integrate with SaladCloud's [Job Queues](https://docs.salad.com/products/sce/job-queues/job-queues#job-queues) to handle long-running workflows.
- **SaladCloud's Container Gateway has a 100s timeout.** It is possible to construct very long running ComfyUI workflows, such as for video generation, that would exceed this timeout. In this scenario, you will need to either use a webhook to receive the results, or integrate with SaladCloud's [Job Queues](https://docs.salad.com/products/sce/job-queues/job-queues#job-queues) to handle long-running workflows.
- **SaladCloud's maximum container image size is 35GB(compressed).** The base [comfyui-api image](https://hub.docker.com/r/saladtechnologies/comfyui/tags) is around 3.25GB(compressed), so any models and extensions must fit in the remaining space.

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docker/api.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM ghcr.io/saladtechnologies/comfyui-api:comfy${comfy_version}-torch${pytorch_
ENV WORKFLOW_DIR=/workflows
ENV STARTUP_CHECK_MAX_TRIES=30

ARG api_version=1.7.1
ARG api_version=1.7.2
ADD https://github.com/SaladTechnologies/comfyui-api/releases/download/${api_version}/comfyui-api .
RUN chmod +x comfyui-api

Expand Down
6 changes: 4 additions & 2 deletions docker/push-all → docker/push-api-images
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ api_version=${4:-$current_api_version}
bases=("runtime" "devel")

for base in "${bases[@]}"; do
docker push ghcr.io/saladtechnologies/comfyui-api:comfy$comfy_version-torch$torch_version-cuda$cuda_version-$base
docker push ghcr.io/saladtechnologies/comfyui-api:comfy$comfy_version-api$api_version-torch$torch_version-cuda$cuda_version-$base
done
done

docker tag ghcr.io/saladtechnologies/comfyui-api:comfy$comfy_version-api$api_version-torch$torch_version-cuda$cuda_version-runtime ghcr.io/saladtechnologies/comfyui-api:latest
docker push ghcr.io/saladtechnologies/comfyui-api:latest
16 changes: 16 additions & 0 deletions docker/push-comfy-base-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /usr/bin/bash

usage="Usage: $0 [comfy_version] [torch_version] [cuda_version]"

comfy_version=${1:-0.3.10}
torch_version=${2:-2.5.0}
cuda_version=${3:-12.1}

bases=("runtime" "devel")

for base in "${bases[@]}"; do
docker push ghcr.io/saladtechnologies/comfyui-api:comfy$comfy_version-torch$torch_version-cuda$cuda_version-$base
done

docker tag ghcr.io/saladtechnologies/comfyui-api:comfy$comfy_version-torch$torch_version-cuda$cuda_version-runtime ghcr.io/saladtechnologies/comfyui-api:base
docker push ghcr.io/saladtechnologies/comfyui-api:base
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "comfyui-api",
"version": "1.7.1",
"version": "1.7.2",
"description": "Wraps comfyui to make it easier to use as a stateless web service",
"main": "dist/src/index.js",
"scripts": {
Expand Down
12 changes: 9 additions & 3 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ export class CommandExecutor {

this.process.on("error", (err) => {
console.error(`Failed to start subprocess: ${err.message}`);
reject(err);
return reject(err);
});

this.process.on("exit", (code, signal) => {
console.log(`Process exited with code ${code}, signal ${signal}`);
this.process = null;
if (code !== null) {
resolve(code);
if (code === 0) {
console.log("Command executed successfully");
return resolve(code);
}
return reject(new Error(`Process exited with code ${code}`));
} else {
reject(new Error(`Process terminated due to signal: ${signal}`));
return reject(
new Error(`Process terminated due to signal: ${signal}`)
);
}
});
});
Expand Down
5 changes: 4 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ export async function waitForComfyUIToStart(

export async function warmupComfyUI(): Promise<void> {
if (config.warmupPrompt) {
await fetch(`http://localhost:${config.wrapperPort}/prompt`, {
const resp = await fetch(`http://localhost:${config.wrapperPort}/prompt`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ prompt: config.warmupPrompt }),
});
if (!resp.ok) {
throw new Error(`Failed to warmup Comfy UI: ${await resp.text()}`);
}
}
}

Expand Down
Loading