This folder contains the infrastructure as code for deploying a custom conversational agent. The infrastructure deploys a scalable system on DigitalOcean that includes agent instances, a proxy router, and a Redis database, managed using Pulumi.
- Pulumi CLI
- Node.js (v14 or later)
- DigitalOcean Account
- Docker (for local development)
- Set up your Pulumi stack:
pulumi stack init dev
- Configure the required secrets:
pulumi config set --secret digitalocean:token <YOUR_DIGITAL_OCEAN_API_TOKEN>
pulumi config set --secret agoraAppId <YOUR_AGORA_APP_ID>
pulumi config set --secret agoraAppCert <YOUR_AGORA_APP_CERT>
pulumi config set --secret openaiApiKey <YOUR_OPENAI_API_KEY>
pulumi config set systemInstruction "Your custom system prompt here..."
Add your SSH key fingerprint to the index.ts
file:
const sshKeys = [''] // Replace with your DO SSH key fingerprint
- Deploy using Pulumi:
pulumi preview # Review changes
pulumi up # Deploy infrastructure
- Preview the changes:
pulumi preview
- Deploy the infrastructure using DigitalOcean:
pulumi up
To destroy the infrastructure:
pulumi destroy
After deployment, you can access important information using:
pulumi stack output
This will show:
- Redis URI
- Agent IP addresses
- Proxy Router IP address
The infrastructure code is in index.ts
and includes:
- Container registry setup
- Agent droplet creation
- Proxy router configuration
- Network and security settings
The infrastructure consists of:
- Container Registry: Hosts Docker images for the proxy router and realtime agents
- Multiple Agent Instances (3 droplets):
- Handles OpenAI API communication
- Runs on c-4 instances (4 vCPUs, 8GB RAM)
- Containerized using Docker
- Proxy Router:
- Load balances requests across agent instances
- Runs on s-1vcpu-1gb instance
- Manages request distribution and backend mapping
- Redis Database:
- Redis 7 cluster
- Single node deployment (db-s-1vcpu-1gb)
- Maintains session state and routing information
- Accessible only within VPC
- VPC (172.16.0.0/24):
- Securely connects all services
- Located in NYC1 region
- Firewall Rules:
- HTTP API access (port 8080)
- Internal VPC communication
- Agora RTC UDP ports (1024-65535)
- Restricted Redis access
- Managed outbound traffic
- Remember to add your SSH keys to the droplet configurations
- All sensitive information should be stored as Pulumi secrets
- The VPC isolates the infrastructure components
- Firewall rules are configured for minimum required access
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request