All systems operational
Support
EN
Language

More languages are on the way.

ComfyUI on a rented GPU: a setup that survives reboots

A systemd unit, models on a persistent volume, a password in front of the UI and the RTX 4090 vs 5090 numbers for SDXL and FLUX.

CGCheapServ GPU teamWritten by 7 min read
An easel with a glowing image next to a GPU
On this page5
  1. Layout: models on the volume, app in a unit
  2. A systemd unit
  3. Access without exposing it
  4. What the cards do
  5. Operations

ComfyUI is the workflow tool most of our image-generation customers run, and the setups we see in support tickets share the same problems: the process dies when the SSH session closes, models are re-downloaded after every reinstall, and the UI is reachable by anyone who finds the port. This is a setup that fixes all three, plus the numbers we measured for SDXL and FLUX on the RTX 4090 and RTX 5090 plans.

Layout: models on the volume, app in a unit

Keep everything that is expensive to fetch on the persistent volume and everything that is cheap to rebuild in the app directory. On our GPU plans the volume is mounted at /data; on a reinstall the root disk is wiped and /data is not.

/opt/comfy/                # the app, a git checkout, disposable
/data/models/checkpoints/  # SDXL, FLUX and friends: 6 to 24 GB each
/data/models/loras/
/data/models/vae/
/data/output/              # generated images

Install from the ComfyUI template, or by hand on the Ubuntu 24.04 CUDA base:

apt install -y git python3-venv
git clone https://github.com/comfyanonymous/ComfyUI /opt/comfy
python3 -m venv /opt/comfy/venv && /opt/comfy/venv/bin/pip install -U pip
/opt/comfy/venv/bin/pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
/opt/comfy/venv/bin/pip install -r /opt/comfy/requirements.txt
git clone https://github.com/ltdrdata/ComfyUI-Manager /opt/comfy/custom_nodes/ComfyUI-Manager

Point ComfyUI at the volume with extra_model_paths.yaml so the app directory contains no models at all:

cat > /opt/comfy/extra_model_paths.yaml <<'EOF'
data:
  base_path: /data/models/
  checkpoints: checkpoints/
  loras: loras/
  vae: vae/
  clip: clip/
  unet: unet/
EOF

A systemd unit

useradd -r -m -d /opt/comfy -s /usr/sbin/nologin comfy && chown -R comfy /opt/comfy /data
cat > /etc/systemd/system/comfy.service <<'EOF'
[Unit]
Description=ComfyUI
After=network-online.target
[Service]
User=comfy
WorkingDirectory=/opt/comfy
ExecStart=/opt/comfy/venv/bin/python main.py --listen 127.0.0.1 --port 8188 --output-directory /data/output
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable --now comfy

Two things in the unit are deliberate: it listens on localhost only, and it runs as an unprivileged user. Custom nodes execute arbitrary Python; a compromised node in a root process owns the server.

Access without exposing it

Pick one of two doors. The private one is Tailscale (an add-on in the order form): install it, and reach http://server-name:8188 from any of your devices with no ports open at all; change --listen to the Tailscale address. The public one is Caddy with a password, which also gives you HTTPS:

apt install -y caddy
HASH=$(caddy hash-password --plaintext 'a-long-password')
cat > /etc/caddy/Caddyfile <<EOF
comfy.example.com {
  basicauth { me $HASH }
  reverse_proxy 127.0.0.1:8188
}
EOF
systemctl reload caddy

Never publish port 8188 directly. ComfyUI has no authentication, the API can read and write files, and scanners find open instances within hours.

What the cards do

Measured with the default workflows, 20 steps, Euler, batch size 1, after warm-up, on our plans:

ModelResolutionRTX 4090 (24 GB)RTX 5090 (32 GB)
SDXL 1.01024 × 10243.9 s2.3 s
SDXL + refiner1024 × 10245.6 s3.3 s
FLUX.1 dev, FP81024 × 102414 s8 s
FLUX.1 schnell, 4 steps1024 × 10241.9 s1.1 s
SDXL, batch 81024 × 102425 s15 s

The 5090 is roughly 1.7 times faster across the board, and its 32 GB is what makes FLUX dev comfortable with a LoRA and ControlNet loaded at once; the 4090 runs it but swaps models in and out. For pure SDXL throughput per dollar, the 4090 plan remains the better buy.

Operations

  • Updates: cd /opt/comfy && git pull && venv/bin/pip install -r requirements.txt && systemctl restart comfy. Take a panel snapshot first; custom nodes break on updates more often than ComfyUI itself.
  • Reinstalls: pick the template again, reattach the volume, restore extra_model_paths.yaml and the unit; the models never move.
  • Disk: /data/output grows fast at batch sizes above one. A weekly find /data/output -mtime +30 -delete in a timer keeps it honest, after you have copied what you want to keep.
  • Watch VRAM: nvidia-smi during a generation. A workflow that fits with 1 GB to spare will fail the day you add one more node; the netdata add-on graphs it over time.

Set up this way, a GPU server survives reboots, reinstalls and your own experiments, and the only thing you touch from month to month is the workflow.

CG
CheapServ GPU team

Benchmarks, images and templates for the GPU fleet.

Deploy your first server in under a minute.

Top up from $25 in BTC, ETH, XMR or USDT. Your balance never expires and unused funds are refundable.

Sign up now