### Install and Start Docker Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Installs Docker and Docker Compose, then enables and starts the Docker service. This is necessary as the default TDX key provider uses Docker. ```bash sudo apt install -y docker.io docker-compose-v2 sudo systemctl enable --now docker ``` -------------------------------- ### Install dstack Go SDK Source: https://github.com/dstack-tee/dstack/blob/master/sdk/go/README.md Use `go get` to install the dstack SDK for Go. ```bash go get github.com/Dstack-TEE/dstack/sdk/go ``` -------------------------------- ### Setup Python SDK Source: https://github.com/dstack-tee/dstack/blob/master/CLAUDE.md Install dependencies for the Python SDK. ```bash cd sdk/python make install # Install dependencies ``` -------------------------------- ### Run auth-simple Server Source: https://github.com/dstack-tee/dstack/blob/master/docs/deployment.md Commands to install dependencies and start the auth-simple server, specifying the port and configuration path. ```bash cd kms/auth-simple bun install PORT=3001 AUTH_CONFIG_PATH=/path/to/auth-config.json bun run start ``` -------------------------------- ### Install and Start Libvirt Default Network Source: https://github.com/dstack-tee/dstack/blob/master/docs/bridge-networking.md Install the libvirt package and ensure the default network is active and set to autostart for bridge networking. ```bash # Install libvirt (if not already present) sudo apt install -y libvirt-daemon-system # Ensure default network is active sudo virsh net-start default 2>/dev/null sudo virsh net-autostart default ``` -------------------------------- ### Start Test Services Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/TESTING.md Commands to start the necessary services for testing. 'test:setup' starts the Anvil node and deploys contracts, while 'dev' starts the API server in development mode. ```bash npm run test:setup ``` ```bash npm run dev ``` -------------------------------- ### Quick Start: Derive Key and Generate Attestation Source: https://github.com/dstack-tee/dstack/blob/master/sdk/rust/README.md This example demonstrates how to initialize the dstack client, derive a deterministic key, and generate an attestation quote using the SDK. ```rust use dstack_sdk::dstack_client::DstackClient; #[tokio::main] async fn main() -> Result<(), Box> { let client = DstackClient::new(None); // Derive a deterministic key for your wallet let key = client.get_key(Some("wallet/eth".to_string()), None).await?; println!("{}", key.key); // Same path always returns the same key // Generate an attestation quote let resp = client.attest(b"my-app-state".to_vec()).await?; println!("{}", resp.attestation); Ok(()) } ``` -------------------------------- ### Install and Deploy dstack App Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Installs dstackup, deploys a 'hello-nginx' application, and accesses it via HTTP. Ensure the example docker-compose file exists at the specified path. ```bash curl -fsSL https://raw.githubusercontent.com/Dstack-TEE/dstack/master/scripts/install.sh | sh sudo dstackup install sudo dstack deploy \ -n hello-nginx \ -c /usr/local/share/dstack/examples/hello-nginx/docker-compose.yaml \ --port 8080:80 curl http://127.0.0.1:8080/ ``` -------------------------------- ### Setup Ethereum Smart Contracts (KMS Auth) Source: https://github.com/dstack-tee/dstack/blob/master/CLAUDE.md Install Node.js and Foundry dependencies for the KMS authentication smart contracts. ```bash cd kms/auth-eth npm install # Install Node.js dependencies for bootAuth server forge install # Install Foundry dependencies (submodules) ``` -------------------------------- ### Run TDX Host Setup Script Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/tdx-software-installation.md Executes the main script to install the TDX-enabled kernel, QEMU, libvirt, OVMF, and attestation components. This script also configures GRUB and adds the user to the 'kvm' group. ```bash sudo ./setup-tdx-host.sh ``` -------------------------------- ### Install dstack auth-simple Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-simple/README.md Install the auth-simple package using bun. ```bash bun install ``` -------------------------------- ### Install and Get Help for VMM CLI Source: https://github.com/dstack-tee/dstack/blob/master/docs/vmm-cli-user-guide.md Run the VMM CLI script with the --help flag to see available commands and options. ```bash ./vmm-cli.py --help ``` -------------------------------- ### Build and Start Simulator Source: https://github.com/dstack-tee/dstack/blob/master/tests/docs/kms-self-authorization.md These commands build the simulator and then start it. The simulator is used for local KMS development without TDX hardware, ensuring that quote-required logic is still exercised. ```bash cd dstack/sdk/simulator ./build.sh ./dstack-simulator ``` -------------------------------- ### Start and Enable Docker Service Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/docker-setup.md Start the Docker service and configure it to start automatically on system boot. ```bash sudo systemctl start docker sudo systemctl enable docker ``` -------------------------------- ### Install HAProxy Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/haproxy-setup.md Installs HAProxy using apt. Verify the installation by checking the version. ```bash sudo apt update sudo apt install -y haproxy ``` ```bash haproxy -v ``` -------------------------------- ### Install dstack-acpi-tables Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/attestation-verification.md Installs the compiled QEMU binary as `dstack-acpi-tables` in the system's PATH after stripping unnecessary symbols. ```bash strip qemu-system-x86_64 sudo install -m 755 qemu-system-x86_64 /usr/local/bin/dstack-acpi-tables ``` -------------------------------- ### Run BootAuth Server in Development Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/README.md Starts the Fastify-based BootAuth server in development mode. ```bash # Development mode npm run dev ``` -------------------------------- ### Start Virtual Machine Source: https://github.com/dstack-tee/dstack/blob/master/vmm/src/console_v0.html Starts a virtual machine. This function is defined but its implementation is truncated in the source. ```javascript const startVm = as ``` -------------------------------- ### Install Docker Packages Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/docker-setup.md Install the Docker Engine, CLI, containerd.io, and the buildx and compose plugins. ```bash sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ``` -------------------------------- ### Install Dstack SDK and Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/sdk/js/README.md Install the core dstack SDK and the required peer dependency for hashing. Additional peer dependencies like 'viem' or '@solana/web3.js' must be installed separately if using their respective submodules. ```bash npm install @phala/dstack-sdk @noble/hashes ``` -------------------------------- ### Install dstack SDK Source: https://github.com/dstack-tee/dstack/blob/master/sdk/python/README.md Install the dstack SDK using pip. Blockchain helpers are optional extras. ```bash pip install dstack-sdk ``` -------------------------------- ### Install QEMU Build Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/attestation-verification.md Installs the necessary packages to build a custom QEMU binary required for generating ACPI tables. ```bash sudo apt-get update sudo apt-get install -y git libslirp-dev python3-pip ninja-build \ pkg-config libglib2.0-dev build-essential flex bison ``` -------------------------------- ### Install Python SDK Dependencies and Run Tests Source: https://github.com/dstack-tee/dstack/blob/master/sdk/python/README.md Navigate to the Python SDK directory, install development dependencies, and run tests using PDM. ```bash cd sdk/python make install make test ``` -------------------------------- ### Enable and Start HAProxy Service Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/haproxy-setup.md Enables the HAProxy service to start on boot and restarts the service to apply changes. ```bash sudo systemctl enable haproxy sudo systemctl restart haproxy ``` -------------------------------- ### Install and Run Static Analysis Tools Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/README.md Installs Slither and Halmos using pipx and runs them for static analysis and symbolic verification. ```bash pipx install slither-analyzer halmos slither . halmos --contract DstackAppSymbolicTest halmos --contract DstackKmsSymbolicTest ``` -------------------------------- ### Install Build Packages Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Installs essential build tools and libraries required for the dstack onboarding process on Ubuntu-based systems. ```bash sudo apt update sudo apt install -y \ build-essential \ ca-certificates \ curl \ git \ libssl-dev \ pkg-config \ tar ``` -------------------------------- ### Deploy Nginx Example App with Dstack Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Deploys the checked-in nginx example using a Docker Compose file. Maps host port 8080 to VM port 80. Resources can be adjusted with --vcpu, --memory, or --disk flags. ```bash sudo dstack deploy \ -n hello-nginx \ -c /usr/local/share/dstack/examples/hello-nginx/docker-compose.yaml \ --port 8080:80 ``` -------------------------------- ### Install Docker Prerequisites Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/docker-setup.md Update your package list and install necessary packages for adding new repositories and managing GPG keys. ```bash sudo apt update sudo apt install -y ca-certificates curl gnupg ``` -------------------------------- ### Install QEMU Data Files Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/attestation-verification.md Installs essential QEMU data files, such as BIOS ROMs, required for the custom QEMU binary to function correctly. ```bash sudo install -d /usr/local/share/qemu sudo install -m 644 ../pc-bios/efi-virtio.rom /usr/local/share/qemu/ sudo install -m 644 ../pc-bios/kvmvapic.bin /usr/local/share/qemu/ sudo install -m 644 ../pc-bios/linuxboot_dma.bin /usr/local/share/qemu/ ``` -------------------------------- ### Typical Workflow: One-time Setup and Multiple Test Runs Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/scripts/README.md Demonstrates a common workflow: setting up the local chain once, running tests multiple times, and then cleaning up the environment. ```bash # Set up once npm run test:setup # Run tests multiple times npm run test:run npm run test:run npm run test:run # Clean up when done npm run test:cleanup ``` -------------------------------- ### List Installed Images Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/guest-image-setup.md Display the names of all installed guest image directories. This is useful for a quick overview of available versions. ```bash ls /var/lib/dstack/images/ ``` -------------------------------- ### Example TOML Configuration File Source: https://github.com/dstack-tee/dstack/blob/master/verifier/README.md This TOML file shows an example configuration for the DStack Verifier, including settings for host, port, cache directory, download URL, and timeout. ```toml host = "0.0.0.0" port = 8080 image_cache_dir = "/tmp/dstack-verifier/cache" image_download_url = "https://download.dstack.org/os-images/mr_{OS_IMAGE_HASH}.tar.gz" image_download_timeout_secs = 300 # pccs_url = "https://pccs.phala.network" ``` -------------------------------- ### Create Application Directory Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/hello-world-app.md Set up the directory for your hello-world application deployment. ```bash mkdir -p ~/hello-world-deploy cd ~/hello-world-deploy ``` -------------------------------- ### Initial Gateway Deployment and Node Setup Source: https://github.com/dstack-tee/dstack/blob/master/gateway/docs/cluster-deployment.md Steps to deploy the first gateway node, configure subsequent nodes with unique IDs and settings, and deploy them. This includes creating separate directories for each node and editing their respective `.env` files and deploy scripts. ```bash cd gateway/dstack-app # 1. First run creates a template .env — edit it with your values bash deploy-to-vmm.sh # 2. Edit .env (set VMM_RPC, SRV_DOMAIN, PUBLIC_IP, NODE_ID, GATEWAY_APP_ID, KMS_URL, MY_URL, CF_API_TOKEN, etc.) # 3. Deploy node 1 (no BOOTNODE_URL needed) bash deploy-to-vmm.sh # 4. Bootstrap admin config (only once per cluster) bash bootstrap-cluster.sh # 5. For node 2, create a separate directory with its own .env: cp -r . ../deploy-node2 && cd ../deploy-node2 # Edit .env with: # - NODE_ID=2 # - SUBNET_INDEX=1 # - MY_URL=https://gateway-2.example.com: # - Different port assignments if on same host (see section 2.6) # - BOOTNODE_URL= (optional, speeds up discovery) # Edit deploy-to-vmm.sh: change --name to dstack-gateway-2 bash deploy-to-vmm.sh # No need to run bootstrap-cluster.sh — config syncs from node 1 ``` -------------------------------- ### Typical Workflow: Complete Test Run Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/scripts/README.md Shows how to execute the complete test suite, which includes setup and all tests, in a single command. An option to include Foundry tests is also provided. ```bash # Run everything in one go npm run test:all # Or with Foundry tests npm run test:all:foundry ``` -------------------------------- ### Logging Error Message Source: https://github.com/dstack-tee/dstack/blob/master/CLAUDE.md Use lowercase for the start of error messages. This example shows a bail error. ```rust anyhow::bail!("failed to connect to server"); ``` -------------------------------- ### Logging Info Message Source: https://github.com/dstack-tee/dstack/blob/master/CLAUDE.md Use lowercase for the start of log messages. This example shows an informational log. ```rust log::info!("starting server on port {}", port); ``` -------------------------------- ### Run dstack-kms Source: https://github.com/dstack-tee/dstack/blob/master/CLAUDE.md Starts the dstack KMS component with a specified configuration file. ```shell ./dstack-kms -c kms.toml ``` -------------------------------- ### Deploy VM with Basic Configuration Source: https://github.com/dstack-tee/dstack/blob/master/docs/vmm-cli-user-guide.md Deploys a VM instance with specified name, image, compose file, CPU, memory, and disk size. ```bash ./vmm-cli.py deploy \ --name "my-app-vm" \ --image "dstack-0.5.3" \ --compose ./app-compose.json \ --vcpu 2 \ --memory 2G \ --disk 50G ``` -------------------------------- ### Local Testing with Solana Helpers Source: https://github.com/dstack-tee/dstack/blob/master/sdk/go/README.md Run your starter project with the `solana` tag to test locally with Solana helpers enabled. ```bash # solana only go run -tags solana . ``` -------------------------------- ### Local Testing with Both Helpers Source: https://github.com/dstack-tee/dstack/blob/master/sdk/go/README.md Run your starter project with both `ethereum` and `solana` tags to test locally with both blockchain helpers enabled. ```bash # both go run -tags "ethereum solana" . ``` -------------------------------- ### Quick Start: Get Key and Quote Source: https://github.com/dstack-tee/dstack/blob/master/sdk/js/README.md Initialize the DstackClient and retrieve a deterministic key for 'wallet/eth' and an attestation quote for 'app-state-snapshot'. The client automatically probes default socket locations. ```typescript import { DstackClient } from '@phala/dstack-sdk' const client = new DstackClient() const key = await client.getKey('wallet/eth') console.log(Buffer.from(key.key).toString('hex')) const quote = await client.getQuote('app-state-snapshot') console.log(quote.quote) console.log(quote.replayRtmrs()) ``` -------------------------------- ### Start auth-simple Services Source: https://github.com/dstack-tee/dstack/blob/master/tests/docs/kms-self-authorization.md Launches two instances of the auth-simple service in the background, one for the source and one for the destination, each with its own configuration and port. ```bash cd "$REPO_ROOT/kms/auth-simple" AUTH_CONFIG_PATH=/tmp/kms-self-auth/auth-src.json PORT=3101 bun run start \ >/tmp/kms-self-auth/auth-src.log 2>&1 & echo $! >/tmp/kms-self-auth/auth-src.pid ``` ```bash AUTH_CONFIG_PATH=/tmp/kms-self-auth/auth-dst.json PORT=3102 bun run start \ >/tmp/kms-self-auth/auth-dst.log 2>&1 & echo $! >/tmp/kms-self-auth/auth-dst.pid ``` -------------------------------- ### Setup Local Anvil Chain and Deploy Contracts Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/scripts/README.md Use this script to start a local Anvil blockchain on port 8545, deploy the dstack contracts, and save configuration to .env.test. It can be run directly or via an npm script. ```bash npm run test:setup # or ./scripts/setup-local-chain.sh ``` -------------------------------- ### Configure New KMS for Onboarding Source: https://github.com/dstack-tee/dstack/blob/master/docs/deployment.md Set up a new KMS instance to enter onboarding mode by enabling the onboard module and leaving `auto_bootstrap_domain` empty. This prepares the KMS to receive keys from an existing KMS. ```toml [core.onboard] enabled = true auto_bootstrap_domain = "" # Empty = onboard mode address = "0.0.0.0" port = 9203 # HTTP port for onboard UI ``` -------------------------------- ### Set Permissions for TDX Guest Device with Root Helper Container Source: https://github.com/dstack-tee/dstack/blob/master/docs/native-tee-interfaces.md When the main process must remain non-root, use a helper container to adjust host device node permissions before the application starts. This example uses busybox to set permissions for /dev/tdx_guest. ```yaml services: tdx-device-perms: image: busybox volumes: - /dev/tdx_guest:/dev/tdx_guest command: chmod 666 /dev/tdx_guest restart: "no" app: image: your-image user: "1000:1000" depends_on: tdx-device-perms: condition: service_completed_successfully devices: - /dev/tdx_guest:/dev/tdx_guest ``` -------------------------------- ### Check Foundry Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/blockchain-setup.md Verify if Foundry is installed by checking its version. If not installed, follow the provided link for installation instructions. ```bash cast --version ``` -------------------------------- ### Run BootAuth Server in Production Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/README.md Builds and starts the Fastify-based BootAuth server in production mode. ```bash # Production mode npm run build && npm start ``` -------------------------------- ### Per-Node Deployment Directory Setup Source: https://github.com/dstack-tee/dstack/blob/master/gateway/docs/cluster-deployment.md Demonstrates creating separate deployment directories for each node and modifying the `deploy-to-vmm.sh` script to use unique VM names. This approach helps manage multiple nodes on the same VMM by avoiding naming conflicts. ```bash # Create per-node deployment directories cp -r gateway/dstack-app gateway/deploy-node1 cp -r gateway/dstack-app gateway/deploy-node2 # In each directory's deploy-to-vmm.sh, change the --name argument: # deploy-node1: --name dstack-gateway-1 # deploy-node2: --name dstack-gateway-2 # Edit each directory's .env with node-specific values ``` -------------------------------- ### Install Dstack with Custom Prefix Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Installs Dstack using a custom prefix. Ensure you have curl installed. The script downloads and executes the installation script with the specified prefix. ```bash curl -fsSL https://raw.githubusercontent.com/Dstack-TEE/dstack/master/scripts/install.sh | sh -s -- --prefix /opt/dstack-test ``` -------------------------------- ### Install rustup Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/rust-toolchain-installation.md Install rustup, the Rust toolchain installer and version manager, using a curl command. The '-y' flag accepts default options for a non-interactive installation. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ``` -------------------------------- ### Verify Node.js and npm Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/kms-build-configuration.md Checks the installed versions of Node.js and npm to confirm successful installation. ```bash node --version npm --version ``` -------------------------------- ### Test Docker Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/docker-setup.md Run the 'hello-world' container to ensure Docker is functioning correctly and can pull and run images. ```bash docker run hello-world ``` -------------------------------- ### Check if Docker is Installed Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/docker-setup.md Run this command to check if Docker is already installed on your system. If it is, you can skip the installation steps. ```bash docker --version ``` -------------------------------- ### Install Node.js 20.x Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/kms-build-configuration.md Installs Node.js version 20.x using NodeSource. Ensure Node.js and npm are installed before proceeding. ```bash curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs ``` -------------------------------- ### List All Installed Images (Detailed) Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/guest-image-setup.md Provide a detailed listing of all guest image directories, including file permissions and ownership. ```bash ls -la /var/lib/dstack/images/ ``` -------------------------------- ### Quick Start: Initialize Client and Derive Key Source: https://github.com/dstack-tee/dstack/blob/master/sdk/python/README.md Initialize the DstackClient and derive a deterministic key for your wallet. The same path always returns the same key for your application. ```python from dstack_sdk import DstackClient client = DstackClient() # Derive a deterministic key for your wallet key = client.get_key('wallet/eth') print(key.key) # Same path always returns the same key ``` -------------------------------- ### Install dstackup Bootstrap Command Source: https://github.com/dstack-tee/dstack/blob/master/docs/onboarding.md Downloads and installs the dstackup bootstrap script from GitHub. This script is used to build and install the main dstack components. ```bash curl -fsSL https://raw.githubusercontent.com/Dstack-TEE/dstack/master/scripts/install.sh | sh ``` -------------------------------- ### Install Certbot Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/ssl-certificate-setup.md Install Certbot, the client used to obtain and renew Let's Encrypt certificates. Verify the installation by checking the Certbot version. ```bash sudo apt update sudo apt install -y certbot ``` ```bash certbot --version ``` -------------------------------- ### Install dstack Build Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/system-baseline-dependencies.md Install a comprehensive set of build tools and libraries required for compiling dstack components. This command installs multiple packages at once. ```bash sudo apt install -y \ build-essential \ chrpath \ diffstat \ lz4 \ wireguard-tools \ xorriso \ git \ curl \ pkg-config \ libssl-dev ``` -------------------------------- ### Verify Intel TDX Host Setup Source: https://github.com/dstack-tee/dstack/blob/master/docs/hardware-enablement.md Run these commands after setting up an Intel TDX host to verify the TDX module initialization, SGX device node presence, and QEMU version. ```bash sudo dmesg | grep -i tdx test -e /dev/sgx_enclave && test -e /dev/sgx_provision /usr/bin/qemu-system-x86_64 --version ``` -------------------------------- ### Install Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth/README.md Installs Foundry and Node.js dependencies required for the project. ```bash # Install Foundry dependencies forge install # Install Node.js dependencies for server npm install ``` -------------------------------- ### Replace Placeholders in Tutorials Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/dns-configuration.md Automate the replacement of placeholder domains within tutorial markdown files using `sed`. This ensures consistency when following tutorials. Run this command from the `~/dstack-info` directory. ```bash cd ~/dstack-info # Replace all placeholders (most specific patterns first) find src/content/tutorials -name "*.md" -exec sed -i \ -e "s|registry\.yourdomain\.com|${REGISTRY_DOMAIN}|g" \ -e "s|vmm\.dstack\.yourdomain\.com|vmm.${GATEWAY_DOMAIN}|g" \ -e "s|kms\.yourdomain\.com|${KMS_DOMAIN}|g" \ -e "s|dstack\.yourdomain\.com|${GATEWAY_DOMAIN}|g" \ -e "s|yourdomain\.com|${BASE_DOMAIN}|g" \ {} + ``` -------------------------------- ### Start Services Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/gramine-key-provider.md Starts the aesmd and gramine-sealing-key-provider services in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Create a New dstack Project Source: https://github.com/dstack-tee/dstack/blob/master/docs/quickstart.md Initialize a new dstack project named 'my-app' and navigate into its directory. This sets up the basic project structure. ```bash dstack-cloud new my-app cd my-app ``` -------------------------------- ### Install auth-eth Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/kms-build-configuration.md Installs all necessary Node.js dependencies for the auth-eth service. ```bash npm install ``` -------------------------------- ### Local Testing with Ethereum Helpers Source: https://github.com/dstack-tee/dstack/blob/master/sdk/go/README.md To test locally with Ethereum helpers enabled, first get the go-ethereum dependency, then run your starter project with the `ethereum` tag. ```bash # ethereum only go get github.com/ethereum/go-ethereum@v1.16.8 go run -tags ethereum . ``` -------------------------------- ### Complete KMS Onboarding Source: https://github.com/dstack-tee/dstack/blob/master/docs/deployment.md After triggering the onboarding process, call the `/finish` endpoint on the new KMS instance to finalize the setup. The KMS must then be restarted to serve as a full KMS with shared keys. ```bash curl http://:9203/finish # Restart KMS - it will now serve as a full KMS with shared keys ``` -------------------------------- ### Verify Certbot Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/ssl-certificate-setup.md Check if Certbot is installed on your system by verifying its version. ```bash certbot --version ``` -------------------------------- ### Start dstack-vmm Service Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/vmm-service-setup.md Manually start the dstack-vmm service using systemctl. ```bash sudo systemctl start dstack-vmm ``` -------------------------------- ### Fix npm Permissions for Global Installs Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/troubleshooting-kms-deployment.md If 'npm install' fails with EACCES permission denied, configure npm to use a global directory and update your PATH. This ensures packages are installed correctly. ```bash mkdir -p ~/.npm-global npm config set prefix '~/.npm-global' export PATH=~/.npm-global/bin:$PATH npm install ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-eth-bun/README.md Installs project dependencies using the Bun package manager. ```bash bun install ``` -------------------------------- ### Verify Build Tool Installations Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/system-baseline-dependencies.md Check if essential build tools like GCC, make, and git are installed and accessible. Also verifies the installation of specific tools like WireGuard, xorriso, and lz4. ```bash # Check compiler gcc --version # Check make make --version # Check git git --version # Check additional tools wg --version xorriso --version lz4 --version ``` -------------------------------- ### Build Custom QEMU Binary Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/attestation-verification.md Compiles the custom QEMU binary. This process can take several minutes. ```bash ninja ``` -------------------------------- ### Verify dstack-cloud Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/quickstart.md Check if the dstack-cloud CLI is installed and accessible by running the help command. ```bash dstack-cloud --help ``` -------------------------------- ### Deploy Web Server with Specific GPUs and Environment Variables Source: https://github.com/dstack-tee/dstack/blob/master/docs/vmm-cli-user-guide.md Deploys a web server VM with specific port mappings, individual GPU assignments, an environment file, and a KMS URL. ```bash ./vmm-cli.py deploy \ --name "web-server" \ --image "dstack-0.5.3" \ --compose ./app-compose.json \ --vcpu 4 \ --memory 4G \ --disk 100G \ --port tcp:8080:80 \ --port tcp:8443:443 \ --gpu "0" --gpu "1" \ --env-file ./production.env \ --kms-url http://kms-server:9000 ``` -------------------------------- ### Run Production Server Source: https://github.com/dstack-tee/dstack/blob/master/kms/auth-mock/README.md Starts the production server directly or after building the project using Bun. ```bash bun run start ``` ```bash bun run build ``` -------------------------------- ### Install Bun Dependencies for auth-simple Source: https://github.com/dstack-tee/dstack/blob/master/tests/docs/kms-self-authorization.md Installs the necessary Node.js dependencies for the auth-simple service using Bun. ```bash cd "$REPO_ROOT/kms/auth-simple" bun install ``` -------------------------------- ### Install VMM Build Dependencies Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/troubleshooting-dstack-installation.md Ensure essential build tools and libraries are installed before compiling the dstack-vmm. ```bash sudo apt install -y build-essential pkg-config libssl-dev ``` -------------------------------- ### Create KMS Configuration Directories Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/kms-build-configuration.md Set up the necessary directory structure for KMS configuration, certificates, runtime, and logs. ```bash # Configuration directory sudo mkdir -p /etc/kms # Certificate directory sudo mkdir -p /etc/kms/certs # Runtime directories sudo mkdir -p /var/run/kms sudo mkdir -p /var/log/kms # Set permissions sudo chown -R $USER:$USER /etc/kms sudo chown -R $USER:$USER /var/run/kms sudo chown -R $USER:$USER /var/log/kms ``` -------------------------------- ### Start VM Source: https://github.com/dstack-tee/dstack/blob/master/vmm/src/console_v0.html Initiates the startup process for a specified VM. It reloads the VM list upon successful completion or displays an error message if the operation fails. ```javascript const sync = async (id) => { try { const _response = await rpcCall('StartVm', { id }); loadVMList(); } catch (error) { console.error('Error starting VM:', error); alert('Failed to start VM'); } }; ``` -------------------------------- ### Verify Installation Source: https://github.com/dstack-tee/dstack/blob/master/docs/tutorials/clone-build-dstack-vmm.md Confirm that the dstack-vmm and dstack-supervisor binaries are installed correctly and accessible in the system's PATH. ```bash which dstack-vmm dstack-vmm --version which dstack-supervisor ls -la /usr/local/bin/dstack-supervisor ```