Deployr 0.1.0: cross-platform application deployment CLI
Replaces Ninite for endpoint software: one catalog, one command line, and the same behaviour on Windows, macOS and Linux. Single static binary, no server and no agent, driven from an RMM script runner or by hand. - catalog of ~50 apps compiled into the binary, extendable with YAML overlays in catalog.d or via --catalog, no rebuild required - providers: winget, choco, brew, cask, apt, dnf/yum, zypper, pacman, flatpak, snap, plus direct vendor downloads (msi/exe/msu/dmg/pkg/deb/rpm/zip/tar.gz/ AppImage) - sources are tried in order and fall through, so one catalog entry covers winget on Windows, a cask on macOS and the vendor .deb on Debian - provider-independent detection (registry, paths, commands) makes runs idempotent even for software installed by hand - unattended by construction: stdin closed, silent flags, per-command timeouts - handles the traps that break naive wrappers: winget missing under SYSTEM, Homebrew refusing root, 1641/3010 reboot exits, "already installed" reported as failure - --json summary on stdout with progress on stderr, and RMM-friendly exit codes (0 ok, 1 failed, 2 usage, 3 privileges) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
4909edee2d
40 files changed
+6714
No files matched your search
+162
@@ -0,0 +1,162 @@
|
||||
# Catalog format
|
||||
|
||||
The catalog says what deployr can install and how. One copy is compiled into the
|
||||
binary (`internal/catalog/data/apps.yaml`); overlays let you add or override
|
||||
entries on a machine without rebuilding.
|
||||
|
||||
## Where overlays are loaded from
|
||||
|
||||
In increasing order of precedence:
|
||||
|
||||
1. `C:\ProgramData\Deployr\catalog.d\*.yaml` (Windows)
|
||||
`/var/lib/deployr/catalog.d/*.yaml` and `/etc/deployr/catalog.d/*.yaml` (Unix)
|
||||
2. The per-user cache directory's `catalog.d` (used automatically when the
|
||||
machine-wide path is not writable)
|
||||
3. Anything passed with `--catalog FILE_OR_DIR` (repeatable)
|
||||
|
||||
An overlay app whose `id` matches a shipped app **replaces it entirely** — no
|
||||
deep merge — so what you read in the file is exactly what will run. Profiles are
|
||||
replaced by name the same way.
|
||||
|
||||
Check an overlay before you ship it:
|
||||
|
||||
```
|
||||
deployr catalog validate ./my-apps.yaml
|
||||
```
|
||||
|
||||
## Document shape
|
||||
|
||||
```yaml
|
||||
apps:
|
||||
- id: my-app # required, unique, lowercase
|
||||
name: My Application # required, human name
|
||||
description: ...
|
||||
homepage: https://...
|
||||
categories: [line-of-business]
|
||||
aliases: [myapp] # alternative names accepted on the command line
|
||||
|
||||
windows: # one or more of windows / darwin / linux
|
||||
sources: [...] # required, tried in order
|
||||
detect: {...} # how to tell it is already installed
|
||||
notes: ... # shown by `deployr info`
|
||||
|
||||
profiles:
|
||||
onboarding: [my-app, chrome, 7zip]
|
||||
```
|
||||
|
||||
## Sources
|
||||
|
||||
Sources are tried top to bottom. The first provider that **exists on the
|
||||
machine** is used; if it fails, deployr moves to the next one (unless
|
||||
`--strict`). Put the route you trust most first.
|
||||
|
||||
### Package manager sources
|
||||
|
||||
```yaml
|
||||
sources:
|
||||
- provider: winget # winget|choco|brew|cask|apt|dnf|zypper|pacman|flatpak|snap
|
||||
id: Google.Chrome # the provider's own package identifier
|
||||
args: ["--locale", "en-US"] # optional extra arguments
|
||||
arch: [amd64] # optional: restrict to these GOARCH values
|
||||
repo: flathub # optional: flatpak remote
|
||||
```
|
||||
|
||||
### Direct vendor downloads
|
||||
|
||||
```yaml
|
||||
sources:
|
||||
- provider: direct
|
||||
url: https://vendor.example/app-setup.msi
|
||||
urls: # or per-architecture, overriding url
|
||||
amd64: https://vendor.example/app-x64.msi
|
||||
arm64: https://vendor.example/app-arm64.msi
|
||||
kind: msi # msi|exe|msu|dmg|pkg|deb|rpm|zip|tar.gz|appimage
|
||||
# inferred from the URL when omitted
|
||||
silent_args: ["/S"] # REQUIRED for kind: exe
|
||||
sha256: 9f2c... # optional; enforced when set, required by --require-checksum
|
||||
app_name: MyApp.app # dmg/zip on macOS: the bundle to copy to /Applications
|
||||
dest: "%ProgramFiles%/MyApp" # zip/tar.gz: extraction target
|
||||
uninstall_id: my-app # Linux: package name to remove; Windows: registry DisplayName
|
||||
```
|
||||
|
||||
Notes that matter in practice:
|
||||
|
||||
- **`kind: exe` without `silent_args` is rejected.** A bare vendor `.exe` opens a
|
||||
wizard on someone's screen and then hangs until the timeout — refusing is the
|
||||
correct behaviour, not a limitation.
|
||||
- **Evergreen URLs cannot be checksum-pinned.** A vendor "latest" link changes
|
||||
content on every release. Pin `sha256` only for versioned URLs, and use
|
||||
`--require-checksum` on sites where an unpinned download is unacceptable.
|
||||
- **`.dmg` handling**: a `.pkg` inside the image wins; otherwise the `.app` named
|
||||
by `app_name` (or the only one present) is copied to `/Applications` with
|
||||
`ditto`, replacing any existing bundle.
|
||||
- **`.deb` installs go through `apt-get install ./file`**, so dependencies
|
||||
resolve instead of leaving a half-configured dpkg state.
|
||||
|
||||
## Detection
|
||||
|
||||
Detection is how deployr decides an app is *already installed*, no matter who
|
||||
installed it. It runs before any provider is touched, which is why
|
||||
`deployr install chrome` is fast and idempotent on a machine that already has
|
||||
Chrome from an image.
|
||||
|
||||
```yaml
|
||||
detect:
|
||||
registry: ["Google Chrome"] # Windows uninstall entries, case-insensitive substring
|
||||
paths: # files or directories; env vars and globs allowed
|
||||
- "%ProgramFiles%/Google/Chrome/Application/chrome.exe"
|
||||
- "/Applications/Google Chrome.app"
|
||||
commands: [google-chrome-stable] # executables that must resolve on PATH
|
||||
```
|
||||
|
||||
Evaluation order is registry, then paths, then commands — first hit wins. The
|
||||
registry scan covers 64-bit, 32-bit and per-user uninstall keys; missing one of
|
||||
those is the classic reason a "not installed" check is wrong.
|
||||
|
||||
Version reporting comes from, in order: the provider's own query, the registry's
|
||||
`DisplayVersion`, or a macOS bundle's `CFBundleShortVersionString`. An app with
|
||||
no version available still reports correctly as installed.
|
||||
|
||||
If `detect` is omitted entirely, deployr cannot skip work it does not need to
|
||||
do, and `update` / `uninstall` will always run the provider. Always write one.
|
||||
|
||||
## A complete overlay example
|
||||
|
||||
`C:\ProgramData\Deployr\catalog.d\atomit.yaml`
|
||||
|
||||
```yaml
|
||||
apps:
|
||||
- id: linemgr
|
||||
name: LineManager Client
|
||||
description: Line-of-business client for the accounting team
|
||||
categories: [line-of-business]
|
||||
windows:
|
||||
sources:
|
||||
- provider: direct
|
||||
url: https://files.example.com/linemgr/LineManagerSetup-4.8.2.msi
|
||||
kind: msi
|
||||
sha256: 5f0d9a3c1e...
|
||||
silent_args: ["SERVER=lm01.corp.example.com"]
|
||||
detect:
|
||||
registry: ["LineManager Client"]
|
||||
|
||||
# Override a shipped app: force Chrome through Chocolatey only.
|
||||
- id: chrome
|
||||
name: Google Chrome
|
||||
categories: [browser]
|
||||
windows:
|
||||
sources:
|
||||
- provider: choco
|
||||
id: googlechrome
|
||||
detect:
|
||||
registry: ["Google Chrome"]
|
||||
|
||||
profiles:
|
||||
accounting: [linemgr, chrome, adobereader, 7zip]
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```
|
||||
deployr install @accounting --json
|
||||
```
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
# Running deployr from an RMM
|
||||
|
||||
Deployr is a single binary with meaningful exit codes, so any script runner can
|
||||
drive it. The pattern is always the same: make sure the binary is on the
|
||||
machine, run it, return its exit code.
|
||||
|
||||
| Code | Meaning | Suggested RMM handling |
|
||||
| --- | --- | --- |
|
||||
| `0` | Everything is in the requested state | Success |
|
||||
| `1` | At least one app failed | Alert, read the JSON `results` |
|
||||
| `2` | Usage or catalog error | Alert — the script or overlay is wrong |
|
||||
| `3` | Insufficient privileges | Fix the policy's run-as context |
|
||||
|
||||
Progress goes to **stderr**, the `--json` summary to **stdout**. An RMM that
|
||||
captures both gets a readable transcript and a parseable result from one run.
|
||||
|
||||
## Getting the binary onto the machine
|
||||
|
||||
Deployr has no self-update, on purpose: the RMM already does software
|
||||
distribution, and one authority beating another is how endpoints drift. Ship it
|
||||
the way you ship any other tool.
|
||||
|
||||
### Windows
|
||||
|
||||
```powershell
|
||||
$dir = "C:\ProgramData\Deployr"
|
||||
$exe = "$dir\deployr.exe"
|
||||
$src = "https://files.example.com/deployr/deployr_windows_amd64.exe"
|
||||
$expected = "PUT_THE_SHA256_HERE"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
||||
|
||||
$need = $true
|
||||
if (Test-Path $exe) {
|
||||
$need = (Get-FileHash $exe -Algorithm SHA256).Hash -ne $expected
|
||||
}
|
||||
if ($need) {
|
||||
Invoke-WebRequest -Uri $src -OutFile "$exe.new" -UseBasicParsing
|
||||
if ((Get-FileHash "$exe.new" -Algorithm SHA256).Hash -ne $expected) {
|
||||
Remove-Item "$exe.new"; throw "deployr checksum mismatch"
|
||||
}
|
||||
Move-Item "$exe.new" $exe -Force
|
||||
}
|
||||
```
|
||||
|
||||
### macOS / Linux
|
||||
|
||||
```sh
|
||||
BIN=/usr/local/bin/deployr
|
||||
SRC=https://files.example.com/deployr/deployr_linux_amd64
|
||||
EXPECTED=PUT_THE_SHA256_HERE
|
||||
|
||||
if [ ! -x "$BIN" ] || [ "$(shasum -a 256 "$BIN" | cut -d' ' -f1)" != "$EXPECTED" ]; then
|
||||
curl -fsSL "$SRC" -o /tmp/deployr.new
|
||||
echo "$EXPECTED /tmp/deployr.new" | shasum -a 256 -c - || exit 1
|
||||
install -m 0755 /tmp/deployr.new "$BIN"
|
||||
rm -f /tmp/deployr.new
|
||||
fi
|
||||
```
|
||||
|
||||
## Level.io
|
||||
|
||||
Level runs scripts as SYSTEM on Windows and root on macOS/Linux, which is what
|
||||
deployr wants. Create one script per intent and attach it to a policy.
|
||||
|
||||
**Windows — install the standard bundle**
|
||||
|
||||
```powershell
|
||||
$exe = "C:\ProgramData\Deployr\deployr.exe"
|
||||
& $exe install @standard --json
|
||||
exit $LASTEXITCODE
|
||||
```
|
||||
|
||||
**macOS / Linux — patch everything present, weekly**
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
/usr/local/bin/deployr update --all --json
|
||||
```
|
||||
|
||||
Level surfaces a non-zero exit as a failed script run, so no extra wiring is
|
||||
needed for alerting.
|
||||
|
||||
## NinjaOne
|
||||
|
||||
Ninja's script results branch on exit code the same way. Add deployr as a script
|
||||
with **Run As: System**, then either:
|
||||
|
||||
- **Scheduled patching** — `deployr update --all --json` on a weekly policy.
|
||||
- **Onboarding** — `deployr install @standard --json` as a task on new devices.
|
||||
- **On-demand** — take the app list as a script parameter:
|
||||
|
||||
```powershell
|
||||
param([string]$Apps = "@standard")
|
||||
$exe = "C:\ProgramData\Deployr\deployr.exe"
|
||||
& $exe install @($Apps -split '\s+') --json
|
||||
exit $LASTEXITCODE
|
||||
```
|
||||
|
||||
## Site-specific app lists
|
||||
|
||||
Rather than editing scripts per client, ship a catalog overlay with the binary
|
||||
and reference profiles by name:
|
||||
|
||||
```
|
||||
C:\ProgramData\Deployr\catalog.d\client.yaml -> profiles: { standard: [...] }
|
||||
```
|
||||
|
||||
The script stays `deployr install @standard` everywhere, and what `@standard`
|
||||
means is a per-site file your RMM already knows how to distribute. See
|
||||
[CATALOG.md](CATALOG.md).
|
||||
|
||||
## Scheduling without an RMM
|
||||
|
||||
**Windows — weekly patch run at 03:00**
|
||||
|
||||
```powershell
|
||||
$action = New-ScheduledTaskAction -Execute "C:\ProgramData\Deployr\deployr.exe" -Argument "update --all"
|
||||
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 3am
|
||||
Register-ScheduledTask -TaskName "Deployr patching" -Action $action -Trigger $trigger `
|
||||
-User "SYSTEM" -RunLevel Highest
|
||||
```
|
||||
|
||||
**Linux — systemd timer**
|
||||
|
||||
```ini
|
||||
# /etc/systemd/system/deployr.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/deployr update --all
|
||||
|
||||
# /etc/systemd/system/deployr.timer
|
||||
[Timer]
|
||||
OnCalendar=Sun 03:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
```
|
||||
|
||||
**macOS — a LaunchDaemon** running the same `update --all` on a
|
||||
`StartCalendarInterval` works identically. Keep it a daemon, not an agent:
|
||||
deployr needs root, and it drops to the console user itself when Homebrew is
|
||||
involved.
|
||||
|
||||
## Reading the results
|
||||
|
||||
```json
|
||||
{
|
||||
"action": "update",
|
||||
"host": "WS-014",
|
||||
"os": "windows",
|
||||
"total": 12,
|
||||
"changed": 3,
|
||||
"skipped": 9,
|
||||
"failed": 0,
|
||||
"reboot_required": true,
|
||||
"results": [
|
||||
{
|
||||
"app": "vlc",
|
||||
"status": "ok",
|
||||
"provider": "winget",
|
||||
"version": "3.0.21",
|
||||
"duration_ms": 18422
|
||||
},
|
||||
{
|
||||
"app": "linemgr",
|
||||
"status": "fail",
|
||||
"error": "winget: not available on this machine; direct: HTTP 404",
|
||||
"attempts": [
|
||||
{ "provider": "winget", "error": "not available on this machine" },
|
||||
{ "provider": "direct", "error": "HTTP 404" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`attempts` is the useful field when something fails: it lists every route that
|
||||
was tried and why each one did not work, which is usually enough to fix the
|
||||
catalog entry without logging into the machine.
|
||||
|
||||
Every run also appends to a log file:
|
||||
|
||||
- Windows: `C:\ProgramData\Deployr\logs\deployr.log`
|
||||
- macOS: `/Library/Logs/Deployr/deployr.log`
|
||||
- Linux: `/var/log/deployr/deployr.log`
|
||||
Reference in new issue
Block a user