Documentation for socket activation
Also: move github actions out of the way to prevent involuntary execution.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
# Fork of comfy UI adding systemd socket activation support and a ROCM docker file
|
||||||
|
|
||||||
|
**The socket activation support is the result of vibe coding and not sufficiently validated tobe ready for general usage or contributing back upstream. Use at your own risk!**
|
||||||
|
|
||||||
|
Instructions for socket activation in [utils/socket_activation](utils/socket_activation/README.md).
|
||||||
|
Original readme starts below:
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
# ComfyUI
|
# ComfyUI
|
||||||
|
|||||||
40
utils/socket_activation/README.md
Normal file
40
utils/socket_activation/README.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Rootless podman container with Systemd Socket activation
|
||||||
|
|
||||||
|
## Idea
|
||||||
|
By passing in the socket from systemd we minimize resource use when not in use.
|
||||||
|
Since no other network access is required for operation, we can configure the container
|
||||||
|
with network=none and minimize the risk of the AI escaping.
|
||||||
|
|
||||||
|
## Set up
|
||||||
|
|
||||||
|
Optional, if you want to run this as a separate user
|
||||||
|
```
|
||||||
|
sudo useradd comfy
|
||||||
|
sudo machinectl shell comfy@
|
||||||
|
```
|
||||||
|
|
||||||
|
Check out this repository, navigate to its root directory and build the comfy
|
||||||
|
container with
|
||||||
|
```
|
||||||
|
podman build -t localhost/comfy:latest .
|
||||||
|
```
|
||||||
|
|
||||||
|
Place comfy.socket in ` ~/.config/systemd/user`, adjust ports and interfaces if needed.
|
||||||
|
Place comfy.container in `~/.config/containers/systemd`. Adjust paths for models and config if desired.
|
||||||
|
The files are in `utils/socket_activation`, next to this readme.
|
||||||
|
|
||||||
|
Put model files into the models directory (`~/models`).
|
||||||
|
|
||||||
|
Start the socket:
|
||||||
|
```
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user enable --now comfy.socket
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to run the service also when the user is not logged in, enable lingering:
|
||||||
|
```
|
||||||
|
sudo loginctl enable-linger <user>
|
||||||
|
```
|
||||||
|
|
||||||
|
Check that you can access comfy in browser. For troubleshooting, use, e. g., `journalctl -xe`.
|
||||||
|
|
||||||
24
utils/socket_activation/comfy.container
Normal file
24
utils/socket_activation/comfy.container
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Comfy ui in a ROCM container
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/comfy:latest
|
||||||
|
#AutoRemove=yes
|
||||||
|
#PublishPort=8080:8080
|
||||||
|
Environment=ROCR_VISIBLE_DEVICES="GGPU-3b0c81617337ec1b"
|
||||||
|
Network=none
|
||||||
|
Volume=%h/comfy/models:/comfyui/models:ro,z
|
||||||
|
Volume=%h/comfy/input:/comfyui/input:Z
|
||||||
|
Volume=%h/comfy/output:/comfyui/output:Z
|
||||||
|
Volume=%h/comfy/user:/comfyui/user:Z
|
||||||
|
AddDevice=/dev/dri
|
||||||
|
AddDevice=/dev/kfd
|
||||||
|
Exec=
|
||||||
|
|
||||||
|
#[Service]
|
||||||
|
#Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
8
utils/socket_activation/comfy.socket
Normal file
8
utils/socket_activation/comfy.socket
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=llama socket
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
ListenStream=0.0.0.0:8095
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
24
utils/socket_activation/comfy2.container
Normal file
24
utils/socket_activation/comfy2.container
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Comfy ui in a ROCM container
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/comfy:latest
|
||||||
|
#AutoRemove=yes
|
||||||
|
#PublishPort=8080:8080
|
||||||
|
Network=none
|
||||||
|
Environment=ROCR_VISIBLE_DEVICES="GPU-3ce290c173497dfb"
|
||||||
|
Volume=%h/comfy/models:/comfyui/models:ro,z
|
||||||
|
Volume=%h/comfy/input2:/comfyui/input:Z
|
||||||
|
Volume=%h/comfy/output2:/comfyui/output:Z
|
||||||
|
Volume=%h/comfy/user2:/comfyui/user:Z
|
||||||
|
AddDevice=/dev/dri
|
||||||
|
AddDevice=/dev/kfd
|
||||||
|
Exec=
|
||||||
|
|
||||||
|
#[Service]
|
||||||
|
#Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
8
utils/socket_activation/comfy2.socket
Normal file
8
utils/socket_activation/comfy2.socket
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Comfy second instance socket
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
ListenStream=0.0.0.0:8096
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
Reference in New Issue
Block a user