Auto-update
sn46-miner autoupdate keeps your proxy on the current release. It checks for new releases signed by the SN46 fleet root every 5 minutes. When one is due, it updates your CVM in place to the new image, and your keys stay sealed in the enclave.
The 48-hour grace window#
After each release, the previous version keeps working for 48 hours, so you never drop out mid-update. After that window, only the new release is accepted: a proxy that hasn't updated stops getting traffic.
Set it up#
You need three things. First, your compose template, with the digest replaced by a placeholder:
sed 's/@sha256:[0-9a-f]*/@{{image_digest}}/' compose.yml > compose.template.ymlSecond, your CVM id, from npx [email protected] cvms get. Third, the Phala CLI installed and logged in on the machine that runs autoupdate:
npm install -g [email protected]
phala auth loginTry one round by hand first:
sn46-miner autoupdate --cvm <cvm id> --compose compose.template.yml \
--state ~/.sn46-miner/autoupdate.state --phala "$(command -v phala)" --onceRun it as a service#
Run autoupdate on any always-on machine. With systemd, as your own user, save this as ~/.config/systemd/user/sn46-autoupdate.service, with your CVM id, your template's path and the path from command -v phala:
[Unit]
Description=SN46 miner proxy auto-update
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=%h/.local/bin/sn46-miner autoupdate --cvm <cvm id> --compose %h/sn46/compose.template.yml --state %h/.sn46-miner/autoupdate.state --phala <path to phala>
Restart=always
RestartSec=60
[Install]
WantedBy=default.targetThen start it, and keep it running after you log out:
mkdir -p ~/.sn46-miner
systemctl --user daemon-reload
systemctl --user enable --now sn46-autoupdate
loginctl enable-linger "$USER"
journalctl --user -u sn46-autoupdate -f--every <secs> changes how often it checks (300 by default). A cron job running autoupdate --once works too.