mirror of
https://github.com/Sea-Haven-Industries/apm-wo-analysis.git
synced 2026-09-30 15:53:15 +00:00
Stand up the Phase 0 CDK scaffold for the daily APM work-order analysis pipeline: two-stack CDK app (pipeline + grafana), classifier and slack-post Lambda packages, dashboards-as-code, the local drop-folder uploader, and a classifier smoke-test placeholder. Wire CI/CD to the org reusable workflows: ci.yaml -> ci-python-sam (ruff + cdk synth) and deploy.yaml -> cd-cdk (OIDC, cdk deploy --all). Pin aws-cdk-lib==2.253.1; Lambdas target Python 3.12 / arm64. Rewrite .gitignore to the org Python-CDK standard so the source-of- truth files (CLAUDE.md, docs/, .claude/agents) are tracked while build artifacts (.venv, cdk.out, caches) stay ignored. Domain logic, stack resources, and dashboards are stubbed and filled in across Phases 1-5 (docs/BUILD.md). cdk synth is green for both stacks; ruff check/format pass.
29 lines
1.2 KiB
Bash
Executable file
29 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# apm-wo-analysis local drop-folder uploader (optional zero-touch ingestion).
|
|
#
|
|
# Mirrors the stampli-drop-folder pattern. When deployed, BOTH this script and
|
|
# the watched folder must live OUTSIDE ~/Documents (macOS TCC sandbox — see the
|
|
# macos-tcc-launchd memory). Suggested install locations:
|
|
# script: ~/Library/Application Support/seahaven/apm-wo-drop/upload.sh
|
|
# folder: ~/APM-WO-Drop
|
|
#
|
|
# Triggered by the launchd agent (scripts/com.seahaven.apm-wo-drop.plist) on a
|
|
# WatchPaths change. Uploads each new export to the raw/ prefix, then moves it to
|
|
# a local processed/ subfolder. Uses a least-privilege local AWS profile scoped
|
|
# to s3:PutObject on raw/ only. The classifier Lambda is S3-triggered from there.
|
|
set -euo pipefail
|
|
|
|
DROP_DIR="${APM_WO_DROP_DIR:-$HOME/APM-WO-Drop}"
|
|
PROCESSED_DIR="$DROP_DIR/processed"
|
|
BUCKET="apm-wo-analysis-exports-328440206208"
|
|
PROFILE="${APM_WO_AWS_PROFILE:-apm-wo-drop}"
|
|
|
|
mkdir -p "$PROCESSED_DIR"
|
|
|
|
shopt -s nullglob
|
|
for f in "$DROP_DIR"/*.xlsx "$DROP_DIR"/*.csv; do
|
|
[ -e "$f" ] || continue
|
|
name="$(basename "$f")"
|
|
aws --profile "$PROFILE" s3 cp "$f" "s3://${BUCKET}/raw/${name}"
|
|
mv "$f" "$PROCESSED_DIR/$name"
|
|
done
|