[Unit]
Description=ComfyUI
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/ComfyUI
ExecStart=/usr/bin/python3 main.py --listen 0.0.0.0 --port 8188
Restart=always
RestartSec=10

# GPU device selection for ROCm
Environment=HIP_VISIBLE_DEVICES=0

# PATH must include ROCm binaries for rocminfo/rocm-smi calls from code
Environment=PATH=/opt/rocm/bin:/usr/local/bin:/usr/bin:/bin

# LD_LIBRARY_PATH must include torch's native .so directory so torchaudio
# and other extensions can find libtorch.so, libtorch_cpu.so etc.
Environment=LD_LIBRARY_PATH=/usr/local/lib/python3.12/dist-packages/torch/lib:/opt/rocm/lib

[Install]
WantedBy=multi-user.target
