pull/818/head
Kye Gomez 7 months ago
parent 63ad67ee6f
commit 16af2bc1b9

@ -1,171 +1,68 @@
# Deploying Swarms on Phala Network # 🔐 Swarms x Phala Deployment Guide
## Overview This guide will walk you through deploying your project to Phala's Trusted Execution Environment (TEE).
!!! abstract "What you'll learn" ## 📋 Prerequisites
Deploy Swarms agents on Phala Network's decentralized cloud infrastructure, leveraging secure and private execution environments through Trusted Execution Environments (TEE).
## Prerequisites - Docker installed on your system
- A DockerHub account
- Access to Phala Cloud dashboard
!!! check "Before you begin" ## 🛡️ TEE Overview
Make sure you have:
For detailed instructions about Trusted Execution Environment setup, please refer to our [TEE Documentation](./tee/README.md).
- [:simple-docker: Docker](https://www.docker.com/get-started){ .md-button } installed on your system ## 🚀 Deployment Steps
- [:simple-docker: DockerHub](https://hub.docker.com/){ .md-button } account ### 1. Build and Publish Docker Image
- [:octicons-terminal-24: tee-cloud-cli](https://github.com/Phala-Network/tee-cloud-cli){ .md-button } installed
- [:simple-phala: Phala Network](https://phala.network){ .md-button } account with PHA tokens
## Quick Start Guide
=== "1. Build Docker Image"
```bash ```bash
# Build the Docker image
docker compose build -t <your-dockerhub-username>/swarm-agent-node:latest docker compose build -t <your-dockerhub-username>/swarm-agent-node:latest
```
=== "2. Push to DockerHub" # Push to DockerHub
```bash
docker push <your-dockerhub-username>/swarm-agent-node:latest docker push <your-dockerhub-username>/swarm-agent-node:latest
``` ```
=== "3. Deploy to Phala" ### 2. Deploy to Phala Cloud
```bash
tee-cloud-cli deploy --image <your-dockerhub-username>/swarm-agent-node:latest
```
## Deployment Methods Choose one of these deployment methods:
- Use [tee-cloud-cli](https://github.com/Phala-Network/tee-cloud-cli) (Recommended)
- Deploy manually via the [Phala Cloud Dashboard](https://cloud.phala.network/)
### Using tee-cloud-cli (Recommended) ### 3. Verify TEE Attestation
!!! tip "Recommended Method" Visit the [TEE Attestation Explorer](https://proof.t16z.com/) to check and verify your agent's TEE proof.
This is the preferred way to deploy your Swarms agents.
1. Install the CLI: ## 📝 Docker Configuration
```bash
npm install -g @phala/tee-cloud-cli
```
2. Configure credentials:
```bash
tee-cloud-cli config set --key YOUR_KEY
```
3. Deploy your agent:
```bash
tee-cloud-cli deploy --image your-image --name your-agent-name
```
### Using Phala Dashboard Below is a sample Docker Compose configuration for your Swarms agent:
1. Visit [:material-web: Phala Cloud Dashboard](https://cloud.phala.network/)
2. Connect your wallet
3. Navigate to "Deploy" section
4. Configure your deployment
5. Click "Deploy"
## Configuration
### Environment Variables
!!! example "Configuration Example"
```yaml ```yaml
SWARMS_API_KEY: "your-api-key" services:
PHALA_ENDPOINT: "wss://api.phala.network/ws" swarms-agent-server:
TEE_WORKER_ENDPOINT: "http://localhost:8000" image: swarms-agent-node:latest
``` platform: linux/amd64
volumes:
### Resource Requirements - /var/run/tappd.sock:/var/run/tappd.sock
- swarms:/app
| Resource | Recommended | restart: always
|----------|------------| ports:
| CPU | 2-4 cores | - 8000:8000
| Memory | 4-8 GB | command: # Sample MCP Server
| Storage | 20-50 GB | - /bin/sh
- -c
## Monitoring - |
cd /app/mcp_example
### Viewing Logs python mcp_test.py
volumes:
=== "Using Dashboard" swarms:
Access logs through the Phala Dashboard interface
=== "Using CLI"
```bash
tee-cloud-cli logs --name your-agent-name
```
### Health Checks
```bash
tee-cloud-cli status --name your-agent-name
``` ```
## Best Practices ## 📚 Additional Resources
!!! success "Recommended Practices"
1. **Version Control**: Tag Docker images with specific versions
2. **Security**: Keep credentials out of Docker images
3. **Resource Management**: Monitor and adjust resource usage
4. **Backup**: Maintain regular backups
5. **Testing**: Use staging environment first
## Troubleshooting
??? question "Deployment Failures"
- Verify Docker image accessibility
- Check resource allocations
- Validate environment variables
??? question "Connection Issues"
- Verify network connectivity
- Check Phala endpoint status
- Validate API credentials
??? question "Performance Problems"
- Monitor resource usage
- Adjust allocation if needed
- Check for memory leaks
## FAQ
??? question "What is TEE?"
TEE (Trusted Execution Environment) is a secure area of a processor that guarantees code and data loaded inside is protected with respect to confidentiality and integrity.
??? question "How much does it cost to deploy?"
Deployment costs vary based on resource usage and current PHA token prices. Check the [Phala pricing calculator](https://cloud.phala.network) for current rates.
??? question "Can I use custom Docker images?"
Yes, you can use any Docker image that's compatible with the Phala Network requirements and accessible on DockerHub.
??? question "How do I scale my deployment?"
You can scale by adjusting resource allocations or deploying multiple instances through the dashboard or CLI.
## Support & Community For more comprehensive documentation and examples, visit our [Official Documentation](https://docs.swarms.world/en/latest/).
Need help? Join our communities: ---
[:simple-discord: Phala Discord](https://discord.gg/phala){ .md-button } > **Note**: Make sure to replace `<your-dockerhub-username>` with your actual DockerHub username when building and pushing the image.
[:simple-discord: Swarms Discord](https://discord.gg/swarms){ .md-button }
[:material-book: Phala Docs](https://docs.phala.network){ .md-button }
[:octicons-mark-github-16: GitHub Issues](https://github.com/kyegomez/swarms/issues){ .md-button }
Loading…
Cancel
Save