diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34a9d26..e9ff3ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,13 +8,13 @@ on: jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-m if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }} permissions: contents: write # to be able to publish a GitHub release issues: write # to be able to comment on released issues pull-requests: write # to be able to comment on released pull requests - + steps: - name: Checkout uses: actions/checkout@v3 @@ -55,7 +55,7 @@ jobs: - name: Semantic release uses: codfish/semantic-release-action@v3 id: semanticrelease - with: + with: additional-packages: | ['@semantic-release/git', '@semantic-release/changelog'] env: @@ -69,7 +69,7 @@ jobs: tags: | ${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:${{ steps.semanticrelease.outputs.release-version }} ${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:latest - + - name: Update description on Docker Hub if: steps.semanticrelease.outputs.new-release-published == 'true' uses: peter-evans/dockerhub-description@v3 diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..31fd3ff --- /dev/null +++ b/.releaserc @@ -0,0 +1,24 @@ +{ + "branches": [ + "main" + ], + "tagFormat": "${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + [ + "@semantic-release/git", + { + "assets": ["README.md", "CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} \n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} diff --git a/README.md b/README.md index c1149d1..105771e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ 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) - --- @@ -18,23 +17,23 @@ Read our article here: https://blib.la/blog/comfyui-on-runpod - [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 `` with your key - Replace `` 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 " https://api.runpod.ai/v2/ 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