This repository has been archived on 2025-02-24. You can view files and clone it, but cannot push or open issues or pull requests.
docs-legacy/src/cloud/cli.md

7.0 KiB

DeTEE CLI

For obvious reasons, the CLI is the first end-user app developed as part of our product.

Installation

The DeTEE CLI is available as a container image. In order to use it, first make sure you install docker.

After that, download and run the DeTEE CLI docker image:

mkdir -p ~/.detee/container_volume/cli
mkdir -p ~/.detee/container_volume/.ssh
docker run --pull always -dt --name detee-cli \
    --volume ~/.detee/container_volume/cli:/root/.detee/cli:rw \
    --volume ~/.detee/container_volume/.ssh:/root/.ssh:rw \
    --entrypoint /usr/bin/fish detee/detee-cli:latest
docker run -it --name detee-cli --entrypoint /usr/bin/fish $IMAGE_NAME
docker exec -it detee-cli fish

DeTEE CLI features completion for bash, zsh and fish and you are heavily encouraged to use completion. You can also enable extra logs by adding the environment variable LOG_LEVEL=INFO or LOG_LEVEL=DEBUG

Configure accounts

Inside the container, configure the accounts for your session:

ssh-keygen
# Hit enter a few times.
detee-cli account ssh-pubkey-path /root/.ssh/id_ed25519.pub
detee-cli account brain-url http://164.92.249.180:31337

Also, get your public key:

root@e55218c23c44 /# detee-cli account
Config path: /root/.detee/cli/cli-config.yaml
The brain URL is: http://164.92.249.180:31337
SSH Key Path: /root/.ssh/id_ed25519.pub
Wallet public key: 45Pyv9hRfub43NyRrYv95MhZs1Wrm8sj3RhBvA3F1Bvr
Account Balance: 19.9796 LP available, 0 LP locked
Wallet secret key path: /root/.detee/cli/secret_detee_wallet_key

And send the wallet address to us on Discord so that we can give you your airdrop.

Assuming you have mounted the volumes, your secrets are saved to ~/.detee/container_volume/.

Deploy a VM

To see options for deploying a VM, just write detee-cli vm deploy -- and hit TAB. Autocompletion will show available options:

~ $ detee-cli vm deploy --
--country             (deploy to a specific Country)
--disk                             (disk size in GB)
--distro                    (GNU/Linux distribution)
--from-yaml    (allows extended config through yaml)
--help         (Print help (see more with '--help'))
--hostname               (hostname of you VM and OS)
--hours       (for how many hours should the VM run)
--memory                              (memory in MB)
--price      (price per unit per minute; check docs)
--public-ip  (get a public IPv4 address for this VM)
--vcpus                        (the number of vCPUs)

Deploying a VM looks like this:

~ $ detee-cli vm deploy --distro ubuntu --vcpus 4 --memory 4096 --disk 20 --hours 4
No hostname specified! Using random VM name: luminous-soap
Node price: 0.00002/unit/minute. Total Units for hardware requested: 216. Locking 1.0368 LP (offering the VM for 4 hours).
Injecting disk encryption key into VM. This will take a minute. Do not interrupt.
VM CREATED! To ssh, run the following command:
    ssh -p 44367 root@173.234.17.2

In the background, the CLI will perform an attestation of the SNP server and also download the public SSH keys of the servers during the attestation. SSH will just work.

Now you can list VMs to get information:


~ $ detee-cli vm list
╭────────┬──────────────────────────────────────┬───────────────┬───────┬──────────┬──────┬────────┬───────────╮
│ City   │ UUID                                 │ hostname      │ Cores │ Mem (MB) │ Disk │ LP/h   │ time left │
├────────┼──────────────────────────────────────┼───────────────┼───────┼──────────┼──────┼────────┼───────────┤
│ London │ d51de633-640f-4b19-b372-b4197b321c8d │ luminous-soap │ 4     │ 4096     │ 20   │ 0.2592 │ 3h 59m    │
╰────────┴──────────────────────────────────────┴───────────────┴───────┴──────────┴──────┴────────┴───────────╯

In case you forgot SSH details for your VM, just use the SSH wrapper:

~ $ detee-cli vm ssh d51de633-640f-4b19-b372-b4197b321c8d
Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.12.10-arch1-1 x86_64)
root@luminous-soap:~#

Update or delete VM

The update command will allow you to modify the hardware specification and also the number of hours that you want your VM to run. If both hardware and time are modified, the hardware modification is executed first and the LP are recalculated after that.

~ $ detee-cli vm update --vcpus 2 --memory 2000 --hours 10 d51de633-640f-4b19-b372-b4197b321c8d
The node accepted the hardware modifications for the VM.
Injecting disk encryption key into VM. This will take a minute. Do not interrupt.
The VM will run for another 10 hours.
~ $ detee-cli vm list
╭────────┬──────────────────────────────────────┬───────────────┬───────┬──────────┬──────┬────────┬───────────╮
│ City   │ UUID                                 │ hostname      │ Cores │ Mem (MB) │ Disk │ LP/h   │ time left │
├────────┼──────────────────────────────────────┼───────────────┼───────┼──────────┼──────┼────────┼───────────┤
│ London │ d51de633-640f-4b19-b372-b4197b321c8d │ luminous-soap │ 2     │ 2000     │ 20   │ 0.1344 │ 10h 0m    │
╰────────┴──────────────────────────────────────┴───────────────┴───────┴──────────┴──────┴────────┴───────────╯
~ $

Please note that changing the number of CPUs or the kernel will rotate the hot decryption key of the server. This is why after these updates the CLI will use the backup key to start the VM.

Deletion works as expected:

~ $ detee-cli vm delete d51de633-640f-4b19-b372-b4197b321c8d
VM deleted.
~ $