sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Hướng dẫn mở SSH trên VPS (1 lần duy nhất)
|
||||
|
||||
## Cách dễ nhất — copy script vào RDP
|
||||
|
||||
1. **RDP vào VPS:**
|
||||
- Windows + R → `mstsc`
|
||||
- Computer: `103.124.94.58:3389`
|
||||
- User: `Administrator`
|
||||
- Password: (dùng password đã cung cấp)
|
||||
|
||||
2. **Mở PowerShell AS ADMINISTRATOR:**
|
||||
- Start → gõ "PowerShell" → right-click → **Run as Administrator**
|
||||
|
||||
3. **Copy-paste toàn bộ file `scripts/deployment/00-enable-ssh-server.ps1`** vào PowerShell → Enter.
|
||||
|
||||
4. **Đợi ~1 phút**, khi thấy `DONE — SSH server ready` là xong.
|
||||
|
||||
5. **Báo lại cho dev**, dev sẽ test connection:
|
||||
```bash
|
||||
ssh -i ~/.ssh/dyd_vps Administrator@103.124.94.58 hostname
|
||||
```
|
||||
|
||||
## Nếu copy-paste qua RDP clipboard không được
|
||||
|
||||
**Option A — Upload file qua RDP mapped drive:**
|
||||
1. Trong mstsc → More → Local Resources → Drives → check `D:\` (hoặc drive chứa repo)
|
||||
2. Sau khi RDP, mở File Explorer → `\\tsclient\D\...\scripts\deployment\00-enable-ssh-server.ps1`
|
||||
3. Right-click file → Run with PowerShell (As Admin)
|
||||
|
||||
**Option B — Tải từ Gitea/GitHub (sau khi push):**
|
||||
```powershell
|
||||
Invoke-WebRequest -Uri '<raw-url>/scripts/deployment/00-enable-ssh-server.ps1' -OutFile C:\Temp\00-enable-ssh.ps1
|
||||
powershell -ExecutionPolicy Bypass -File C:\Temp\00-enable-ssh.ps1
|
||||
```
|
||||
|
||||
## Script làm gì?
|
||||
|
||||
1. Install OpenSSH Server capability (Windows feature)
|
||||
2. Start `sshd` service + set auto-start
|
||||
3. Open firewall port 22
|
||||
4. Set default SSH shell = PowerShell (chứ không phải cmd)
|
||||
5. Add public key `dyd-vps-deploy-20260415` vào `administrators_authorized_keys`
|
||||
6. Fix file permission (chỉ Admin + SYSTEM được đọc)
|
||||
|
||||
**Idempotent** — chạy nhiều lần OK, không side effect.
|
||||
|
||||
## Security
|
||||
|
||||
- Public key đã embed trong script
|
||||
- Private key nằm trên máy dev (`~/.ssh/dyd_vps`) — KHÔNG rời máy
|
||||
- Nếu mất private key → chạy lại script sau khi đổi `$PublicKey` với key mới
|
||||
- Disable SSH sau khi xong deploy: `Stop-Service sshd; Set-Service sshd -StartupType Disabled`
|
||||
Reference in New Issue
Block a user