{"id":47936676,"url":"https://github.com/tangle-network/phala-tee-deploy-rs","last_synced_at":"2026-04-04T07:44:34.776Z","repository":{"id":280235543,"uuid":"941369873","full_name":"tangle-network/phala-tee-deploy-rs","owner":"tangle-network","description":"Deploy with docker compose into Phala's TEE cloud","archived":false,"fork":false,"pushed_at":"2026-02-12T09:03:30.000Z","size":265,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-04T07:44:30.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tangle-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-02T05:48:24.000Z","updated_at":"2026-02-12T09:03:34.000Z","dependencies_parsed_at":"2025-03-02T07:22:21.993Z","dependency_job_id":"481ea8e1-64df-4fda-806b-5facb660bc78","html_url":"https://github.com/tangle-network/phala-tee-deploy-rs","commit_stats":null,"previous_names":["tangle-network/phala-tee-deploy-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tangle-network/phala-tee-deploy-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fphala-tee-deploy-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fphala-tee-deploy-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fphala-tee-deploy-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fphala-tee-deploy-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangle-network","download_url":"https://codeload.github.com/tangle-network/phala-tee-deploy-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fphala-tee-deploy-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T07:44:34.261Z","updated_at":"2026-04-04T07:44:34.758Z","avatar_url":"https://github.com/tangle-network.png","language":"Rust","readme":"# Phala TEE Deployment Toolkit\n\nA Rust library for deploying Docker Compose applications to the Phala TEE (Trusted Execution Environment) Cloud with secure environment variable handling.\n\n## Overview\n\nPhala TEE Cloud runs applications in hardware-enforced isolated enclaves, providing enhanced security guarantees. This toolkit simplifies deployments to the Phala Cloud with:\n\n- **Environment Variable Encryption** - Secure handling of sensitive data\n- **Docker Compose Support** - Deploy multi-container applications\n- **ELIZA Deployment** - Simplified deployment of ELIZA chatbots\n- **Flexible Deployment Patterns** - From simple one-step to advanced privilege separation\n\n## Getting Started\n\n### Prerequisites\n\n- Phala Cloud account with API access\n- An API key from your Phala account\n\n### Environment Setup\n\nCreate a `.env` file with:\n\n```\nPHALA_CLOUD_API_KEY=your-api-key\n```\n\n## Deployment APIs\n\n### High-Level API with TeeDeployer (Recommended)\n\nThe `TeeDeployer` provides a streamlined interface for deploying applications to Phala TEE Cloud.\n\n```rust\nuse phala_tee_deploy_rs::{TeeDeployerBuilder};\nuse std::collections::HashMap;\n\n// Create deployer with builder pattern\nlet mut deployer = TeeDeployerBuilder::new()\n    .with_api_key(std::env::var(\"PHALA_CLOUD_API_KEY\")?)\n    .build()?;\n\n// Discover available TEEPod\ndeployer.discover_teepod().await?;\n```\n\n### Deployment Options\n\n#### 1. Deploy from Docker Compose YAML\n\n```rust\n// Deploy from YAML string\nlet yaml = r#\"\nversion: '3'\nservices:\n  app:\n    image: nginx:latest\n    ports:\n      - \"80:80\"\n\"#;\n\nlet mut env_vars = HashMap::new();\nenv_vars.insert(\"PORT\".to_string(), \"80\".to_string());\n\nlet result = deployer.deploy_compose_from_string(\n    yaml,\n    \"my-app\",\n    env_vars,\n    Some(1),    // vCPUs\n    Some(1024), // Memory (MB)\n    Some(10),   // Disk size (GB)\n).await?;\n\n// Access the response\nprintln!(\"Deployment ID: {}\", result.id);\nprintln!(\"Status: {}\", result.status);\n```\n\n#### 2. Deploy a Simple Service\n\n```rust\n// Deploy a simple service with just an image\nlet mut env_vars = HashMap::new();\nenv_vars.insert(\"PORT\".to_string(), \"3000\".to_string());\n\nlet result = deployer.deploy_simple_service(\n    \"nginx:latest\",                  // Docker image\n    \"web\",                           // Service name\n    \"my-webapp\",                     // App name\n    env_vars,                        // Environment variables\n    Some(vec![\"80:80\".to_string()]), // Port mappings\n    None,                            // Volumes\n    None,                            // Command\n    None,                            // vCPUs (default)\n    None,                            // Memory (default)\n    None,                            // Disk size (default)\n).await?;\n```\n\n#### 3. Deploy ELIZA (Two-Step Process)\n\n```rust\n// Step 1: Provision ELIZA to get app_id and encryption key\nlet deployment_name = format!(\"eliza-demo-{}\", uuid::Uuid::new_v4());\nlet (app_id, app_env_encrypt_pubkey) = deployer\n    .provision_eliza(\n        deployment_name.clone(),\n        character_file,               // ELIZA character configuration\n        vec![\"OPENAI_API_KEY\".to_string()], // Environment variables to include\n        \"phalanetwork/eliza:v0.1.8-alpha.1\".to_string(),\n    )\n    .await?;\n\n// Step 2: Encrypt environment variables\nlet mut env_vars = Vec::new();\nenv_vars.push((\"CHARACTER_DATA\".to_string(), character_file));\nif let Ok(key) = std::env::var(\"OPENAI_API_KEY\") {\n    env_vars.push((\"OPENAI_API_KEY\".to_string(), key));\n}\nlet encrypted_env = Encryptor::encrypt_env_vars(\u0026env_vars, \u0026app_env_encrypt_pubkey)?;\n\n// Step 3: Create VM with encrypted environment variables\nlet result = deployer.create_eliza_vm(\u0026app_id, \u0026encrypted_env).await?;\n```\n\n### Getting Deployment Information\n\n#### Network Information\n\n```rust\n// Get network info for a deployed application\nlet network_info = deployer.get_network_info(\u0026app_id).await?;\n\nif network_info.is_online {\n    println!(\"Application URL: {}\", network_info.public_urls.app);\n    println!(\"Instance URL: {}\", network_info.public_urls.instance);\n}\n```\n\n#### System Statistics\n\n```rust\n// Get system statistics for a deployed application\nlet stats = deployer.get_system_stats(\u0026app_id).await?;\n\nprintln!(\"OS: {} {}\", stats.sysinfo.os_name, stats.sysinfo.os_version);\nprintln!(\"Memory: {:.2} GB used / {:.2} GB total\",\n    stats.sysinfo.used_memory as f64 / 1024.0 / 1024.0 / 1024.0,\n    stats.sysinfo.total_memory as f64 / 1024.0 / 1024.0 / 1024.0\n);\n```\n\n### Updating Deployments\n\n```rust\n// Update an existing deployment\nlet app_id = format!(\"app_{}\", deployment_id);\nlet mut new_env_vars = HashMap::new();\nnew_env_vars.insert(\"DEBUG\".to_string(), \"true\".to_string());\n\nlet update_result = deployer.update_deployment(\n    \u0026app_id,\n    Some(new_docker_compose),  // New Docker Compose configuration (optional)\n    Some(new_env_vars)         // New environment variables (optional)\n).await?;\n```\n\n## Advanced Deployment Patterns\n\nFor more advanced use cases such as privilege separation (where operators handle infrastructure while users manage secrets), see the examples directory or refer to the API documentation.\n\n## Examples\n\nCheck out the `examples` directory for complete working examples:\n\n- `simple_deployment.rs` - Basic deployment example\n- `eliza_deployment.rs` - ELIZA chatbot deployment example\n- `advanced_deployment.rs` - Step-by-step deployment with privilege separation\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fphala-tee-deploy-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangle-network%2Fphala-tee-deploy-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fphala-tee-deploy-rs/lists"}