Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Write a WordPress post, create a corresponding asset with ComfyUI

WordPress user generates a post with SCF fields for specific data -fps, vertical resolution, horizontal resolution, positive prompt, negative prompt, pose example (image), style example (image). User clicks "Generate" button (see plugin) which send a POST to Python server Python server reads the post and sends the SCF field data to ComfyUI (via Comfy's API). Once the video is generated, the Python server can use a WordPress user account to upload it back to the WordPress server and update the original post. That way, there's no http wait or other PHP session configuration needed.

Putting Python in the middle solves many of the pain points that comes from trying to make WordPress → PHP → MCP → ComfyUI behave synchronously over long‑running GPU jobs.

Production‑grade, async, resilient, and easy to extend. WordPress (Post + SCF fields) ↓ REST API: /generate (fast, returns immediately) Python Orchestrator (FastAPI) ↓ Celery Task Queue (Redis or RabbitMQ) Celery Worker(s) ↓ ComfyUI API (GPU workflow) ComfyUI (Docker + GPU) ↓ Output file Celery Worker ↓ WordPress REST API (media upload + post update) WordPress (final video embedded)

PHP request timeouts, FastCGI limits, Nginx proxy buffering, and MCP’s synchronous nature all fight a single-app architecture.

How To

This is a lando project with WordPress, Maria DB, PHP A FastAPI orchestrator service running Python and Uvicorn Some ptyhon tests in orchestrator/tests directory Celery running in Python Redis for "vibes"

To Startup:

Install ComfyUI somewhere at :8188 and update .env and path directives Test LTX-2.3 in ComfyUI Install/configure lando in /opt/lando/lando Run /opt/lando/lando start Check services configuration - are services running Import the wordpress/backup.sql.gz using lando db-import backup.sql.gz command Run some of the tests Visit WordPress and configure your plugins / SCF fields. You can import from scf-fields.json file in the wordpress/ directory Log in to WordPress and create a post. Press the "Generate" button in WordPress post authoring to send to ComfyUI Validate

Other stuff to try

When the user clicks “Generate Video”: set status = pending send a REST request to your Python server:

Other notes about architecture

Zero PHP timeouts WordPress only sends a quick REST request.

Fully asynchronous Python handles long GPU jobs without blocking anything.

Easy to scale You can run multiple Python workers or multiple ComfyUI GPU nodes.

Easy debugging Python logs everything: workflow JSON ComfyUI responses WordPress upload responses

Easy to extend You can add: image generation audio generation text generation batch jobs cron-based regeneration

Starting and Stopping

lando start lando stop

First Time Build

lando rebuild -y

  1. Copy .env.example to .env (if one exists) and fill in your values:
    cp .env.example .env   # adjust WP_USERNAME, WP_DATABASE_PASSWORD, DB_NAME, etc.
  2. Create the data directories that WordPress and MariaDB will persist to:
    mkdir -p /opt/wp-comfy/wordpress /opt/wp-comfy/db-data

About

Create a post in WordPress and have it generate a ComfyUI asset

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages