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