Deploy on Phala
Your proxy runs our published image inside an Intel TDX enclave on Phala Cloud. The enclave proves to our router exactly what code is running. It keeps your keys sealed away from everyone, including Phala and us.
The compose file#
The installer puts this file in ~/.local/share/sn46/compose.yml. You can also save it yourself as compose.yml:
services:
sn46-proxy:
image: ghcr.io/subnet46/sn46-proxy@sha256:daf8bbf6b7d705f21f3603214d5e184b1235913231838d1ea54cc0d808a8c6ac
restart: always
ports:
- '8443:8443'
volumes:
- /var/run/dstack.sock:/var/run/dstack.sock
environment:
- SN46_HOTKEY
- SN46_KEYS_DEEPINFRA
- SN46_KEYS_CHEAPERINFERENCE
- SN46_KEYS_SURPLUS
- SN46_KEYS_OPENSCALE
- SN46_KEYS_ENGY
- SN46_KEYS_REDPILLIt pins the current release image by digest:
ghcr.io/subnet46/sn46-proxy@sha256:daf8bbf6b7d705f21f3603214d5e184b1235913231838d1ea54cc0d808a8c6acEvery published digest is listed on GitHub. Use the published digest exactly: our control plane only accepts enclaves running a released image.
Your env file#
Write a private env file with your hotkey's ss58 address and your provider keys. Leave out the providers you don't use. For several keys from one provider, separate them with commas.
cat > proxy.env <<'ENV'
SN46_HOTKEY=<your hotkey ss58 address>
SN46_KEYS_DEEPINFRA=<key 1>,<key 2>
SN46_KEYS_SURPLUS=<your key>
ENV
chmod 600 proxy.envThese are the only variables the enclave accepts. Phala encrypts them to your enclave on deploy, so they never travel in the clear and are never sent anywhere else. The full list of providers and their variables is on the providers page.
Deploy#
npx [email protected] auth login
npx [email protected] deploy -n sn46-proxy -t tdx.small -c compose.yml -e proxy.env --waitThe proxy listens on port 8443 with its own TLS. Its public address is the CVM's -8443s passthrough address:
https://<app-id>-8443s.<gateway domain>npx [email protected] cvms get shows it. Note your CVM id and this proxy address: you need the address to register, and the CVM id for auto-update.
Keep a template for auto-update#
Auto-update fills in each new release's digest. Keep a copy of your compose file with the digest replaced by a placeholder:
sed 's/@sha256:[0-9a-f]*/@{{image_digest}}/' compose.yml > compose.template.ymlCheck the image yourself#
The proxy image is built reproducibly from the source: images/build.sh release <out dir> builds it, and images/check-release.sh compares two builds of one commit. Anyone can check that a digest comes from that source.
Next: register your proxy.