feat(aw-rus): sync deploy stack, install kit, and health checks

This commit is contained in:
igor04091968
2026-05-21 15:16:23 +03:00
parent 45f9907450
commit 99143b108b
67 changed files with 6449 additions and 681 deletions
+6 -1
View File
@@ -6,7 +6,7 @@ cd "$ROOT_DIR"
KIT_DIR="install-kit-awindows-20260427-211240"
python - <<'PY'
python3 - <<'PY'
from pathlib import Path
import hashlib
@@ -21,11 +21,16 @@ def sha(path: Path) -> str:
all_compared=[]
mismatches=[]
missing_in_repo=[]
allowed_kit_only_prefixes=('server-configs-' ,)
allowed_kit_only_files={'README-INSTALL-KIT.txt'}
for kp in sorted(p for p in kit.rglob('*') if p.is_file() and p.name!='MANIFEST.txt'):
rel=kp.relative_to(kit)
rp=root/rel
if not rp.exists():
rel_str=str(rel)
if rel_str in allowed_kit_only_files or rel_str.startswith(allowed_kit_only_prefixes):
continue
missing_in_repo.append(str(rel))
continue
all_compared.append(str(rel))
+1 -1
View File
@@ -52,7 +52,7 @@ fi
if [[ -t 0 ]]; then
prompt_secret AW_SSH_PASSWORD "Enter SSH password for aw_server (root@10.10.10.13)"
prompt_secret AW_WINRM_PASSWORD "Enter WinRM password for aw_windows (192.168.100.21)"
prompt_secret AW_WINRM_PASSWORD "Enter WinRM password for aw_windows (192.168.100.18)"
fi
if [[ -z "${AW_SSH_PASSWORD:-}" || -z "${AW_WINRM_PASSWORD:-}" ]]; then
+125
View File
@@ -0,0 +1,125 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
KIT_DIR="install-kit-awindows-20260427-211240"
ZIP_ARCHIVE="${KIT_DIR}.zip"
TAR_ARCHIVE="${KIT_DIR}.tar.gz"
SERVER_CONFIG_DIR="${KIT_DIR}/server-configs-192.168.100.18"
OLD_SERVER_CONFIG_DIR="${KIT_DIR}/server-configs-192.168.100.21"
TMP_SERVER_CONFIG_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_SERVER_CONFIG_DIR"' EXIT
copy_file() {
local src="$1"
local dest="$2"
mkdir -p "$(dirname "$dest")"
cp "$src" "$dest"
}
sync_tree() {
local base="$1"
shift
for rel in "$@"; do
copy_file "$rel" "${KIT_DIR}/${rel}"
done
}
if [[ -d "$OLD_SERVER_CONFIG_DIR" ]]; then
cp "$OLD_SERVER_CONFIG_DIR"/*.deployment-config.json "$TMP_SERVER_CONFIG_DIR"/
fi
rm -rf "${KIT_DIR}/ansible" "${KIT_DIR}/aw-server" "${KIT_DIR}/windows" "${KIT_DIR}/server-configs-"*
ansible_files=(
ansible/README.md
ansible/deploy_aw_pfsense_poller.yml
ansible/deploy_aw_server.yml
ansible/deploy_aw_windows.yml
ansible/group_vars/all.example.yml
ansible/group_vars/pfsense-poller.example.yml
ansible/group_vars/proxmox-matrix.example.yml
ansible/group_vars/proxmox.example.yml
ansible/group_vars/windows.example.yml
ansible/install_full_stack.yml
ansible/inventory.example.ini
ansible/provision_proxmox_ct_and_deploy_aw.yml
ansible/provision_proxmox_ct_matrix_and_deploy_aw.yml
ansible/tasks/provision_ct_and_deploy_aw.yml
)
aw_server_files=(
aw-server/activitywatch-server.service
aw-server/apply_webui_ru_patch.sh
aw-server/aw-host-groups.json
aw-server/aw-ru-patch.js
aw-server/aw-rus-healthd.py
aw-server/aw-rus-healthd.service
aw-server/aw-rus-healthd.timer
aw-server/aw-server.env.example
aw-server/aw-sw-cleanup.js
aw-server/aw-worktime-api.py
aw-server/aw-worktime-api.service
aw-server/aw-worktime-panel.js
aw-server/install_aw_server.sh
aw-server/settings/classes-worktime.json
aw-server/settings/views-default.json
)
windows_files=(
windows/ActivityWatch.Windows.Common.psd1
windows/ActivityWatch.Windows.Common.psm1
windows/browser-domains-native-collector.ps1
windows/deploy-domain-users.ps1
windows/deploy-ensemble.ps1
windows/deploy-single-user.ps1
windows/dlp-endpoint-signals-collector.ps1
windows/dlp-policy.example.json
windows/email-outbound-collector.ps1
windows/hardening-recovery.ps1
windows/migrate-awatch-rus-paths.ps1
windows/validate-deployment.ps1
windows/web-category-rules.example.json
windows/worktime-session-collector.ps1
)
sync_tree ansible "${ansible_files[@]}"
sync_tree aw-server "${aw_server_files[@]}"
sync_tree windows "${windows_files[@]}"
mkdir -p "$SERVER_CONFIG_DIR"
if compgen -G "$TMP_SERVER_CONFIG_DIR/*.deployment-config.json" >/dev/null; then
cp "$TMP_SERVER_CONFIG_DIR"/*.deployment-config.json "$SERVER_CONFIG_DIR"/
fi
cat > "${KIT_DIR}/README-INSTALL-KIT.txt" <<'EOF'
ActivityWatch DetMir Windows Install Kit
Includes:
- windows/* (deploy scripts, collectors, common module, configs/examples)
- ansible/* (Windows and AW server playbooks, examples, inventory, tasks)
- aw-server/* (server installer, health orchestrator, RU patch loader, host groups, default settings)
- server-configs-192.168.100.18/* (working Windows/RDP config snapshots)
Source:
- Local project snapshot at build time.
EOF
python3 - <<'PY'
from pathlib import Path
import hashlib
root = Path('install-kit-awindows-20260427-211240')
manifest = root / 'MANIFEST.txt'
files = sorted(p for p in root.rglob('*') if p.is_file() and p.name != 'MANIFEST.txt')
with manifest.open('w', encoding='utf-8') as handle:
for path in files:
digest = hashlib.sha256(path.read_bytes()).hexdigest()
handle.write(f"{digest} {path.as_posix()}\n")
PY
rm -f "$ZIP_ARCHIVE" "$TAR_ARCHIVE"
zip -rq "$ZIP_ARCHIVE" "$KIT_DIR"
tar -czf "$TAR_ARCHIVE" "$KIT_DIR"
+3 -3
View File
@@ -14,7 +14,7 @@ required_files=(
"$KIT_DIR/README-INSTALL-KIT.txt"
"$KIT_DIR/windows/deploy-ensemble.ps1"
"$KIT_DIR/windows/validate-deployment.ps1"
"$KIT_DIR/ansible/deploy_aw_windows_phase2.yml"
"$KIT_DIR/ansible/deploy_aw_windows.yml"
"$KIT_DIR/aw-server/install_aw_server.sh"
)
@@ -27,7 +27,7 @@ echo "[2/4] Manifest checksum verification"
sha256sum -c "$MANIFEST" >/dev/null
echo "[3/4] Manifest completeness"
python - <<'PY'
python3 - <<'PY'
from pathlib import Path
import sys
kit=Path('install-kit-awindows-20260427-211240')
@@ -54,7 +54,7 @@ print(f'MANIFEST complete: {len(actual_set)} files tracked')
PY
echo "[4/4] Archive composition check"
python - <<'PY'
python3 - <<'PY'
from pathlib import Path
import tarfile, zipfile, sys
kit_prefix='install-kit-awindows-20260427-211240/'