proxy-pilot 0.6.2

Core-agnostic proxy health monitor, automatic failover daemon, and multi-channel alerting tool for Linux servers.
Documentation
# Operations: Deploy, Integrate, Rollback & Troubleshooting

## 1. Deployment (Linux, macOS, Windows)

### Linux Server (`systemd`)

#### Option A: One-line installer (recommended)
```bash
curl -fsSL https://raw.githubusercontent.com/amirhosein2004/proxy-pilot/main/scripts/install.sh | sudo bash
```

#### Option B: Manual install (without script)
1. Download and verify the static binary (`amd64` or `arm64`):
   ```bash
   curl -fsSL -o proxy-pilot-linux-amd64 https://github.com/amirhosein2004/proxy-pilot/releases/latest/download/proxy-pilot-linux-amd64
   curl -fsSL -o proxy-pilot-linux-amd64.sha256 https://github.com/amirhosein2004/proxy-pilot/releases/latest/download/proxy-pilot-linux-amd64.sha256
   sha256sum -c proxy-pilot-linux-amd64.sha256
   sudo install -m 0755 proxy-pilot-linux-amd64 /usr/local/bin/proxy-pilot
   ```
2. Copy `config.example.yaml` to `/etc/proxy-pilot/config.yaml` (`chmod 600`) and fill in your Bale chat ID (or set `BALE_BOT_TOKEN`).
3. Copy `deploy/proxy-pilot.service` to `/etc/systemd/system/proxy-pilot.service`.
4. Enable and start the daemon:
   ```bash
   sudo systemctl daemon-reload
   sudo systemctl enable --now proxy-pilot
   sudo systemctl status proxy-pilot
   ```
5. Import your `vless://` links:
   ```bash
   sudo proxy-pilot import
   ```

### macOS (`brew services`)
1. Place the `proxy-pilot` binary in `/usr/local/bin/proxy-pilot` (or `/opt/homebrew/bin/proxy-pilot`) and `chmod +x`.
2. Ensure Xray is managed via Homebrew (`brew install xray`), and set `core.service_name: "xray"` in your `config.yaml`.
3. Import configs and run:
   ```bash
   proxy-pilot import -c ~/proxy-pilot/config.yaml
   proxy-pilot benchmark -c ~/proxy-pilot/config.yaml
   proxy-pilot run -c ~/proxy-pilot/config.yaml
   ```

### Windows (PowerShell)
1. Place `proxy-pilot.exe` and `xray.exe` in a folder (e.g. `C:\proxy-pilot\`).
2. Copy `config.example.yaml` to `C:\proxy-pilot\config.yaml` and set `core.binary_path` to `C:\proxy-pilot\xray.exe` and `core.config_path` to `C:\proxy-pilot\xray-config.json`.
3. Import configs and run:
   ```powershell
   .\proxy-pilot.exe import -c C:\proxy-pilot\config.yaml
   .\proxy-pilot.exe benchmark -c C:\proxy-pilot\config.yaml
   .\proxy-pilot.exe run -c C:\proxy-pilot\config.yaml
   ```

## 2. Connecting Server Services (No TUN Mode)

Keep TUN disabled so SSH, Iranian sites, and Bale alerts always use direct Iran routing. Point only the services that need proxy access to the fixed local proxy (`http://127.0.0.1:10809`):

- **Docker Daemon** (`/etc/systemd/system/docker.service.d/proxy.conf`):
  ```ini
  [Service]
  Environment="HTTP_PROXY=http://127.0.0.1:10809"
  Environment="HTTPS_PROXY=http://127.0.0.1:10809"
  Environment="NO_PROXY=localhost,127.0.0.1"
  ```
- **GitLab Runner** (`config.toml`): add `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` under `environment`.
- **Web Apps / Bots**: set `HTTPS_PROXY=http://127.0.0.1:10809` in the service `.env` or `systemd` unit.

## 3. Rollback

If an upgrade causes issues:
1. Stop the service: `sudo systemctl stop proxy-pilot`
2. Replace `/usr/local/bin/proxy-pilot` with the previous release binary from GitHub Releases (verify `.sha256`).
3. Start the service: `sudo systemctl start proxy-pilot`

## 4. Troubleshooting

- **View live logs:** `journalctl -u proxy-pilot -f`
- **All profiles unhealthy:** Check `proxy-pilot status`, verify the local proxy port (`10808`/`10809`) is listening (`ss -tlnp`), and verify `systemctl status xray`.
- **Bale alerts not arriving:** Confirm `BALE_BOT_TOKEN` and `chat_id` are valid and that `tapi.bale.ai` is reachable directly without a proxy.
- **GitHub release download slow/blocked:** Use the configured fallback mirror or offline `.tar.gz` bundle.