Deploy on Alibaba Cloud
Deploy Hermes Agent on Alibaba Cloud ECS for a reliable, scalable solution with low latency for users in China and Asia-Pacific regions.
Prerequisites
Section titled “Prerequisites”- Alibaba Cloud account
- Basic knowledge of Linux server management
- (Optional) Domain name for HTTPS setup
Quick Start
Section titled “Quick Start”1. Create ECS Instance
Section titled “1. Create ECS Instance”- Log in to Alibaba Cloud Console
- Navigate to Elastic Compute Service (ECS)
- Click Create Instance
Recommended Configuration:
| Component | Recommendation |
|---|---|
| Region | Choose closest to your users (e.g., Shanghai, Beijing, Singapore) |
| Instance Type | ecs.t6-c1m2.large or higher (2 vCPU, 4GB RAM) |
| Operating System | Ubuntu 22.04 LTS 64-bit |
| Storage | 40GB SSD minimum |
| Network | VPC with public IP |
2. Security Group Configuration
Section titled “2. Security Group Configuration”Open the following ports in your security group:
| Port | Protocol | Purpose |
|---|---|---|
| 22 | TCP | SSH access |
| 80 | TCP | HTTP (for web UI) |
| 443 | TCP | HTTPS (for web UI) |
| 3000 | TCP | Hermes default port (optional) |
3. Connect and Install
Section titled “3. Connect and Install”# SSH into your instancessh root@<your-ecs-public-ip>
# Update systemapt update && apt upgrade -y
# Install dependenciesapt install -y curl git python3 python3-pip python3-venv
# Install Hermes Agentcurl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
# Source the environmentsource ~/.bashrc4. Configure Hermes
Section titled “4. Configure Hermes”# Set up your API keyshermes setup
# Or manually edit confignano ~/.hermes/config.yamlExample configuration:
model: provider: openrouter model: anthropic/claude-3.5-sonnet api_key: ${OPENROUTER_API_KEY}
messaging: telegram: enabled: true bot_token: ${TELEGRAM_BOT_TOKEN}5. Run Hermes
Section titled “5. Run Hermes”# Start in foreground (for testing)hermes chat
# Or start as a servicehermes gateway install --systemsystemctl start hermes-gatewaysystemctl enable hermes-gatewayUsing Alibaba Cloud Marketplace (Coming Soon)
Section titled “Using Alibaba Cloud Marketplace (Coming Soon)”We are working with Alibaba Cloud to provide a pre-configured marketplace image. This will include:
- Pre-installed Hermes Agent
- Optimized system configuration
- Pre-configured security settings
- One-click deployment
Advanced Configuration
Section titled “Advanced Configuration”Using Alibaba Cloud RDS for Memory Storage
Section titled “Using Alibaba Cloud RDS for Memory Storage”For production deployments, consider using Alibaba Cloud RDS PostgreSQL for persistent memory:
memory: provider: postgres connection_string: ${RDS_CONNECTION_STRING}Object Storage for File Handling
Section titled “Object Storage for File Handling”Configure OSS (Object Storage Service) for large file handling:
storage: backend: oss bucket: your-bucket-name region: oss-cn-shanghaiLoad Balancer Setup
Section titled “Load Balancer Setup”For high-availability deployments:
- Create multiple ECS instances
- Set up Alibaba Cloud SLB (Server Load Balancer)
- Configure health checks
- Distribute traffic across instances
Monitoring with Alibaba Cloud
Section titled “Monitoring with Alibaba Cloud”CloudMonitor Integration
Section titled “CloudMonitor Integration”# Install CloudMonitor agentwget http://update2.aegis.aliyun.com/download/cms_install.shchmod +x cms_install.sh./cms_install.shSet up alerts for:
- CPU usage > 80%
- Memory usage > 85%
- Disk usage > 90%
- Network anomalies
Log Service (SLS)
Section titled “Log Service (SLS)”# Configure Hermes to output structured logs# Edit ~/.hermes/config.yamllogging: format: json level: info output: /var/log/hermes/app.logCost Optimization
Section titled “Cost Optimization”Spot Instances
Section titled “Spot Instances”For non-critical workloads, use Spot instances to save up to 90%:
- Create a Spot instance in ECS console
- Set appropriate bid price
- Use auto-scaling groups for resilience
Auto-Scaling
Section titled “Auto-Scaling”Configure auto-scaling to handle varying loads:
# Create scaling groupaliyun ess CreateScalingGroup \ --RegionId cn-shanghai \ --MinSize 1 \ --MaxSize 5 \ --ScalingGroupName hermes-agent-groupSecurity Best Practices
Section titled “Security Best Practices”1. Use RAM Roles
Section titled “1. Use RAM Roles”Instead of AccessKeys, use RAM roles for ECS instances:
# Attach RAM role to ECS instancealiyun ecs AttachInstanceRamRole \ --RegionId cn-shanghai \ --InstanceIds '["i-xxxxxxxxx"]' \ --RamRoleName HermesAgentRole2. Enable Cloud Firewall
Section titled “2. Enable Cloud Firewall”Configure security groups strictly:
# Only allow specific IPs for SSHaliyun ecs AuthorizeSecurityGroup \ --RegionId cn-shanghai \ --SecurityGroupId sg-xxxxxxxxx \ --IpProtocol tcp \ --PortRange 22/22 \ --SourceCidrIp YOUR_OFFICE_IP/323. Regular Backups
Section titled “3. Regular Backups”Enable automatic snapshots:
aliyun ecs CreateAutoSnapshotPolicy \ --RegionId cn-shanghai \ --TimePoints "[0, 12]" \ --RepeatWeekdays "[1, 4]" \ --RetentionDays 7Troubleshooting
Section titled “Troubleshooting”Connection Issues
Section titled “Connection Issues”# Check security group rulesaliyun ecs DescribeSecurityGroupAttribute \ --RegionId cn-shanghai \ --SecurityGroupId sg-xxxxxxxxx
# Verify network connectivityping <your-ecs-ip>telnet <your-ecs-ip> 22Performance Issues
Section titled “Performance Issues”# Monitor resource usagetopfree -hdf -h
# Check Hermes logsjournalctl -u hermes-gateway -fSupport
Section titled “Support”For Alibaba Cloud specific issues:
For Hermes Agent issues: