ให้ AI Agent ย้าย Infrastructure ทั้งระบบให้ — Mac Mini → Cloud ใน 3-4 ชั่วโมง คนทำแค่ 3 อย่าง

ถ้าคุณต้องย้าย AI infrastructure ทั้งระบบ — servers, agents, cron jobs, API keys, scripts — ปกติมันคือสัปดาห์ของ DevOps work. แต่ถ้าให้ AI agent ทำแทน คุณต้องทำเองแค่ไหน?

คำตอบ: 3 อย่าง

สิ่งที่ต้องย้าย

  • OpenClaw gateway + config
  • AI agents 4 ตัว (identity, memory, workspace)
  • Cron jobs 17 ตัว
  • 70+ automation scripts ที่เขียนสำหรับ macOS
  • API keys ทั้งหมด

Tools ที่ใช้

  • Claude agent ผ่าน OpenClaw (Oracle session)
  • Hetzner Cloud (Helsinki, CX22: 4 vCPU, 8GB RAM, Ubuntu 24.04)
  • Telegram เป็น control interface ทั้งหมด

Agent ทำอะไรเองได้บ้าง

  1. Research + เปรียบเทียบ VPS providers 8 เจ้า (Hetzner, DigitalOcean, Oracle Cloud, Vultr ฯลฯ) พร้อมราคา
  2. Provision server ผ่าน Hetzner API
  3. Bootstrap: Ubuntu 24.04, Node.js 22 LTS, Chromium, Thai fonts
  4. ย้าย OpenClaw gateway + regenerate config
  5. Setup systemd service + UFW firewall rules
  6. Migrate agents ทีละตัว — copy identity, memory, workspace files
  7. Clone + re-schedule cron jobs 17 ตัว
  8. Fix Mac→Linux path issues อัตโนมัติ (เช่น /System/Library/Fonts//usr/share/fonts/)
  9. Debug gateway pairing issue
  10. ติดตั้ง features ใหม่ระหว่างย้าย: persistent memory + stealth browser MCP

Security Shim — Technical Detail

macOS scripts ส่วนใหญ่ใช้ security find-generic-password -s <service> -w เพื่อดึง API keys จาก Keychain บน Linux ไม่มี Keychain จึงสร้าง shim ที่:

  • Intercept security command
  • Map service name → environment variable หรือ secrets file
  • Return value เหมือน macOS Keychain ทุกประการ

ผลคือ scripts เดิม 70+ ตัวทำงานได้โดยไม่ต้อง refactor แม้แต่บรรทัดเดียว

3 อย่างที่คนต้องทำเอง (ทั้งหมดผ่านมือถือ)

  1. Login ให้ตอน browser automation เจอ login page (X, Google)
  2. เลือก server plan ใน Hetzner UI — Angular SPA ที่ agent กด next ไม่ได้
  3. ตอบ yes/no ก่อน agent ทำ destructive action (เช่น overwrite configs)

Gateway Pairing Issue

จุดที่ใช้เวลานานสุด: หลัง migrate แล้ว gateway ขึ้น pairing required ทั้งที่ service รันปกติ สาเหตุคือ bootstrap token ใน config ผูกกับ machine เดิม agent ต้องหา undocumented re-pairing flow เอง → แก้ได้ใน ~45 นาที

ต้นทุน

Hetzner CX22 (Helsinki): $12.59/เดือน (~450 บาท)

บทสรุป

Agent ไม่ได้ perfect — มีรอบนึงที่ยอมรับเองว่า “research ผิด แนะนำ plugin ที่ไม่มีจริง” แต่พอบอกให้ไป research ใหม่ → เจอวิธีแก้จริงใน 2 นาที

นั่นคือสิ่งที่เปลี่ยนไปใน DevOps ยุคนี้ — ไม่ใช่ automation ที่สมบูรณ์แบบ แต่คือ loop ของ human oversight + agent execution ที่เร็วกว่าทำเองมาก

ใช้เวลาทั้งหมด 3-4 ชั่วโมง รวม debug + install features ใหม่ ได้ AI agents 4 ตัวทำงาน 24/7 บน cloud ค่าใช้จ่าย $12.59/เดือน

Leave a Comment