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

feat/restore-snapshot #30

Merged
merged 32 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
69848e5
feat: provide option to run the handler locally as API
TimPietrusky Feb 11, 2024
e3de2fa
ci: run the workflow on our extended instance
TimPietrusky Feb 11, 2024
fb17089
feat: the local API should run on 0.0.0.0
TimPietrusky Feb 11, 2024
e748931
feat: make the image smaller
TimPietrusky Feb 11, 2024
8f5a379
ci: use semantic-version to create releases automatically
TimPietrusky Feb 12, 2024
f66b2ca
chore: we don't want to break anyone with a minor release
TimPietrusky Feb 12, 2024
b6972f3
docs: added section for local API testing
TimPietrusky Feb 12, 2024
fea12e8
ci: use custom runner
TimPietrusky Feb 12, 2024
d603c91
fix: added .releaserc, otherwise semantic-release will complain about…
TimPietrusky Feb 12, 2024
f11dbef
Merge branch 'main' into dev
TimPietrusky Feb 12, 2024
e4276de
feat: support network volumes, skip default models (#16)
Meptl Feb 20, 2024
201f64e
feat: provide access to ComfyUI via web
TimPietrusky Mar 19, 2024
4b48ef0
fix: use the full path to the output image
TimPietrusky Mar 19, 2024
18c510c
feat: added env vars COMFY_POLLING_INTERVAL_MS and COMFY_POLLING_MAX_…
TimPietrusky Mar 19, 2024
5435d6c
test: added "subfolder"
TimPietrusky Mar 19, 2024
c7747ce
Implement optional restoring of ComfyUI snapshots
kklemon Apr 1, 2024
6d67d7e
feat: use comfy-cli to install ComfyUI & restore snapshot
TimPietrusky Nov 16, 2024
926a6a1
fix: install all dependencies from the snapshot
TimPietrusky Nov 17, 2024
c949e94
chore: moved example snapshot to test_resources
TimPietrusky Nov 17, 2024
6a83143
feat: allow any kind of snapshot file
TimPietrusky Nov 17, 2024
9926f75
feat: allow any file that has "snapshot" in its name
TimPietrusky Nov 17, 2024
7607a43
ci: added test for "restore-snapshot"
TimPietrusky Nov 17, 2024
a6b0c6b
Merge branch 'main' into feat/snapshot-restoring
TimPietrusky Nov 17, 2024
07c5a8c
ci: run restore snapshat test automatically
TimPietrusky Nov 17, 2024
4e3e76d
docs: use "snapshots" to bake custom nodes into the docker image
TimPietrusky Nov 17, 2024
3f2daef
docs: add link to ComfyUI Manager docs on how to export snapshots
TimPietrusky Nov 17, 2024
7ed6c19
ci: use correct path to example_snapshot.json
TimPietrusky Nov 18, 2024
0b2bcd1
ci: fix the path
TimPietrusky Nov 18, 2024
cf24d23
ci: fix the file path
TimPietrusky Nov 18, 2024
0393d84
ci: use a mock instead of the actual file
TimPietrusky Nov 18, 2024
473f4f3
ci: fix the path
TimPietrusky Nov 18, 2024
f3929cb
chore: don't ignore snapshot.json as people might use this
TimPietrusky Nov 18, 2024
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
Prev Previous commit
Next Next commit
docs: added section for local API testing
TimPietrusky committed Feb 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b6972f3ee200f019945962bba9836d6268c9fa14
52 changes: 29 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,31 +10,30 @@ Read our article here: https://blib.la/blog/comfyui-on-runpod

[![Discord](https://img.shields.io/discord/1091306623819059300?color=7289da&label=Discord&logo=discord&logoColor=fff&style=for-the-badge)](https://discord.com/invite/m3TBB9XEkb)


---

<!-- toc -->

- [Quickstart](#quickstart)
- [Features](#features)
- [Config](#config)
* [Upload image to AWS S3](#upload-image-to-aws-s3)
- [Upload image to AWS S3](#upload-image-to-aws-s3)
- [Use the Docker image on RunPod](#use-the-docker-image-on-runpod)
- [API specification](#api-specification)
* [JSON Request Body](#json-request-body)
* [Fields](#fields)
+ ["input.images"](#inputimages)
- [JSON Request Body](#json-request-body)
- [Fields](#fields)
- ["input.images"](#inputimages)
- [Interact with your RunPod API](#interact-with-your-runpod-api)
* [Health status](#health-status)
* [Generate an image](#generate-an-image)
+ [Example request with cURL](#example-request-with-curl)
- [Health status](#health-status)
- [Generate an image](#generate-an-image)
- [Example request with cURL](#example-request-with-curl)
- [How to get the workflow from ComfyUI?](#how-to-get-the-workflow-from-comfyui)
- [Build the image](#build-the-image)
- [Local testing](#local-testing)
* [Setup](#setup)
+ [Setup for Windows](#setup-for-windows)
* [Test: handler](#test-handler)
* [Test: docker image](#test-docker-image)
- [Setup](#setup)
- [Setup for Windows](#setup-for-windows)
- [Test: handler](#test-handler)
- [Test: docker image](#test-docker-image)
- [Automatically deploy to Docker hub with Github Actions](#automatically-deploy-to-docker-hub-with-github-actions)
- [Acknowledgments](#acknowledgments)

@@ -112,7 +111,7 @@ This is only needed if you want to upload the generated picture to AWS S3. If yo

## API specification

The following describes which fields exist when doing requests to the API. We only describe the fields that are sent via `input` as those are needed by the worker itself. For a full list of fields, please take a look at the [official documentation](https://docs.runpod.io/docs/serverless-usage).
The following describes which fields exist when doing requests to the API. We only describe the fields that are sent via `input` as those are needed by the worker itself. For a full list of fields, please take a look at the [official documentation](https://docs.runpod.io/docs/serverless-usage).

### JSON Request Body

@@ -138,10 +137,9 @@ The following describes which fields exist when doing requests to the API. We on
| `input.workflow` | Object | Yes | Contains the ComfyUI workflow configuration. |
| `input.images` | Array | No | An array of images. Each image will be added into the "input"-folder of ComfyUI and can then be used in the workflow by using it's `name` |


#### "input.images"

An array of images, where each image should have a different name.
An array of images, where each image should have a different name.

🚨 The request body for a RunPod endpoint is 10 MB for `/run` and 20 MB for `/runsync`, so make sure that your input images are not super huge as this will be blocked by RunPod otherwise, see the [official documentation](https://docs.runpod.io/docs/serverless-endpoint-urls)

@@ -150,8 +148,6 @@ An array of images, where each image should have a different name.
| `name` | String | Yes | The name of the image. Please use the same name in your workflow to reference the image. |
| `image` | String | Yes | A base64 encoded string of the image. |



## Interact with your RunPod API

- In the [User Settings](https://www.runpod.io/console/serverless/user/settings) click on `API Keys` and then on the `API Key` button
@@ -160,8 +156,6 @@ An array of images, where each image should have a different name.
- Replace `<api_key>` with your key
- Replace `<endpoint_id>` with the ID of the endpoint, you find that when you click on your endpoint, it's part of the URLs shown at the bottom of the first box



### Health status

```bash
@@ -172,7 +166,7 @@ curl -H "Authorization: Bearer <api_key>" https://api.runpod.ai/v2/<endpoint_id>

You can either create a new job async by using `/run` or a sync by using runsync. The example here is using a sync job and waits until the response is delivered.

The API expects a [JSON in this form](#json-request-body), where `workflow` is the [workflow from ComfyUI, exported as JSON](#how-to-get-the-workflow-from-comfyui) and `images` is optional.
The API expects a [JSON in this form](#json-request-body), where `workflow` is the [workflow from ComfyUI, exported as JSON](#how-to-get-the-workflow-from-comfyui) and `images` is optional.

Please also take a look at the [test_input.json](./test_input.json) to see how the API input should look like.

@@ -244,9 +238,22 @@ To run the Docker image on Windows, we need to have WSL2 and a Linux distro (lik
You can also start the handler itself to have the local server running: `python src/rp_handler.py`
To get this to work you will also need to start "ComfyUI", otherwise the handler will not work.

### Test: docker image
### Local API

For enhanced local development, you can start an API server that simulates the RunPod worker environment. This feature is particularly useful for debugging and testing your integrations locally.

- If you want to run the Docker container, you can use: `docker-compose up`
#### Starting local endpoint

Set the `SERVE_API_LOCALLY` environment variable to `true` to activate the local API server when running your Docker container. This is already the default value in the `docker-compose.yml`, so you can get it runnig by executing:

```bash
docker-compose up
```

#### Accessing the API

- With the local API server running, it's accessible at: [http://localhost:8000](http://localhost:8000)
- When you open this in your browser, you can also see the API documentation and can interact with the API directly

## Automatically deploy to Docker hub with Github Actions

@@ -264,7 +271,6 @@ If you want to use this, you should add these secrets to your repository:
| `DOCKERHUB_REPO` | The repository on Docker Hub where the image will be pushed. | `timpietruskyblibla` |
| `DOCKERHUB_IMG` | The name of the image to be pushed to Docker Hub. | `runpod-worker-comfy` |


## Acknowledgments

- Thanks to [all contributors](https://github.com/blib-la/runpod-worker-comfy/graphs/contributors) for your awesome work