This repository was archived by the owner on Mar 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnudeploy.sh
More file actions
executable file
·32 lines (30 loc) · 1.85 KB
/
nudeploy.sh
File metadata and controls
executable file
·32 lines (30 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# @describe nudeploy - deploy systemd services to multiple hosts over SSH
# @version 0.1.0
#
# @cmd deploy Apply changes idempotently: upload files on hash change, reload systemd on unit change, enable once, start/restart as needed
# @cmd status Show systemd status for the service on each host
# @cmd restart Restart the service on targets without syncing files
# @cmd hosts List hosts (optionally filtered by group); prints name/ip/port/user/group/enabled
# @cmd exec Run a command string or a playbook file on selected hosts
# @cmd download Download artifacts defined in [[downloads]] to download_dir and extract them
# @cmd copy Copy local files/dirs to remote hosts
#
# @option --config! Path to config TOML (default: ./nudeploy.toml)
# @option --service Service name from config (optional for deploy/status/restart; defaults to all services with enable=true)
# @option --group Filter targets by group from the config
# @option --hosts Comma-separated host aliases (overrides --group)
# @option --name For download/copy: comma-separated item names
# @flag --sudo Use sudo -n for remote privileged actions (install to /etc, systemctl)
# @flag --json Emit JSON records suitable for CI (changes/events/status per host)
# @flag --dry-run For deploy: show what would change without applying (formerly plan)
# @flag --verbose (-v) For exec: show every shell command and its output
#
# @example nudeploy deploy --service helix --group web --sudo
# @example nudeploy deploy --dry-run --service helix --hosts h1,h2
# @example nudeploy exec "uname -a" --hosts h1
# @example nudeploy exec ./playbooks/setup.nu --hosts h1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NU=${NU:-nu}
# Forward all user args to Nushell implementation.
exec "$NU" "$SCRIPT_DIR/nudeploy.nu" "$@"