mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 01:37:04 +08:00
- Add comprehensive RunPod deployment guide - Document environment variable setup in RunPod template UI - Explain differences between local and RunPod configurations - Include security notes and verification steps
2.4 KiB
2.4 KiB
RunPod Deployment Configuration
This document describes how to configure environment variables for ComfyUI when deploying to RunPod Serverless.
Environment Variables Setup
Required: Google API Key for Nano Banana
- Go to RunPod Console
- Navigate to Templates → Select your ComfyUI template → Edit
- Scroll to Environment Variables section
- Add the following variable:
- Key:
GOOGLE_API_KEY - Value: Your Google AI API key (get one from Google AI Studio)
- Key:
Optional: Vertex AI Configuration
If you prefer to use Vertex AI instead of the Google AI API:
- Key:
PROJECT_ID - Value: Your GCP project ID
- Key:
LOCATION - Value:
us-central1(or your preferred region)
Note: Vertex AI requires Application Default Credentials (ADC) to be configured in your container image.
Optional: OpenTelemetry Configuration
For observability and monitoring:
- Key:
OTEL_EXPORTER_OTLP_ENDPOINT - Value:
http://your-otel-collector:4317 - Key:
OTEL_SERVICE_NAME - Value:
comfyui - Key:
OTEL_RESOURCE_ATTRIBUTES - Value:
service.name=comfyui
How It Works
The ComfyUI Docker image is configured to read environment variables directly from os.environ, which means:
- Local Development: Variables are loaded from
.envfile viadocker-compose.yml - RunPod Deployment: Variables are set in the RunPod template interface
- Code Compatibility: No code changes needed—both methods use
os.environ
Verification
After setting the environment variables in RunPod:
- Deploy or restart your serverless endpoint
- Check the logs for "GOOGLE_API_KEY" to verify it's set
- Test Nano Banana nodes to confirm authentication works
Differences from Local Setup
| Aspect | Local (Docker Compose) | RunPod Serverless |
|---|---|---|
| Config Method | .env file |
RunPod template UI |
| GPU Support | Optional (can run CPU mode) | Typically GPU-enabled |
| Persistence | Docker volumes | RunPod storage |
| API Key Storage | Local .env (gitignored) |
RunPod environment vars |
Security Notes
- Environment variables in RunPod are encrypted at rest
- Never commit
.envfiles with real API keys to Git - Rotate your API keys periodically
- Use different API keys for development vs production if possible