# Deploying the Windows Installer

## Quick Deploy

If you've made changes to the installer scripts or need to publish a new version:

```bash
# 1. Build the installer (Wine + PyInstaller + NSIS)
cd /home/lisa/hermes-node-protocol/node-agent
./windows/build-all.sh

# 2. Upload to website
./release/upload-windows.sh

# Manual:
scp deploy/windows/hermes-node-agent-installer.exe lisa@lisa.nexlab.net:/var/www/html/files/
```

## What Gets Published

- **`hermes-node-agent-installer.exe`**  
  PyInstaller + NSIS Windows installer (~51 MB)
  - Includes `hermes-node-agent.exe` and `hermes-node-manager.exe`
  - Interactive config UI (gateway URL, node name, token)
  - Auto-installs as Windows service via NSSM

## Git + Website Workflow

For ANY changes to code or installer scripts:

1. **Commit & Push to GitLab**
   ```bash
   git add -A
   git commit -m "Description of changes"
   git push origin main
   ```

2. **Rebuild installer**
   ```bash
   ./windows/build-all.sh
   ```

3. **Upload to website**
   ```bash
   ./release/upload-windows.sh
   # or manually upload via scp
   ```

4. **Verify**
   Visit: https://lisa.nexlab.net/files/hermes-node-agent-installer.exe

## Build Environment

The installer is built on Linux using:
- **Wine**: Windows compatibility layer
- **Python 3.13.1** (Windows embeddable, running under Wine)
- **PyInstaller 6.20.0**: Creates single-file Windows .exe bundles
- **NSIS 3.x**: Creates the final installer .exe with GUI config page
- **NSSM v2.24**: Windows service wrapper (bundled in installer)

## Configuration Files

- `windows/installer.nsi` — NSIS installer script
- `windows/config-template.json` — Default config for the installer
- `windows/build-all.sh` — Main build script
- `release/upload-windows.sh` — Automated upload script

## Troubleshooting

**"Permission denied" during upload:**
```bash
# Ensure SSH key is loaded
ssh-add ~/.ssh/id_rsa
# Or use ssh-copy-id to set up auth
ssh-copy-id lisa@lisa.nexlab.net
```

**Build fails:**
```bash
# Ensure Wine is installed
sudo apt-get install wine wine64
# Ensure dependencies
pip install pyinstaller
# Rebuild
./windows/build-all.sh
```

**Old installer still on website:**
- Force-rebuild: `rm -rf windows/dist windows/build && ./windows/build-all.sh`
- Re-upload: `scp ...`
