Skip to main content
Deploy a Jupyter notebook to Phala Cloud and run code inside a TEE in under 10 minutes. You’ll use the CLI to deploy, then test key derivation and remote attestation from inside the secure environment.

Prerequisites

Install the CLI

Install the Phala Cloud CLI globally:
Or use npx phala / bunx phala to run commands without installing.

Authenticate

The CLI supports device flow authentication—run the login command and follow the browser prompt:
Alternatively, generate an API key manually from the dashboard by clicking your username → API TokensCreate Token, then authenticate with:
Verify your authentication:

Deploy a Jupyter Notebook

Create a docker-compose.yml file:
The dstack.sock volume mount enables your code to communicate with the TEE environment. Deploy with a name and access token:

Access Your Notebook

Check deployment status:
Once the status shows running, get the public URL:
Open this URL in your browser. You’ll see a login page with a “Password or token” field—enter the token you set during deployment (my-secret-token in this example) and click Log in. View container logs if needed:

Test TEE Functions

Once logged in, click Python 3 (ipykernel) under “Notebook” to create a new notebook. In the first cell, install the dstack SDK:
Run the cell with Shift+Enter. In a new cell, test TEE-native capabilities:
Generate blockchain wallet addresses using TEE-derived keys. In a new cell, install the additional dependencies:
Then in another cell:

Clean Up

When you’re done experimenting, delete the CVM to stop billing:
Other useful commands: phala cvms stop to pause without deleting, phala cvms start to resume, and phala cvms attestation to view the TEE attestation report. After deploying, link your local directory to the CVM so subsequent commands don’t need the CVM name:
This creates a phala.toml file in your project directory:
Commit phala.toml to version control. Once linked, commands use the CVM from phala.toml automatically:
The recommended workflow:
  1. First deploy: phala deploy -n my-app -c docker-compose.yml
  2. Link: phala link my-app
  3. Commit phala.toml to your repo
  4. Subsequent deploys: just phala deploy

Next Steps