phala 0.0.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +762 -0
- package/dist/chunk-A4IAJHG6.js +2 -0
- package/dist/chunk-A4IAJHG6.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-LBGFMBSV.js +2 -0
- package/dist/logger-LBGFMBSV.js.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
@@ -0,0 +1,762 @@
|
|
1
|
+
# Phala Cloud CLI
|
2
|
+
|
3
|
+
A command-line tool for managing Trusted Execution Environment (TEE) deployments on Phala Cloud, from local development to cloud deployment.
|
4
|
+
|
5
|
+
<p align="center">
|
6
|
+
<img src="https://phala.network/images/logo-colored.svg" alt="Phala Network Logo" width="180"/>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p align="center">
|
10
|
+
<b>Secure. Confidential. Verifiable.</b>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
## π What is Phala Cloud?
|
14
|
+
|
15
|
+
Phala Cloud is a confidential cloud platform that enables developers to deploy applications in a Trusted Execution Environment (TEE) using the [Dstack SDK](https://github.com/Dstack-TEE/dstack). TEEs provide hardware-level isolation and encryption, ensuring your application's code and data remain completely private and secureβeven from the infrastructure providers hosting them.
|
16
|
+
|
17
|
+
**Key Benefits:**
|
18
|
+
|
19
|
+
- **Confidentiality**: Your code and data remain encrypted in memory during execution
|
20
|
+
- **Integrity**: Hardware guarantees that your application runs unmodified
|
21
|
+
- **Attestation**: Remote attestation quote to prove that your docker app is running in a genuine TEE
|
22
|
+
- **Simplified Deployment**: The CLI handles the complexity of TEE deployment using the Phala Cloud API
|
23
|
+
|
24
|
+
## π Quick Start (5 Minutes)
|
25
|
+
|
26
|
+
1. **Install Prerequisites**:
|
27
|
+
```bash
|
28
|
+
# Install Bun
|
29
|
+
curl -fsSL https://bun.sh/install | bash
|
30
|
+
|
31
|
+
# Verify Docker is installed
|
32
|
+
docker --version
|
33
|
+
```
|
34
|
+
|
35
|
+
2. **Install TEE Cloud CLI**:
|
36
|
+
|
37
|
+
Install via npm or use npx/bunx
|
38
|
+
```bash
|
39
|
+
# Install the CLI globally
|
40
|
+
npm install -g phala
|
41
|
+
|
42
|
+
# Use npx/bunx
|
43
|
+
npx phala help
|
44
|
+
bunx phala help
|
45
|
+
```
|
46
|
+
|
47
|
+
or clone git repository
|
48
|
+
|
49
|
+
```bash
|
50
|
+
# Clone the repository
|
51
|
+
git clone --recurse-submodules https://github.com/Phala-Network/phala-cloud-cli.git
|
52
|
+
cd phala-cloud-cli
|
53
|
+
|
54
|
+
# Install and build
|
55
|
+
bun install
|
56
|
+
bun run build
|
57
|
+
|
58
|
+
# Phala CLI help menu
|
59
|
+
phala help
|
60
|
+
```
|
61
|
+
|
62
|
+
3. **Sign Up and Get API Key**:
|
63
|
+
|
64
|
+
To deploy applications to Phala Cloud, you'll need an API key:
|
65
|
+
|
66
|
+
- Visit [Phala Cloud](https://cloud.phala.network/login) to log into your Phala Cloud account. If you do not have an account, register with this link with [PROMO_CODE](https://cloud.phala.network/register?invite=PHALACLI).
|
67
|
+
- After logging in, navigate to the "API Keys" section in your profile
|
68
|
+
- Create a new API key with an appropriate name (e.g., "CLI Access")
|
69
|
+
- Copy the generated API key - you'll need it for authentication
|
70
|
+
- You can verify your API key using:
|
71
|
+
```bash
|
72
|
+
phala auth login [your-phala-cloud-api-key]
|
73
|
+
phala auth status
|
74
|
+
```
|
75
|
+
|
76
|
+
4. **Deploy Your First Confidential App**:
|
77
|
+
```bash
|
78
|
+
# Deploy the webshell Dstack example
|
79
|
+
phala cvms create
|
80
|
+
```
|
81
|
+
|
82
|
+
Provide a name and select from the drop down of examples
|
83
|
+
|
84
|
+
```bash
|
85
|
+
# ? Enter a name for the CVM: webshell
|
86
|
+
# ? Choose a Docker Compose example or enter a custom path:
|
87
|
+
|
88
|
+
# lightclient
|
89
|
+
# private-docker-image-deployment
|
90
|
+
# β― webshell
|
91
|
+
# custom-domain
|
92
|
+
# prelaunch-script
|
93
|
+
# timelock-nts
|
94
|
+
# ssh-over-tproxy
|
95
|
+
# Using example: webshell (~/phala-cloud-cli/examples/webshell/docker-compose.yaml)
|
96
|
+
# β Enter number of vCPUs (default: 1): 1
|
97
|
+
|
98
|
+
# β Enter memory in MB (default: 2048): 2048
|
99
|
+
# β Enter disk size in GB (default: 20): 20
|
100
|
+
# β³ Fetching available TEEPods... β
|
101
|
+
# ? Select a TEEPod: (Use arrow keys)
|
102
|
+
# β― prod5 (online)
|
103
|
+
# prod2 (online)
|
104
|
+
# βΉ Selected TEEPod: prod5
|
105
|
+
|
106
|
+
# β Select an image: dstack-dev-0.3.5
|
107
|
+
# β³ Getting public key from CVM... β
|
108
|
+
# β³ Encrypting environment variables... β
|
109
|
+
# β³ Creating CVM... β
|
110
|
+
# β CVM created successfully
|
111
|
+
# βΉ CVM ID: 2755
|
112
|
+
# βΉ Name: webshell
|
113
|
+
# βΉ Status: creating
|
114
|
+
# βΉ App ID: e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
115
|
+
# βΉ App URL: <https://cloud.phala.network/dashboard/cvms/app_e15c1a29a9dfb522da528464a8d5ce40ac28039f>
|
116
|
+
# βΉ
|
117
|
+
# βΉ Your CVM is being created. You can check its status with:
|
118
|
+
# βΉ phala cvms status e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
119
|
+
```
|
120
|
+
|
121
|
+
Now interact with your application in Phala Cloud by going to the url on port 7681 (Example of what a url at port 7681 would look like https://e15c1a29a9dfb522da528464a8d5ce40ac28039f-7681.dstack-prod5.phala.network)
|
122
|
+
|
123
|
+
5. **Check the CVM's Attestation**:
|
124
|
+
```bash
|
125
|
+
phala cvms attestation
|
126
|
+
|
127
|
+
# βΉ No CVM specified, fetching available CVMs...
|
128
|
+
# β³ Fetching available CVMs... β
|
129
|
+
# β Select a CVM: testing (88721d1685bcd57166a8cbe957cd16f733b3da34) - Status: running
|
130
|
+
# βΉ Fetching attestation information for CVM 88721d1685bcd57166a8cbe957cd16f733b3da34...
|
131
|
+
# β³ Fetching attestation information... β
|
132
|
+
# β Attestation Summary:
|
133
|
+
|
134
|
+
# or list the app-id
|
135
|
+
phala cvms attestation 88721d1685bcd57166a8cbe957cd16f733b3da34
|
136
|
+
```
|
137
|
+
|
138
|
+
|
139
|
+
## ποΈ Development Workflow
|
140
|
+
|
141
|
+
### 1οΈβ£ Local Development
|
142
|
+
|
143
|
+
Develop and test your application locally with the built-in TEE simulator:
|
144
|
+
|
145
|
+
```bash
|
146
|
+
# Start the TEE simulator
|
147
|
+
phala simulator start
|
148
|
+
|
149
|
+
# Build your Docker image
|
150
|
+
phala docker build --image my-tee-app --tag v1.0.0
|
151
|
+
|
152
|
+
# Create an environment file
|
153
|
+
echo "API_KEY=test-key" > .env
|
154
|
+
echo "DEBUG=true" >> .env
|
155
|
+
|
156
|
+
# Generate and run Docker Compose
|
157
|
+
phala docker build-compose --image my-tee-app --tag v1.0.0 --env-file ./.env
|
158
|
+
phala docker run -c ./phala-compose.yaml -e ./.env
|
159
|
+
|
160
|
+
```
|
161
|
+
|
162
|
+
### 2οΈβ£ Cloud Deployment
|
163
|
+
|
164
|
+
Deploy your application to Phala's decentralized TEE Cloud:
|
165
|
+
|
166
|
+
```bash
|
167
|
+
# Set your Phala Cloud API key
|
168
|
+
phala auth login
|
169
|
+
|
170
|
+
# Login to Docker and Push your image to Docker Hub
|
171
|
+
phala docker login
|
172
|
+
phala docker build --image my-tee-app --tag v1.0.0
|
173
|
+
phala docker push --image my-tee-app --tag v1.0.0
|
174
|
+
|
175
|
+
# Deploy to Phala Cloud
|
176
|
+
phala cvms create --name my-tee-app --compose ./docker-compose.yml --env-file ./.env
|
177
|
+
|
178
|
+
# Access your app via the provided URL
|
179
|
+
```
|
180
|
+
|
181
|
+
## πΌ Real-World Use Cases for Confidential Computing
|
182
|
+
|
183
|
+
### π¦ Financial Services
|
184
|
+
- **Private Trading Algorithms**: Execute proprietary trading strategies without revealing algorithms
|
185
|
+
- **Secure Multi-Party Computation**: Perform financial calculations across organizations without exposing sensitive data
|
186
|
+
- **Compliant Data Processing**: Process regulated financial data with provable security guarantees
|
187
|
+
|
188
|
+
### π₯ Healthcare
|
189
|
+
- **Medical Research**: Analyze sensitive patient data while preserving privacy
|
190
|
+
- **Drug Discovery**: Collaborate on pharmaceutical research without exposing intellectual property
|
191
|
+
- **Health Record Processing**: Process electronic health records with HIPAA-compliant confidentiality
|
192
|
+
|
193
|
+
### π Cybersecurity
|
194
|
+
- **Secure Key Management**: Generate and store cryptographic keys in hardware-protected environments
|
195
|
+
- **Threat Intelligence Sharing**: Share cyber threat data across organizations without exposing sensitive details
|
196
|
+
- **Password Verification**: Perform credential validation without exposing password databases
|
197
|
+
|
198
|
+
### π’ Enterprise Applications
|
199
|
+
- **Confidential Analytics**: Process sensitive business data without exposure to cloud providers
|
200
|
+
- **IP Protection**: Run proprietary algorithms and software while preventing reverse engineering
|
201
|
+
- **Secure Supply Chain**: Validate and process sensitive supply chain data across multiple organizations
|
202
|
+
|
203
|
+
### π Web3 and Blockchain
|
204
|
+
- **Private Smart Contracts**: Execute contracts with confidential logic and data
|
205
|
+
- **Decentralized Identity**: Process identity verification without exposing personal information
|
206
|
+
- **Trustless Oracles**: Provide verified external data to blockchain applications
|
207
|
+
|
208
|
+
## 𧩠Project Structure
|
209
|
+
|
210
|
+
The Phala Cloud CLI is organized around core workflows:
|
211
|
+
|
212
|
+
1. **Authentication**: Connect to your Phala Cloud account
|
213
|
+
2. **TEEPod Info**: Fetch information about TEEPods (TEEPods are where your docker apps deploy to)
|
214
|
+
3. **Docker Management**: Build and manage Docker images for TEE
|
215
|
+
4. **TEE Simulation**: Local development environment
|
216
|
+
5. **Cloud Deployment**: Deploy to production and manage TEE Cloud deployments
|
217
|
+
|
218
|
+
## π Command Reference
|
219
|
+
|
220
|
+
The Phala Cloud CLI provides a comprehensive set of commands for managing your TEE deployments. Below is a detailed reference for each command category.
|
221
|
+
|
222
|
+
### Authentication Commands
|
223
|
+
|
224
|
+
Commands for managing authentication with the Phala Cloud API.
|
225
|
+
|
226
|
+
#### Login
|
227
|
+
|
228
|
+
```bash
|
229
|
+
phala auth login [options]
|
230
|
+
```
|
231
|
+
|
232
|
+
Set the API key for authentication with Phala Cloud. The API key is stored with encryption for enhanced security.
|
233
|
+
|
234
|
+
**Options:**
|
235
|
+
|
236
|
+
- `[api-key]`: Phala Cloud API key to set
|
237
|
+
|
238
|
+
**Example:**
|
239
|
+
```bash
|
240
|
+
phala auth login [your-phala-cloud-api-key]
|
241
|
+
```
|
242
|
+
|
243
|
+
#### Logout
|
244
|
+
|
245
|
+
```bash
|
246
|
+
phala auth logout
|
247
|
+
```
|
248
|
+
|
249
|
+
Remove the stored API key.
|
250
|
+
|
251
|
+
**Example:**
|
252
|
+
```bash
|
253
|
+
phala auth logout
|
254
|
+
```
|
255
|
+
|
256
|
+
#### Status
|
257
|
+
|
258
|
+
```bash
|
259
|
+
phala auth status [options]
|
260
|
+
```
|
261
|
+
|
262
|
+
Check your authentication status with Phala Cloud. Displays user information in a table format.
|
263
|
+
|
264
|
+
**Options:**
|
265
|
+
- `-j, --json`: Output in JSON format
|
266
|
+
|
267
|
+
**Example:**
|
268
|
+
```bash
|
269
|
+
phala auth status
|
270
|
+
phala auth status --json
|
271
|
+
```
|
272
|
+
|
273
|
+
### TEEPod Management Commands
|
274
|
+
|
275
|
+
> WTF is TEEPod?
|
276
|
+
> You can think of a TEEPod as the TEE server that the docker app with be hosted on. These TEEPods support published base images of the [Dstack Releases](https://github.com/Dstack-TEE/dstack/releases) which is the base image used to launch your Docker app. The Dstack base image is important as you can provide evidence to reproduce the RA Quote of your docker app deployment. More details on this later.
|
277
|
+
|
278
|
+
Commands for managing TEEPods on Phala Cloud.
|
279
|
+
|
280
|
+
#### List TEEPods
|
281
|
+
|
282
|
+
```bash
|
283
|
+
phala teepods list
|
284
|
+
```
|
285
|
+
|
286
|
+
List all available TEEPods on Phala Cloud.
|
287
|
+
|
288
|
+
**Example:**
|
289
|
+
```bash
|
290
|
+
phala teepods list
|
291
|
+
```
|
292
|
+
|
293
|
+
#### List TEEPod Images
|
294
|
+
|
295
|
+
```bash
|
296
|
+
phala teepods images [options]
|
297
|
+
```
|
298
|
+
|
299
|
+
List available images for a specific TEEPod.
|
300
|
+
|
301
|
+
**Options:**
|
302
|
+
- `-t, --teepod-id <teepodId>`: TEEPod ID (required)
|
303
|
+
|
304
|
+
**Example:**
|
305
|
+
```bash
|
306
|
+
phala teepods images --teepod-id 2
|
307
|
+
```
|
308
|
+
|
309
|
+
### Docker Management Commands
|
310
|
+
|
311
|
+
Commands for managing Docker images for TEE deployments.
|
312
|
+
|
313
|
+
#### Docker Login
|
314
|
+
|
315
|
+
```bash
|
316
|
+
phala docker login [options]
|
317
|
+
```
|
318
|
+
|
319
|
+
Login to Docker Hub to enable pushing and pulling images.
|
320
|
+
|
321
|
+
**Options:**
|
322
|
+
|
323
|
+
- `-u, --username <username>`: Docker Hub username (if not provided, you will be prompted)
|
324
|
+
- `-p, --password <password>`: Docker Hub password (if not provided, you will be prompted)
|
325
|
+
- `-r, --registry <registry>`: Docker registry URL (optional, defaults to Docker Hub)
|
326
|
+
|
327
|
+
**Example:**
|
328
|
+
```bash
|
329
|
+
phala docker login --username your-dockerhub-username
|
330
|
+
```
|
331
|
+
|
332
|
+
#### Build Docker Image
|
333
|
+
|
334
|
+
```bash
|
335
|
+
phala docker build [options]
|
336
|
+
```
|
337
|
+
|
338
|
+
Build a Docker image for your TEE application.
|
339
|
+
|
340
|
+
**Options:**
|
341
|
+
- `-i, --image <image>`: Image name (required)
|
342
|
+
- `-t, --tag <tag>`: Image tag (required)
|
343
|
+
- `-f, --file <file>`: Path to Dockerfile (defaults to 'Dockerfile')
|
344
|
+
|
345
|
+
**Example:**
|
346
|
+
```bash
|
347
|
+
phala docker build --image my-tee-app --tag v1.0.0 --file ./Dockerfile
|
348
|
+
```
|
349
|
+
|
350
|
+
#### Push Docker Image
|
351
|
+
|
352
|
+
```bash
|
353
|
+
phala docker push [options]
|
354
|
+
```
|
355
|
+
|
356
|
+
Push a Docker image to Docker Hub.
|
357
|
+
|
358
|
+
**Options:**
|
359
|
+
- `-i, --image <image>`: Image name (required)
|
360
|
+
- `-t, --tag <tag>`: Image tag (required)
|
361
|
+
|
362
|
+
**Example:**
|
363
|
+
```bash
|
364
|
+
phala docker push --image my-tee-app --tag v1.0.0
|
365
|
+
```
|
366
|
+
|
367
|
+
#### List Docker Image Tags
|
368
|
+
|
369
|
+
```bash
|
370
|
+
phala docker tags [options]
|
371
|
+
```
|
372
|
+
|
373
|
+
List all tags for a Docker image on Docker Hub.
|
374
|
+
|
375
|
+
**Options:**
|
376
|
+
- `-i, --image <image>`: Image name (required)
|
377
|
+
- `-j, --json`: Output in JSON format
|
378
|
+
|
379
|
+
**Example:**
|
380
|
+
```bash
|
381
|
+
phala docker tags --image my-tee-app
|
382
|
+
```
|
383
|
+
|
384
|
+
#### Build Docker Compose File
|
385
|
+
|
386
|
+
```bash
|
387
|
+
phala docker build-compose [options]
|
388
|
+
```
|
389
|
+
|
390
|
+
Build a Docker Compose file for your TEE application.
|
391
|
+
|
392
|
+
**Options:**
|
393
|
+
- `-i, --image <image>`: Image name (required)
|
394
|
+
- `-t, --tag <tag>`: Image tag (required)
|
395
|
+
- `-u, --username <username>`: Docker Hub username
|
396
|
+
- `-e, --env-file <envFile>`: Path to environment file
|
397
|
+
- `-v, --version <version>`: Template version to use (basic, eliza-v1, eliza-v2)
|
398
|
+
|
399
|
+
**Example:**
|
400
|
+
```bash
|
401
|
+
phala docker build-compose --image my-tee-app --tag v1.0.0 --env-file ./.env
|
402
|
+
```
|
403
|
+
|
404
|
+
#### Run Local Docker Compose
|
405
|
+
|
406
|
+
```bash
|
407
|
+
phala docker run [options]
|
408
|
+
```
|
409
|
+
|
410
|
+
Run a Docker Compose file locally for testing.
|
411
|
+
|
412
|
+
**Options:**
|
413
|
+
- `-c, --compose <compose>`: Path to Docker Compose file
|
414
|
+
- `-e, --env-file <envFile>`: Path to environment file
|
415
|
+
|
416
|
+
**Example:**
|
417
|
+
```bash
|
418
|
+
phala docker run --compose ./tee-compose.yaml --env-file ./.env
|
419
|
+
```
|
420
|
+
|
421
|
+
### TEE Simulator Commands
|
422
|
+
|
423
|
+
Commands for managing the local TEE simulator for development and testing.
|
424
|
+
|
425
|
+
#### Start Simulator
|
426
|
+
|
427
|
+
```bash
|
428
|
+
phala simulator start [options]
|
429
|
+
```
|
430
|
+
|
431
|
+
Start the TEE simulator locally for development and testing.
|
432
|
+
|
433
|
+
**Options:**
|
434
|
+
|
435
|
+
- `-i, --image <image>`: Simulator image (defaults to 'phalanetwork/tappd-simulator:latest')
|
436
|
+
|
437
|
+
**Example:**
|
438
|
+
```bash
|
439
|
+
phala simulator start
|
440
|
+
```
|
441
|
+
|
442
|
+
#### Stop Simulator
|
443
|
+
|
444
|
+
```bash
|
445
|
+
phala simulator stop
|
446
|
+
```
|
447
|
+
|
448
|
+
Stop the running TEE simulator.
|
449
|
+
|
450
|
+
**Example:**
|
451
|
+
```bash
|
452
|
+
phala simulator stop
|
453
|
+
```
|
454
|
+
|
455
|
+
### Configuration Commands
|
456
|
+
|
457
|
+
Commands for managing CLI configuration settings.
|
458
|
+
|
459
|
+
#### Get Configuration Value
|
460
|
+
|
461
|
+
```bash
|
462
|
+
phala config get <key>
|
463
|
+
```
|
464
|
+
|
465
|
+
Get a specific configuration value.
|
466
|
+
|
467
|
+
**Arguments:**
|
468
|
+
- `key`: Configuration key to retrieve
|
469
|
+
|
470
|
+
**Example:**
|
471
|
+
```bash
|
472
|
+
phala config get apiUrl
|
473
|
+
```
|
474
|
+
|
475
|
+
#### Set Configuration Value
|
476
|
+
|
477
|
+
```bash
|
478
|
+
phala config set <key> <value>
|
479
|
+
```
|
480
|
+
|
481
|
+
Set a configuration value.
|
482
|
+
|
483
|
+
**Arguments:**
|
484
|
+
- `key`: Configuration key to set
|
485
|
+
- `value`: Value to set (can be a string, number, boolean, or JSON)
|
486
|
+
|
487
|
+
**Example:**
|
488
|
+
```bash
|
489
|
+
phala config set defaultVcpu 2
|
490
|
+
phala config set apiUrl "https://custom-api.phala.cloud"
|
491
|
+
phala config set debug true
|
492
|
+
phala config set customConfig '{"key": "value", "nested": {"array": [1, 2, 3]}}'
|
493
|
+
```
|
494
|
+
|
495
|
+
#### List Configuration Values
|
496
|
+
|
497
|
+
```bash
|
498
|
+
phala config list [options]
|
499
|
+
```
|
500
|
+
|
501
|
+
List all configuration values.
|
502
|
+
|
503
|
+
**Options:**
|
504
|
+
- `-j, --json`: Output in JSON format
|
505
|
+
|
506
|
+
**Example:**
|
507
|
+
```bash
|
508
|
+
phala config list
|
509
|
+
phala config list --json
|
510
|
+
```
|
511
|
+
|
512
|
+
### Cloud Virtual Machine (CVM) Commands
|
513
|
+
|
514
|
+
Commands for managing Cloud Virtual Machines (CVMs) on Phala Cloud.
|
515
|
+
|
516
|
+
#### List CVMs
|
517
|
+
|
518
|
+
```bash
|
519
|
+
phala cvms list [options]
|
520
|
+
```
|
521
|
+
|
522
|
+
List all CVMs associated with your account.
|
523
|
+
|
524
|
+
**Options:**
|
525
|
+
- `-j, --json`: Output in JSON format
|
526
|
+
|
527
|
+
**Example:**
|
528
|
+
```bash
|
529
|
+
phala cvms list
|
530
|
+
```
|
531
|
+
|
532
|
+
#### Get CVM Details
|
533
|
+
|
534
|
+
```bash
|
535
|
+
phala cvms get [options] <app-id>
|
536
|
+
```
|
537
|
+
|
538
|
+
Get detailed information about a specific CVM.
|
539
|
+
|
540
|
+
**Arguments:**
|
541
|
+
- `app-id`: App ID of the CVM
|
542
|
+
|
543
|
+
**Options:**
|
544
|
+
- `-j, --json`: Output in JSON format
|
545
|
+
|
546
|
+
**Example:**
|
547
|
+
```bash
|
548
|
+
phala cvms get app_123456
|
549
|
+
```
|
550
|
+
|
551
|
+
#### Create CVM
|
552
|
+
|
553
|
+
```bash
|
554
|
+
phala cvms create [options]
|
555
|
+
```
|
556
|
+
|
557
|
+
Create a new CVM on Phala Cloud.
|
558
|
+
|
559
|
+
**Options:**
|
560
|
+
- `-n, --name <name>`: Name of the CVM (required)
|
561
|
+
- `-c, --compose <compose>`: Path to Docker Compose file (required)
|
562
|
+
- `--vcpu <vcpu>`: Number of vCPUs (default: 1)
|
563
|
+
- `--memory <memory>`: Memory in MB (default: 2048)
|
564
|
+
- `--disk-size <diskSize>`: Disk size in GB (default: 20)
|
565
|
+
- `--teepod-id <teepodId>`: TEEPod ID to launch the CVM to
|
566
|
+
- `--image <image>`: Version of dstack image to use (i.e. dstack-dev-0.3.5)
|
567
|
+
- `-e, --env-file <envFile>`: Environment variables in the form of KEY=VALUE
|
568
|
+
- `--skip-env`: Path to environment file (default: false)
|
569
|
+
- `--debug`: Enable debug mode
|
570
|
+
|
571
|
+
**Example:**
|
572
|
+
```bash
|
573
|
+
phala cvms create --name my-tee-app --compose ./docker-compose.yml --vcpu 2 --memory 4096 --diskSize 60 --teepod-id 3 --image dstack-dev-0.3.5 --env-file ./.env
|
574
|
+
```
|
575
|
+
|
576
|
+
#### Upgrade CVM
|
577
|
+
|
578
|
+
```bash
|
579
|
+
phala cvms upgrade [options] <app-id>
|
580
|
+
```
|
581
|
+
|
582
|
+
Upgrade a CVM to a new version.
|
583
|
+
|
584
|
+
**Arguments:**
|
585
|
+
- `app-id`: App ID of the CVM to upgrade
|
586
|
+
|
587
|
+
**Options:**
|
588
|
+
- `-c, --compose <compose>`: Path to new Docker Compose file
|
589
|
+
- `--env-file <envFile>`: Path to environment file
|
590
|
+
- `--debug`: Enable debug mode
|
591
|
+
|
592
|
+
**Example:**
|
593
|
+
```bash
|
594
|
+
phala cvms upgrade app_123456 --compose ./new-docker-compose.yml --env-file ./.env
|
595
|
+
```
|
596
|
+
|
597
|
+
#### Start CVM
|
598
|
+
|
599
|
+
```bash
|
600
|
+
phala cvms start <app-id>
|
601
|
+
```
|
602
|
+
|
603
|
+
Start a stopped CVM.
|
604
|
+
|
605
|
+
**Arguments:**
|
606
|
+
- `app-id`: App ID of the CVM to start
|
607
|
+
|
608
|
+
**Example:**
|
609
|
+
```bash
|
610
|
+
phala cvms start e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
611
|
+
```
|
612
|
+
|
613
|
+
#### Stop CVM
|
614
|
+
|
615
|
+
```bash
|
616
|
+
phala cvms stop <app-id>
|
617
|
+
```
|
618
|
+
|
619
|
+
Stop a running CVM.
|
620
|
+
|
621
|
+
**Arguments:**
|
622
|
+
- `app-id`: App ID of the CVM to stop
|
623
|
+
|
624
|
+
**Example:**
|
625
|
+
```bash
|
626
|
+
phala cvms stop e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
627
|
+
```
|
628
|
+
|
629
|
+
#### Restart CVM
|
630
|
+
|
631
|
+
```bash
|
632
|
+
phala cvms restart <app-id>
|
633
|
+
```
|
634
|
+
|
635
|
+
Restart a CVM.
|
636
|
+
|
637
|
+
**Arguments:**
|
638
|
+
- `app-id`: App ID of the CVM to restart
|
639
|
+
|
640
|
+
**Example:**
|
641
|
+
```bash
|
642
|
+
phala cvms restart e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
643
|
+
```
|
644
|
+
|
645
|
+
#### Delete CVM
|
646
|
+
|
647
|
+
```bash
|
648
|
+
phala cvms delete [options] <app-id>
|
649
|
+
```
|
650
|
+
|
651
|
+
Delete a CVM.
|
652
|
+
|
653
|
+
**Arguments:**
|
654
|
+
- `app-id`: App ID of the CVM to delete
|
655
|
+
|
656
|
+
**Options:**
|
657
|
+
- `-f, --force`: Skip confirmation prompt
|
658
|
+
|
659
|
+
**Example:**
|
660
|
+
```bash
|
661
|
+
phala cvms delete e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
662
|
+
phala cvms delete --force e15c1a29a9dfb522da528464a8d5ce40ac28039f
|
663
|
+
```
|
664
|
+
|
665
|
+
## π Sample Applications
|
666
|
+
|
667
|
+
Explore these example applications to understand different use cases for TEE deployment:
|
668
|
+
|
669
|
+
- **[Timelock Encryption](./examples/timelock-nts/)**: Encrypt messages that can only be decrypted after a specified time
|
670
|
+
- **[Light Client](./examples/lightclient/)**: A lightweight blockchain client implementation
|
671
|
+
- **[SSH Over TEE Proxy](./examples/ssh-over-tproxy/)**: Secure SSH tunneling through a TEE
|
672
|
+
- **[Web Shell](./examples/webshell/)**: Browser-based secure terminal
|
673
|
+
- **[Custom Domain](./examples/custom-domain/)**: Deploy with your own domain name
|
674
|
+
- **[Private Docker Image](./examples/private-docker-image-deployment/)**: Deploy using private Docker registries
|
675
|
+
|
676
|
+
## π οΈ Advanced Features
|
677
|
+
|
678
|
+
### Docker Compose Templates
|
679
|
+
|
680
|
+
> This feature is still being developed. Best to build your own docker-compose file for now.
|
681
|
+
|
682
|
+
(WIP) Choose from docker compose file for your application:
|
683
|
+
|
684
|
+
```bash
|
685
|
+
phala docker generate --image my-app --tag v1.0.0 --env
|
686
|
+
```
|
687
|
+
|
688
|
+
### Customizing Resource Allocation
|
689
|
+
|
690
|
+
Resize specific resources for your existing CVM:
|
691
|
+
|
692
|
+
```bash
|
693
|
+
phala cvms resize e15c1a29a9dfb522da528464a8d5ce40ac28039f --name resource-intensive-app --compose ./compose.yml \
|
694
|
+
--vcpu 4 --memory 8192 --disk-size 50 -r true -y
|
695
|
+
```
|
696
|
+
|
697
|
+
### Environment Variables Management
|
698
|
+
|
699
|
+
```bash
|
700
|
+
# Using env file
|
701
|
+
phala cvms create --name env-app --compose ./compose.yml --env-file ./.env
|
702
|
+
```
|
703
|
+
|
704
|
+
## π Security
|
705
|
+
|
706
|
+
The TEE Cloud CLI employs several security measures:
|
707
|
+
|
708
|
+
1. **Encrypted Credentials**: API keys and Docker credentials are stored with encryption using a machine-specific key
|
709
|
+
2. **Restricted Permissions**: All credential files are stored with 0600 permissions (user-only access)
|
710
|
+
3. **No Validation Storage**: API keys are not validated during login, preventing unnecessary transmission
|
711
|
+
4. **Local Storage**: All credentials are stored locally in the `~/.phala-cloud/` directory
|
712
|
+
|
713
|
+
## π Troubleshooting
|
714
|
+
|
715
|
+
Common issues and solutions:
|
716
|
+
|
717
|
+
1. **Docker Build Fails**
|
718
|
+
- Verify Docker daemon is running
|
719
|
+
- Check Dockerfile path
|
720
|
+
- Ensure proper permissions
|
721
|
+
|
722
|
+
2. **Simulator Issues**
|
723
|
+
- Check if port 8090 is available
|
724
|
+
- Verify Docker permissions
|
725
|
+
|
726
|
+
3. **Cloud Deployment Fails**
|
727
|
+
- Validate API key
|
728
|
+
- Confirm image exists on Docker Hub
|
729
|
+
- Check environment variables
|
730
|
+
|
731
|
+
For detailed help:
|
732
|
+
```bash
|
733
|
+
phala --help
|
734
|
+
phala <command> --help
|
735
|
+
```
|
736
|
+
|
737
|
+
## π₯ Community & Support
|
738
|
+
|
739
|
+
- [Phala Network Discord](https://discord.gg/phala-network)
|
740
|
+
- [GitHub Issues](https://github.com/Phala-Network/phala-cloud-cli/issues)
|
741
|
+
- [Phala Documentation](https://docs.phala.network)
|
742
|
+
|
743
|
+
## π License
|
744
|
+
|
745
|
+
Apache 2.0
|
746
|
+
|
747
|
+
## π€ Contributing
|
748
|
+
|
749
|
+
To contribute or run in development mode:
|
750
|
+
```bash
|
751
|
+
bun run src/index.ts
|
752
|
+
```
|
753
|
+
|
754
|
+
The project uses:
|
755
|
+
|
756
|
+
- [Dstack-TEE: Dstack](https://github.com/Dstack-TEE/dstack)
|
757
|
+
- Bun for runtime and package management
|
758
|
+
- TypeScript for type safety
|
759
|
+
- Commander.js for CLI interface
|
760
|
+
- Zod for runtime validation
|
761
|
+
|
762
|
+
We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
|