Skip to content

Add LocalStack deployment for local E2E testing#77

Merged
dwsmith1983 merged 2 commits into
mainfrom
feat/localstack-deploy
Apr 16, 2026
Merged

Add LocalStack deployment for local E2E testing#77
dwsmith1983 merged 2 commits into
mainfrom
feat/localstack-deploy

Conversation

@dwsmith1983
Copy link
Copy Markdown
Owner

Summary

Adds deploy/localstack/ with build + deploy scripts that run the full Interlock stack against LocalStack Community:

  • Six Go Lambdas built as distroless zips with host-arch detection (arm64/amd64)
  • DynamoDB tables with streams, EventBridge custom bus + rules, SQS alert queue, IAM roles
  • Step Functions state machine rendered from production ASL
  • Event source mappings: DynamoDB Stream -> stream-router, SQS -> alert-dispatcher
  • Docker network + LocalStack Lambda executor configured for container-to-container endpoint resolution

What's skipped

EventBridge Scheduler (LocalStack Pro only). The sla-monitor Lambda no-ops scheduler API calls when SKIP_SCHEDULER=true; all other SLA logic (deadline calculation, event publishing) runs normally.

Usage

make -f deploy/localstack/Makefile localstack-all

Adds deploy/localstack/ so the full Interlock stack can be smoke-tested
against LocalStack Community without an AWS account.

- build.sh builds all 6 Lambda handlers for the host arch (arm64/amd64)
  as linux bootstrap binaries under deploy/localstack/dist/
- deploy.py (boto3) provisions IAM roles, 4 DynamoDB tables with streams,
  SQS alerts queue, EventBridge bus + rules, all 6 Lambdas, Step Functions
  state machine, and event source mappings. Mirrors the Terraform shape.
- Makefile wires localstack-up/build/deploy/smoke/teardown targets.
- README documents the quick-start, what's skipped vs production
  (EventBridge Scheduler is Pro-only, CloudWatch alarms, KMS SQS), and
  the verification smoke test.

To handle the Pro-only EventBridge Scheduler dependency, introduces a
SKIP_SCHEDULER env var guard:

- lambda.SkipScheduler() helper reads SKIP_SCHEDULER=true once per call.
- Applied at every scheduler.CreateSchedule / DeleteSchedule site:
  sla_monitor.go (handleSLASchedule, handleSLACancel, createOneTimeSchedule)
  sla/cancel.go, sla/schedule.go (sub-package mirrors)
  watchdog_sla.go, watchdog/sla.go (proactive scheduling entry points)
- When set, scheduler calls are no-op'd and logged; the rest of the SLA
  logic (calculation, cancellation verdict, event publish) runs unchanged
  so LocalStack smoke tests exercise the full handler flow.
- deploy.py sets SKIP_SCHEDULER=true only on the sla-monitor Lambda so
  production Lambdas are unaffected.

Also ignores deploy/localstack/dist/ (build artifacts, ~124MB of zips).

Tests: go build ./... and go test -race ./... both pass unchanged.
Build script auto-detects host architecture and builds all six Go
Lambdas as distroless zip packages. Python boto3 deployer creates
DynamoDB tables with streams, EventBridge custom bus with routing
rules, SQS alert queue, IAM roles, event source mappings, and the
Step Functions state machine, matching the production Terraform
resource shape. Lambda containers run on a dedicated Docker network
to reach LocalStack by service name. SLA monitor env var guard
no-ops EventBridge Scheduler calls when SKIP_SCHEDULER is set,
preserving the production code path while enabling deployment to
LocalStack Community (where Scheduler is a Pro-only service).
@github-actions github-actions Bot added lambda Lambda handlers deploy Deployment and ASL docs Documentation labels Apr 16, 2026
@dwsmith1983 dwsmith1983 self-assigned this Apr 16, 2026
@dwsmith1983 dwsmith1983 merged commit 00c94d6 into main Apr 16, 2026
3 checks passed
@dwsmith1983 dwsmith1983 deleted the feat/localstack-deploy branch April 16, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy Deployment and ASL docs Documentation lambda Lambda handlers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant