bzl

self-hosted ephemeral community engine
Log | Files | Refs | README | LICENSE

INSTANCE_FLEET_AUTOMATION.md (1717B)


      1 # Instance Fleet Automation (Detect + Update + Create)
      2 
      3 Use this when you run multiple Bzl clones in separate folders on one server (for example `/Bzl`, `/srv/bzl-staging`, `/opt/community/Bzl`).
      4 
      5 ## 1) Detect instances from root paths
      6 
      7 List discovered Bzl instances:
      8 
      9 ```bash
     10 npm run instances:scan -- --roots=/ --max-depth=4
     11 ```
     12 
     13 By default, detection combines:
     14 - filesystem scan for compose projects with Bzl-like signals (`bzl` in path/name or Bzl source markers)
     15 - Docker label scan (`com.docker.compose.project.working_dir`) so running instances are found even if the folder is compose-only
     16 
     17 Supported compose filenames include:
     18 - `compose.yaml`
     19 - `compose.yml`
     20 - `docker-compose.yml`
     21 - `docker-compose.yaml`
     22 
     23 ## 2) Update all discovered instances
     24 
     25 Bulk update:
     26 
     27 ```bash
     28 npm run instances:update -- --roots=/ --max-depth=4
     29 ```
     30 
     31 This performs, per instance:
     32 1. `git fetch`
     33 2. `git checkout main`
     34 3. `git pull --ff-only origin main`
     35 4. `docker compose -f <compose-file> up -d --build --remove-orphans`
     36 
     37 Useful flags:
     38 - `--skip-git`
     39 - `--skip-build`
     40 - `--branch=main`
     41 - `--remote=origin`
     42 - `--dry-run`
     43 
     44 ## 3) Create a new instance in a new folder
     45 
     46 Provision a fresh clone + `.env` + docker startup:
     47 
     48 ```bash
     49 npm run instance:create -- --path=/srv/bzl-new --port=3405 --registration-code='replace-me' --hostname=new.example.com
     50 ```
     51 
     52 Default repo source is `https://github.com/bzlapp/Bzl.git` on `main`.
     53 
     54 Useful flags:
     55 - `--repo=...`
     56 - `--branch=...`
     57 - `--no-start`
     58 - `--dry-run`
     59 
     60 ## Caddy + DNS reminders
     61 
     62 After creating/updating instances:
     63 - ensure each hostname reverse proxies to the correct local port
     64 - verify `curl http://127.0.0.1:<port>/api/health`
     65 - confirm public hostname routes to the expected instance