๐ฅ๏ธ Server Deployment
๐ค Who it's for: Ops / DevOps / teams hosting YingClaw long-term
โฑ๏ธ Read time: ~8 minutes
๐ก In one line: Keep YingClaw resident on a server, working for you 7ร24.
Deploy YingClaw to a remote server for 24/7 always-on operation. Combined with scheduled tasks and message channels, build an always-available AI assistant.
Deployment Optionsโ
| Method | Best For | Ops Overhead |
|---|---|---|
| ๐ณ Docker | Standardized container environments | Low |
| ๐ฆ Direct Install | Personal VPS, bare metal | Medium |
| โ๏ธ Cloud Service | Managed cloud services | Lowest |
Environment Preparationโ
Minimum Server Specsโ
| Item | Minimum | Recommended |
|---|---|---|
| CPU | 1 core | 2+ cores |
| Memory | 2GB | 4GB+ |
| Disk | 10GB | 20GB SSD |
| OS | Ubuntu 20.04+ / Debian 11+ | Ubuntu 22.04 LTS |
| Node.js | 18+ | 20 LTS |
| Network | Public internet (for API) | Stable bandwidth |
Prerequisitesโ
# Ubuntu / Debian
apt update
apt install -y nodejs npm git curl
# Verify versions
node -v # >= 18
npm -v
Docker Deployment (Recommended)โ
1. Pull Imageโ
docker pull yingclaw/yingclaw:latest
2. Create docker-compose.ymlโ
version: '3.8'
services:
yingclaw:
image: yingclaw/yingclaw:latest
container_name: yingclaw
restart: unless-stopped
volumes:
- ./workspace:/home/yingclaw/workspace
- ./config:/home/yingclaw/config
- ./.env:/home/yingclaw/.env
environment:
- TZ=Asia/Shanghai
ports:
- '3000:3000'
3. Startโ
docker-compose up -d
4. Verifyโ
docker logs yingclaw
A successful startup log means deployment is complete.
Direct Deploymentโ
1. Global Installโ
npm install -g yingclaw
2. Create Working Directoryโ
mkdir -p /opt/yingclaw
cd /opt/yingclaw
3. Configure Environmentโ
Create /opt/yingclaw/.env:
# AI Model API Key
API_KEY=your_api_key_here
# Optional: Messaging channel keys
WECHAT_ENABLED=true
# Optional: Push notifications
PUSHOVER_TOKEN=your_pushover_token
PUSHOVER_USER_KEY=your_pushover_user_key
4. Use Process Managerโ
PM2 is recommended for keeping the service alive:
npm install -g pm2
pm2 start yingclaw -- --daemon --log-dir /opt/yingclaw/logs
pm2 save
pm2 startup # Auto-start on boot
| Command | Description |
|---|---|
pm2 status | View running status |
pm2 logs yingclaw | View logs |
pm2 restart yingclaw | Restart service |
pm2 stop yingclaw | Stop service |
Operationsโ
Log Managementโ
# View real-time logs
tail -f /opt/yingclaw/logs/yingclaw.log
# Log rotation (keep last 7 days)
pm2 install pm2-logrotate
Backup Strategyโ
| Backup Target | Path | Recommended Frequency |
|---|---|---|
| Memory data | workspace/MEMORY.md | Daily |
| Config files | config/ | On config change |
| Env vars | .env | On config change |
# Quick backup
tar -czf backup-$(date +%Y%m%d).tar.gz /opt/yingclaw/workspace /opt/yingclaw/config /opt/yingclaw/.env
Health Checkโ
# Process check
pm2 status
# Port check
curl -s http://localhost:3000/health
# Disk check
df -h /opt/yingclaw
Security Hardeningโ
- ๐ Run YingClaw under a non-root user
- ๐ Store API keys in
.envwith permissions set to600 - ๐ก๏ธ Configure firewall, only expose necessary ports
- ๐ Enable operation logging, audit periodically
- โฐ Set timeout limits on scheduled tasks
# Create dedicated user
useradd -m -s /bin/bash yingclaw
# Set file permissions
chown -R yingclaw:yingclaw /opt/yingclaw
chmod 600 /opt/yingclaw/.env
Upgradesโ
# Docker
docker pull yingclaw/yingclaw:latest
docker-compose down && docker-compose up -d
# npm
npm update -g yingclaw
pm2 restart yingclaw
Next Stepsโ
- ๐ Learn about Scheduled Tasks for automation
- ๐ฌ Connect to WeChat Channel
- ๐ Return to Documentation Center