A-HAP - Arbiter Home Automation Platform
Linux ARM64 Headless Trial Installer
==========================================

PRODUCT

A-HAP is the Arbiter Home Automation Platform by Arbitersoft.

Website:
   https://arbitersoft.com

Default local web UI:
   http://<server-ip>:5233


SUPPORTED TARGET

This package is for a headless Linux ARM64 server.

Expected environment:
   - Linux ARM64 / x86_64
   - systemd
   - sudo/root access
   - TCP port 5233 allowed through the firewall
   - Internet access for trial start/validation and paid license activation/release

This package is intended for the self-contained Linux ARM64 build of A-HAP. A separate ARM64/Raspberry Pi package should be built for Raspberry Pi or other ARM devices.


PACKAGE LAYOUT

The extracted package should look like this:

   install.sh
   uninstall.sh
   README.txt
   a-hap/
      ESP32_Controller
      appsettings.json
      wwwroot/
      other published application files...

The installer expects the published application files to be inside the local ./a-hap folder.


INSTALLATION

1. Extract the package:

   tar -xzf a-hap-linux-arm64-trial.tar.gz
   cd a-hap-linux-arm64-trial

2. Run the installer:

   sudo ./install.sh

3. Open the web UI in a browser:

   http://<server-ip>:5233

The installer prints the detected server IP at the end. You can also find it with:

   hostname -I


WHAT THE INSTALLER DOES

The installer:

   - Copies the application to /opt/a-hap
   - Creates a dedicated system user and group named a-hap
   - Creates the runtime data folder /var/lib/a-hap
   - Grants the a-hap service account ownership of /var/lib/a-hap
   - Creates the log folder /var/log/a-hap
   - Installs a systemd service named a-hap
   - Enables the service to start automatically at boot
   - Starts/restarts the service immediately
   - Configures basic journald, rsyslog, and logrotate limits where available

The application runs as:

   User:  a-hap
   Group: a-hap


IMPORTANT PATHS

Application files:

   /opt/a-hap

Runtime data and local SQLite database:

   /var/lib/a-hap

Common files in the runtime data folder:

   /var/lib/a-hap/a-hap.db
   /var/lib/a-hap/runtime-settings.json

Logs:

   journalctl -u a-hap
   /var/log/a-hap/a-hap.log   (when rsyslog is available)


SERVICE MANAGEMENT

Check status:

   sudo systemctl status a-hap

Start:

   sudo systemctl start a-hap

Restart:

   sudo systemctl restart a-hap

Stop:

   sudo systemctl stop a-hap

Follow logs:

   sudo journalctl -u a-hap -f

Show recent logs:

   sudo journalctl -u a-hap -n 100 --no-pager


FIREWALL

A-HAP listens on TCP port 5233 by default.

If UFW is enabled, allow access with:

   sudo ufw allow 5233/tcp

If you use another firewall, allow inbound TCP 5233 from the devices/users that need access.


DEFAULT LOGIN

Initial admin login:

   Username: admin
   Password: Admin123!

Change the default password after first login.


TRIAL AND LICENSE BEHAVIOUR

Trial mode:

   - Internet access is required to start the trial.
   - Trial validation is server-backed.
   - The app validates the trial online at least once every 24 hours.
   - If daily validation is due and the server/internet is unavailable, trial mode may block until it can validate again.
   - The backend is the authority for the trial start and expiry dates.
   - Local SQLite only caches trial state for display and local enforcement.

Paid license mode:

   - Internet access is required during activation.
   - After activation, the paid license can run offline.
   - Internet access is required again if the user releases the license from that machine.
   - The license release function frees the activation so the same license key can be used on another machine.


UPGRADING

To upgrade A-HAP, extract the newer package and run:

   sudo ./install.sh

The installer preserves runtime data in:

   /var/lib/a-hap

This includes the local SQLite database, local trial/license state, and runtime settings.

The installer replaces the application files in:

   /opt/a-hap


UNINSTALL

To remove the application and service while preserving data/logs:

   sudo ./uninstall.sh

This keeps:

   /var/lib/a-hap
   /var/log/a-hap

To remove the application, service, runtime data, logs, and the a-hap service account:

   sudo ./uninstall.sh --purge


RESETTING A TEST INSTALLATION

For testing only, to remove the local database and runtime state:

   sudo systemctl stop a-hap
   sudo rm -rf /var/lib/a-hap
   sudo ./install.sh

Do not do this on a real customer installation unless you intentionally want to remove the local A-HAP database and trial/license cache.


BUILDING THE Linux ARM64 PACKAGE

From the app project, publish the Linux ARM64 self-contained build.

Example from PowerShell:

   Remove-Item "C:\Temp\A-HAP-linux-arm64" -Recurse -Force -ErrorAction SilentlyContinue

   dotnet publish "F:\Development\ESP32_Controller\ESP32_Controller.csproj" `
     -c Release `
     -r linux-arm64 `
     --self-contained true `
     -o "C:\Temp\A-HAP-linux-arm64\a-hap"

Then place install.sh, uninstall.sh, and README.txt beside the a-hap folder:

   C:\Temp\A-HAP-linux-arm64\install.sh
   C:\Temp\A-HAP-linux-arm64\uninstall.sh
   C:\Temp\A-HAP-linux-arm64\README.txt
   C:\Temp\A-HAP-linux-arm64\a-hap\ESP32_Controller

Create the tar.gz on Linux or WSL:

   cd /mnt/c/Temp/A-HAP-linux-arm64
   chmod +x install.sh uninstall.sh
   tar -czf ../a-hap-linux-arm64-trial.tar.gz .


TROUBLESHOOTING

Service does not start:

   sudo systemctl status a-hap --no-pager
   sudo journalctl -u a-hap -n 100 --no-pager

Port already in use:

   sudo ss -tulpn | grep 5233

Permission issues with the database:

   sudo chown -R a-hap:a-hap /var/lib/a-hap
   sudo find /var/lib/a-hap -type d -exec chmod 750 {} \;
   sudo find /var/lib/a-hap -type f -exec chmod 640 {} \;
   sudo systemctl restart a-hap

Find server IP:

   hostname -I


SUPPORT

Support:
   https://arbitersoft.com/support.html

Bug reports:
   bugs.a-hap@arbitersoft.com
