Bỏ qua đến nội dung chính

Tương lai: thêm VPS làm node thứ 3

Setup PC ↔ Laptop hiện tại có limitation:

  • Cần ≥1 peer online để sync — nếu cả 2 máy tắt cùng lúc, data trapped
  • Đi công tác dài + tắt PC → laptop work alone, changes queue cho đến khi PC bật lại
  • Nếu cả 2 máy fail (vd thiên tai, trộm) → mất data — không có 3rd copy

VPS as 3rd peer giải quyết:

  • Always-on → laptop changes sync ngay lên VPS, không phải đợi PC
  • Off-site backup → cloud copy nếu cả 2 máy fail
  • 3-way mesh → bất kỳ máy nào cũng có thể là peer
PC ←─────── Syncthing TLS ────────→ Laptop
↑ ↑
│ │
└───── Syncthing TLS ──→ VPS ←─── Syncthing TLS ──┘
(always-on,
cloud peer)

VPS cài Syncthing daemon 24/7. Pair với cả PC + Laptop.

  • 4 OCPU ARM Ampere + 24 GB RAM + 200 GB storage = $0/month
  • Idle reclaim: 7-day CPU < 20% (95th percentile) → instance reclaimed
  • Out-of-capacity: ARM instances khó allocate trong popular regions
  • Workaround: cron CPU spike + region selection (Mumbai, Tokyo có capacity tốt)
  • 2 CPU + 4 GB RAM + 40 GB SSD
  • 100% reliable, no idle reclaim
  • Fast network (1 Gbps)
  • EU + US locations
  • 1 CPU + 1 GB RAM + 25 GB SSD (basic)
  • Standard provider, well-supported

Nếu có VPS chạy services khác (vd web hosting), cài Syncthing daemon song song.

  1. Provision VPS — chọn provider, deploy Ubuntu 22.04+ LTS
  2. Install Syncthing:
    Terminal window
    sudo apt update && sudo apt install -y syncthing
  3. Configure Syncthing:
    • Generate config: syncthing generate
    • GUI bind 0.0.0.0:8384 + set strong password (Settings → User & Password)
    • Allow firewall ports 22000 TCP+UDP, 21027 UDP
  4. Auto-start daemon:
    Terminal window
    sudo systemctl enable --now syncthing@&lt;user&gt;
  5. Reverse proxy GUI (optional, recommended for security):
    • Cloudflare Tunnel hoặc Caddy → expose syncthing.&lt;domain&gt; với HTTPS
  6. Pair với PC + Laptop:
    • Add VPS Device ID vào cả 2 máy
    • Share folders với VPS device
  7. Initial sync từ PC/Laptop → VPS:
    • Có thể tốn time tùy folder size + VPS bandwidth
Trước đi:
PC ←sync→ Laptop (state same)
↓ sync
VPS (3rd copy)
Đi công tác (tắt PC):
Laptop work tiếp, edit files
↓ sync via internet
VPS (receives changes)
Về nhà bật PC:
PC ←sync from VPS→ has all laptop changes
3 peers converge

Không phải đợi PC bật để laptop sync về. VPS = always-receiving peer.

Cả 2 máy fail (vd hỏa hoạn) → VPS có copy → mua máy mới, install Syncthing, pair với VPS Device ID → recover toàn bộ data.

Thêm máy thứ 3 (vd workstation văn phòng), thứ 4 (vd phone via Syncthing Android) — pair với VPS, all sync via VPS.

Aspect2-peer (PC+Laptop)3-peer (+VPS)
Cost$0$0-6/month (depend on provider)
Always-on
Disaster recovery
Setup complexitySimpleMedium
Bandwidth usageLAN only (if cùng nhà)Cloud upload mỗi change
Privacy100% localVPS provider has access (encrypted blocks though)

Syncthing v1.18+ supports untrusted devices mode:

  • Device ID added with untrusted: true flag
  • Device receives encrypted blocks, không decrypt được
  • Storage cloud peer KHÔNG nhìn thấy plaintext

Recommend cho VPS hosting cloud — trust mode untrusted cho safety.

Cron job spike CPU + network để Oracle không reclaim:

/etc/cron.d/keepalive
0 */6 * * * stress -c 1 --timeout 30s 2>&1 || true
0 */6 * * * curl -s https://example.com > /dev/null

Hoặc Syncthing scan + relay traffic tự nhiên đủ activity (varies).

Em sẽ kiểm chứng + viết chương chi tiết

Phần tiêu đề “Em sẽ kiểm chứng + viết chương chi tiết”