Remote GPU workers
Run the API on one machine and the GPU worker on another.
Use this layout when the machine that runs the studio has no GPU, or when the GPU sits on another machine.
- The API host runs the API and PostgreSQL with the
apiprofile. It has no local worker. - The GPU host runs only the worker container. The worker opens a WebSocket to
/api/v1/fleeton the API host, and it takes jobs from there.
For image jobs, the worker also talks to the API over HTTP. It uploads results and fetches source images, using the address in INTERNAL_URL. The worker and the API must be able to reach each other at the addresses that the two settings name. SSH is not part of this setup.
Secrets
These are the secrets in this setup. Their values never appear in this guide, so copy them from the files named here.
FLEET_SECRET: indeploy/compose/.envon the API host. Preflight creates it. The worker needs the same value.FLEET_TOKEN: inworker.envon the GPU host. It holds a copy ofFLEET_SECRET.ROOT_KEYS: the root key ring for accounts, in the API host'sdeploy/compose/.env. This setup does not need it. See Accounts.
Set up the API host
Configure an HTTPS reverse proxy in front of the API before you use this setup. See TLS and HSTS.
Install the API and the database, without a local worker. Replace
studio.example.comwith your own HTTPS origin:curl -fsSL https://github.com/Portocolom-Studio/potocolom/releases/latest/download/install.sh | POTOCOLOM_PROFILE=api POTOCOLOM_PUBLIC_URL=https://studio.example.com bashIn
deploy/compose/.envon the API host, setINTERNAL_URLto the same HTTPS origin:INTERNAL_URL=https://studio.example.comApply the change from the install directory:
env -u INTERNAL_URL docker compose --env-file deploy/compose/.env -f deploy/compose/compose.yml --profile api up -d --no-buildPUBLIC_URLandINTERNAL_URLmust both use addresses that the remote worker can reach. The defaultINTERNAL_URL,http://api:8080, works only on the local Compose network.The installer prints a one-use setup link. Spend it in a browser on the API host before you use the studio. The fleet socket answers before setup, so a worker can report its hardware while the install is still unclaimed.
If you choose no accounts, keep the install on a trusted network. Anyone who can reach that API has full access. See First run and Accounts.
Set up the GPU host
Create a private
worker.envfile. Set its mode to0600withchmod 600 worker.env:DEVICE=cuda API_URL=wss://studio.example.com/api/v1/fleet FLEET_TOKEN=<copy FLEET_SECRET from the API host> MODELS_DIR=/models VRAM_RESERVE_MB=1536Replace
<copy FLEET_SECRET from the API host>with the value ofFLEET_SECRETfrom the API host'sdeploy/compose/.env. Replacestudio.example.comwith the same HTTPS origin you used on the API host.Start the NVIDIA worker. Replace
vX.Y.Zwith the release tag that the API host runs:docker run -d --name potocolom-worker --restart unless-stopped \ --gpus all --env-file ./worker.env \ -v potocolom-models:/models \ -v potocolom-hf-cache:/root/.cache/huggingface \ ghcr.io/portocolom-studio/potocolom-worker:vX.Y.Z-cudaFor an AMD card, set
DEVICE=rocminworker.env, use thevX.Y.Z-rocmimage, and replace--gpus allwith--device /dev/kfd --device /dev/dri --group-add video.Use the same driver checks and VRAM reserve as for a local worker. See GPU passthrough.
Test the worker. Run one generation and one image-to-image job. The image-to-image job checks both the image upload and the source fetch.
Upgrade order
Upgrade the API host first, then the worker. The worker protocol promises that the API is at the same version as its workers or newer. See Updating.
Failure modes
- The worker connects, but image jobs fail. A successful fleet WebSocket connection does not prove that image jobs work. Check
INTERNAL_URLfirst, because its default works only on the local Compose network. Set it as in step 3 above, then run the image-to-image test again. - The API refuses fleet connections, or it does not start. The API host has an empty
FLEET_SECRET. An unsetFLEET_TOKEN_KEYrefuses every fleet handshake, and the API refuses to start. The error namesscripts/preflight.sh. Runscripts/preflight.shon the API host to fill the empty value, restart the API, then copy the newFLEET_SECRETintoworker.envon the GPU host.