* Refactor post_prompt function to include prompt_id handling - Updated the post_prompt function in custom_routes.py to retrieve and validate a prompt_id from the incoming JSON data, defaulting to a new UUID if not provided. - Adjusted the validation call to use prompt_id alongside the prompt, ensuring proper identification and processing of prompts. These changes enhance the functionality of prompt handling within the application. * Refactor post_prompt and send_prompt functions for async handling - Updated the post_prompt function to be asynchronous, allowing for non-blocking execution when validating prompts. - Adjusted calls to post_prompt in send_prompt and comfy_deploy_run to await the asynchronous execution, ensuring proper handling of prompt submissions. - Commented out unused prompt construction code to streamline the function. These changes enhance the performance and responsiveness of prompt handling in the application. * Refactor handle_execute to support asynchronous execution - Updated the swizzle_execute function to be asynchronous, allowing for non-blocking execution of the origin_execute function. - Added missing parameters for pending_async_nodes in the swizzle_execute function call. - Ensured that the result from origin_execute is awaited, improving the handling of asynchronous operations. These changes enhance the performance and responsiveness of the execution handling in the application. * Enhance error handling in post_prompt and origin_execute functions - Added try-except blocks in post_prompt to handle TypeErrors during prompt validation, allowing for fallback to an older signature. - Implemented similar error handling in the origin_execute function to manage potential TypeErrors, ensuring robust execution flow. - Improved logging to capture issues with function signatures, aiding in debugging. These changes improve the resilience of the application when dealing with prompt and execution validation. * Refactor post_prompt and origin_execute for synchronous handling - Modified the post_prompt function to call validate_prompt synchronously when a TypeError occurs, improving error handling. - Updated the origin_execute function to execute synchronously, ensuring consistent behavior during execution. These changes enhance the robustness of prompt validation and execution processes in the application. * tweak: optional * Refactor swizzle_execute for async and sync handling - Enhanced the swizzle_execute function to differentiate between asynchronous and synchronous execution paths based on the origin_execute function's nature. - Improved the structure of the swizzle_execute function to ensure proper handling of parameters and execution flow for both async and sync scenarios. - Maintained existing error handling while ensuring consistent behavior across execution types. These changes improve the flexibility and robustness of the execution handling in the application.
ComfyUI Deploy
Open source comfyui deployment platform, a vercel for generative workflow infra. (serverless hosted gpu with vertical intergation with comfyui)
Note
Im looking for creative hacker to join ComfyDeploy's core team! DM me on twitter
Join Discord to chat more or visit Comfy Deploy to get started!
Check out our latest nextjs starter kit with Comfy Deploy
- Comfy Deploy Dashboard (https://comfydeploy.com) or self-hosted version
- Machines (Long running, on-premise ComfyUI machines and serverless)
- Supports runpods, modal, and hosted ComfyDeploy machines (powered by modal)
https://github.com/BennyKok/comfyui-deploy/assets/18395202/85f85325-a4bb-446d-aa67-ed225ee03479
Setting up a basic sd txt2img API
https://github.com/BennyKok/comfyui-deploy/assets/18395202/0fb1829b-401a-41f2-b21a-5b77483c6ee2
Comfy Deploy Plugin Installation
Plugin lets you set up the machine as a target machine, and also upload workflow directly from there
cd custom_nodesgit clone https://github.com/BennyKok/comfyui-deploy.git- Go to (https://comfydeploy.com) or a self-hosted version
- Machines -> Add Machines
- Enter a name and the URL of your machines (set up Ngrok for a public URL for your machines)
- Create a new ComfyDeploy machines (pick any custom nodes).
- Machines -> Add Machines
Usecase
- Deploy a complicated comfy workflow with a versioning system
- Manage versioning and easily preview different generated versions' output
- Persistent API generated for Production and Staging environment
- Run the same comfyui workflow across different remote machines
WIP, welcomes contributors!! Please join Discord -> https://discord.gg/EEYcQmdYZw
Primary goal -> release v0.1.0 of stable Comfy Deploy
Major areas
- Security enforcement
- Error handling
- QOL workflow improvement
- API usage examples
- Load balancing
- Workflow dependencies checking (custom nodes)
- Remote machines
- Serverless machines? Possible to set up a clean environment via Salad, Modal, etc
- LCM realtime web socket image gen
Tech Stack
-
Shadcn UI
-
NextJS
-
Clerk (Auth)
-
Neon / Vercel Postgres (Database)
-
Drizzle (ORM)
-
R2 / S3 (Object Storage)
Development
git clone https://github.com/BennyKok/comfyui-deploycd webbun i- Start docker
cp .env.example .env.local- Replace
JWT_SECRETwithopenssl rand -hex 32 - Get a local clerk dev key for
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEY - Keep a terminal live for
bun run db-dev - Execute the local migration to create the initial data
bun run migrate-local - Finally start the next server with
bun dev
Schema Changes
bun run generatebun run migrate-local
Special Thanks
- comfyui
- oss/acc
Self Hosting with Vercel
Build command
next build && bun run migrate-production
Install command
npx bun@1.0.16 install
Env key setup
POSTGRES_URL=
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
SPACES_ENDPOINT="http://localhost:4566"
SPACES_ENDPOINT_CDN="http://localhost:4566"
SPACES_BUCKET="comfyui-deploy"
SPACES_KEY="xyz"
SPACES_SECRET="aaa"
# generate using -> openssl rand -hex 32
JWT_SECRET=
# r2 settings
SPACES_REGION="auto"
SPACES_CDN_FORCE_PATH_STYLE="true"
SPACES_CDN_DONT_INCLUDE_BUCKET="true"
# digital ocean settings
SPACES_REGION="nyc3"
SPACES_CDN_FORCE_PATH_STYLE="false"
# s3 settings
SPACES_REGION="nyc3"
SPACES_CDN_DONT_INCLUDE_BUCKET="false"
SPACES_CDN_FORCE_PATH_STYLE="true"