Commit 8affefbc authored by Lisa's avatar Lisa

feat: add installer build scripts for Linux and Windows

- Add Linux installer (self-contained bash script)

- Add Windows build script (NSIS + Python embeddable)

- Installers produce fully offline-capable agents
parent 1773a2c0
# Deployment Scripts for Hermes Node Agent
These scripts build installers for deploying Hermes Node Agent on target machines.
## Structure
```
deploy/
├── README.md - This file
├── linux/
│ └── install-node.sh - Self-contained Linux installer (embedded files)
├── windows/
│ ├── build-installer.sh - Build script for Windows .exe installer
│ └── installer.nsi - NSIS installer template
```
## Building Installers
### Linux
The Linux installer is self-contained (no build required):
```bash
sudo deploy/linux/install-node.sh
```
Features:
- All agent files embedded (base64 tarball)
- Uses system Python 3
- pip installs `websockets`
- Creates SysV init service as root
### Windows
Build the Windows .exe offline installer:
```bash
cd deploy/windows
bash build-installer.sh
```
Dependencies: `makensis`, `wget`, `python3`, `pip`.
Output: `deploy/windows/hermes-node-agent-installer.exe` (~11 MB)
Installer includes:
- Python 3.13.1 embeddable
- websockets library (cp313 win_amd64)
- Node agent source files
- Batch launchers + config wizard
- GUI NSIS installer
## Release Process
1. Linux installer is already built: `deploy/linux/install-node.sh`
2. Build Windows installer: `cd deploy/windows && bash build-installer.sh`
3. Create release bundle:
```bash
cd /path/to/hermes-node-agent
cp deploy/linux/install-node.sh ./
cp deploy/windows/hermes-node-agent-installer.exe ./
zip -r node-agent-v2.zip install-node.sh hermes-node-agent-installer.exe
```
4. Upload release to website: `https://lisa.nexlab.net/files/node-agent-v2.zip`
## Notes
- Both installers are fully **offline-capable** after build
- No git clone on target
- Zero external network dependencies on target machines
- All source code included; only network during Windows **build**, not during install
This diff is collapsed.
#!/bin/bash
# Build Windows offline installer for Hermes Node Agent
# Requires: makensis (NSIS compiler), wget/curl, python3 + pip
set -e
cd "$(cd "$(dirname "$0")"/.. && pwd)"
WORKDIR=$(mktemp -d)
echo "Build directory: $WORKDIR"
# Download components
echo "Downloading Python 3.13.1 embeddable..."
wget -q "https://www.python.org/ftp/python/3.13.1/python-3.13.1-embed-amd64.zip" -O "$WORKDIR/python.zip"
echo "Downloading websockets..."
python3 -m pip download websockets --platform win_amd64 --python-version 3.13 --only-binary=:all: -d "$WORKDIR"
# Build payload
PAYLOAD="$WORKDIR/payload"
mkdir -p "$PAYLOAD"/{python,node,config}
# Extract Python
unzip -q "$WORKDIR/python.zip" -d "$PAYLOAD/python"
mkdir -p "$PAYLOAD/python/Lib/site-packages"
# Install websockets
WHEEL=$(ls "$WORKDIR"/websockets*.whl)
unzip -q "$WHEEL" -d "$PAYLOAD/python/Lib/site-packages"
# Copy sources
cp ../hermes_node_agent.py "$PAYLOAD/node/"
cp ../browser_controller.py "$PAYLOAD/node/"
# sexec placeholder
echo '@echo off' > "$PAYLOAD/sexec.bat"
echo 'echo "sexec not implemented on Windows"' >> "$PAYLOAD/sexec.bat"
echo 'exit /b 0' >> "$PAYLOAD/sexec.bat"
# Config template
cat > "$PAYLOAD/config/config.json" <<'EOF'
{
"gateway_url": "ws://YOUR-GATEWAY:8765",
"node_name": "WIN-NODE",
"token": "YOUR-TOKEN-HERE",
"sexec_path": ".\sexec.bat",
"reconnect_interval": 5,
"heartbeat_interval": 30,
"capabilities": ["exec"]
}
EOF
# Launchers
cat > "$PAYLOAD/setup.bat" <<'EOF'
@echo off
echo === Hermes Node Agent Setup ===
set /p GATEWAY_HOST="Gateway host: "
set /p NODE_NAME="Node name [%COMPUTERNAME%]: "
if "%NODE_NAME%"=="" set NODE_NAME=%COMPUTERNAME%
set /p GATEWAY_TOKEN="Gateway token: "
(
echo {
echo "gateway_url": "ws://%GATEWAY_HOST%:8765",
echo "node_name": "%NODE_NAME%",
echo "token": "%GATEWAY_TOKEN%",
echo "sexec_path": ".\sexec.bat",
echo "reconnect_interval": 5,
echo "heartbeat_interval": 30,
echo "capabilities": ["exec"]
echo }
) > config\config.json
echo Configuration saved. Run agent.bat to start.
pause
EOF
cat > "$PAYLOAD/agent.bat" <<'EOF'
@echo off
cd /d "%~dp0"
set PYTHONHOME=python
set PYTHONPATH=python;python\Lib;python\Lib\site-packages
set PATH=%~dp0python;%PATH%
python.exe node\hermes_node_agent.py --config config\config.json
pause
EOF
# NSIS script
cat > "$WORKDIR/installer.nsi" <<'NSIS'
!define APP "Hermes Node Agent"
!define VER "2.0"
Name "${APP} ${VER}"
OutFile "hermes-node-agent-installer.exe"
InstallDir "$PROGRAMFILES64\HermesNode"
RequestExecutionLevel admin
!include "MUI2.nsh"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Section "Install"
SetOutPath "$INSTDIR"
File /r "payload\*.*"
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateDirectory "$SMPROGRAMS\${APP}"
CreateShortCut "$SMPROGRAMS\${APP}\Setup.lnk" "$INSTDIR\setup.bat"
CreateShortCut "$SMPROGRAMS\${APP}\Start.lnk" "$INSTDIR\agent.bat"
CreateShortCut "$SMPROGRAMS\${APP}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SectionEnd
Section "Uninstall"
RMDir /r "$INSTDIR"
RMDir /r "$SMPROGRAMS\${APP}"
SectionEnd
NSIS
# Compile
echo "Compiling NSIS installer..."
cd "$WORKDIR"
makensis installer.nsi
# Move output
cp hermes-node-agent-installer.exe "$OLDPWD/../../deploy/windows/"
echo "✅ Build complete: deploy/windows/hermes-node-agent-installer.exe"
rm -rf "$WORKDIR"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment