DamageBDD — Windows Installation Guide

# DamageBDD — Windows Installation

One-click setup with custom port & encrypted wallet init

## Download

Download both files to the same folder (e.g. your Desktop). Then double-click the batch file.

⬇️ Download Run-Installer.bat
One-click launcher ⬇️ Download Install-DamageBDD.ps1
PowerShell core (v2)
Why two files? The `.bat` elevates and runs the `.ps1` with the right permissions/options.

## Install (Beginner-Friendly)

1. Create a folder (e.g. `C:\Users\You\Desktop\DamageInstaller`).
2. Save both downloads into that folder:
   - `Run-Installer.bat`
   - `Install-DamageBDD.ps1`
3. Double-click Run-Installer.bat → approve the UAC prompt.
4. Follow prompts:
   - Port: choose an HTTP listen port (auto-suggests a free one if in use).
   - Wallet password: secure Windows prompt to initialize the encrypted key store.
5. The installer will then:
   - Install Erlang/OTP 28.1 (if needed)
   - Download DamageBDD (latest `develop`)
   - Download rebar3
   - Write `config/sys.config` with your port & settings
   - Initialize the encrypted wallet keystore
   - Build a release

When you see “✅ Done! DamageBDD set up at: …”, installation is complete.
Install location: a folder named `DamageBDD` beside where you saved the installer files.

## Run & Service (One-Click)

▶️ damagebdd-run.bat
Start / Stop / Console / Logs 🛠️ damagebdd-service.bat
Install / Start / Stop / Uninstall
Place these files in the `same folder` that contains your `DamageBDD` directory.
What does `damagebdd-run.bat` do?
Builds a release if missing, then lets you: Start (daemon), Stop, Console (interactive), or open Logs.
What does `damagebdd-service.bat` do?
Installs a Windows Service (Automatic startup), and can Start/Stop/Uninstall. Optionally stores a service-scoped `DAMAGE_SECRET_KEY` so the service can unlock the wallet non-interactively (skip to keep the password out of the service config).

## Changing Settings Later

Change the HTTP port
Edit `DamageBDD\config\sys.config` → update `{port, <number>}` → run `damagebdd-run.bat` and choose Start.
Rotate/reset wallet password
Stop the app, back up your key file if applicable, then re-initialize using your project’s wallet/secret management flow. If running as a service, remove any stored `DAMAGE_SECRET_KEY` via `damagebdd-service.bat` → Uninstall then Install (skip the password step).

## FAQ

Do I need to install anything first?
No. The installer fetches Erlang/OTP, DamageBDD, and rebar3 automatically.
Is it safe to accept the Windows permission prompt?
Yes. It’s the standard UAC prompt to allow the Erlang installer to run.
Port is already in use
The installer auto-suggests a free port. You can also change it later in `config/sys.config`.
Where does it install DamageBDD?
In a folder named `DamageBDD` next to where you saved the installer files.
The `.ps1` does nothing when double-clicked
Always start with Run-Installer.bat—it launches PowerShell correctly with the right permissions.

## Troubleshooting

Windows SmartScreen blocked the file
Click More info → Run anyway. Files are hosted at the official DamageBDD URL above.
Installer can’t find `escript.exe`
Close the window, then re-run Run-Installer.bat. If it persists, check that Erlang/OTP 28.1 is installed.
Corporate antivirus blocked downloads
Try a non-corporate network or ask IT to whitelist: `github.com`, `s3.amazonaws.com`, `run.dev.damagebdd.com`.