Skip to main content

๐Ÿ–ฅ๏ธ 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โ€‹

MethodBest ForOps Overhead
๐Ÿณ DockerStandardized container environmentsLow
๐Ÿ“ฆ Direct InstallPersonal VPS, bare metalMedium
โ˜๏ธ Cloud ServiceManaged cloud servicesLowest

Environment Preparationโ€‹

Minimum Server Specsโ€‹

ItemMinimumRecommended
CPU1 core2+ cores
Memory2GB4GB+
Disk10GB20GB SSD
OSUbuntu 20.04+ / Debian 11+Ubuntu 22.04 LTS
Node.js18+20 LTS
NetworkPublic internet (for API)Stable bandwidth

Prerequisitesโ€‹

# Ubuntu / Debian
apt update
apt install -y nodejs npm git curl

# Verify versions
node -v # >= 18
npm -v

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
CommandDescription
pm2 statusView running status
pm2 logs yingclawView logs
pm2 restart yingclawRestart service
pm2 stop yingclawStop 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 TargetPathRecommended Frequency
Memory dataworkspace/MEMORY.mdDaily
Config filesconfig/On config change
Env vars.envOn 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 .env with permissions set to 600
  • ๐Ÿ›ก๏ธ 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โ€‹