mirror of
https://github.com/Sea-Haven-Industries/engineering-handbook.git
synced 2026-09-30 20:53:13 +00:00
* Update CDK version policy, Node 24 runtime, and GitHub Actions CI/CD - Pin blessed aws-cdk-lib version (2.253.1) with upgrade procedure - Update Lambda runtime default from Node 22 to Node 24 - Rewrite CI/CD page to reflect GitHub Actions reusable workflows (was still referencing CodePipeline/CodeBuild) * Add pre-push hook for npm ci validation Catches lock file drift locally before it breaks CI. Includes install instructions in git-workflow.md. * Add repo provisioning script Automates the new-repo checklist: GitHub repo creation, OIDC deploy role, repo secret, security features, CI/CD workflow stubs, and pre-push hook installation. Supports both SAM and CDK stack types. * Add shared VpnEc2Instance CDK construct Reference construct for the VPN-accessible EC2 pattern used by file-share and forgejo. Includes VPC/subnet lookup, SG, IAM role, encrypted EBS, and DLM snapshots. Copy into lib/constructs/. * Add post-deploy health check template Template script for project-specific health checks. Copy to scripts/health-check.sh — CD workflows run it automatically.
50 lines
1.7 KiB
Bash
Executable file
50 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Post-deploy health check template.
|
|
# Copy to your project as scripts/health-check.sh and customize.
|
|
# Called automatically by CD workflows after deploy.
|
|
# Args: $1 = stack name, $2 = AWS region
|
|
|
|
set -euo pipefail
|
|
|
|
STACK_NAME="${1:?Stack name required}"
|
|
REGION="${2:-us-east-1}"
|
|
|
|
echo "Running health checks for ${STACK_NAME}..."
|
|
|
|
# Example: verify a Lambda function is invocable
|
|
# FUNCTION_NAME="${STACK_NAME}-process-order"
|
|
# aws lambda invoke \
|
|
# --function-name "$FUNCTION_NAME" \
|
|
# --payload '{"healthCheck": true}' \
|
|
# --region "$REGION" \
|
|
# /tmp/health-check-response.json
|
|
# cat /tmp/health-check-response.json
|
|
|
|
# Example: verify an EC2 instance is running
|
|
# INSTANCE_ID=$(aws cloudformation describe-stacks \
|
|
# --stack-name "$STACK_NAME" \
|
|
# --query 'Stacks[0].Outputs[?OutputKey==`InstanceId`].OutputValue' \
|
|
# --output text --region "$REGION")
|
|
# STATE=$(aws ec2 describe-instances \
|
|
# --instance-ids "$INSTANCE_ID" \
|
|
# --query 'Reservations[0].Instances[0].State.Name' \
|
|
# --output text --region "$REGION")
|
|
# if [[ "$STATE" != "running" ]]; then
|
|
# echo "ERROR: Instance $INSTANCE_ID is $STATE, expected running"
|
|
# exit 1
|
|
# fi
|
|
# echo "Instance $INSTANCE_ID is running."
|
|
|
|
# Example: verify an API Gateway endpoint responds
|
|
# API_URL=$(aws cloudformation describe-stacks \
|
|
# --stack-name "$STACK_NAME" \
|
|
# --query 'Stacks[0].Outputs[?OutputKey==`ApiUrl`].OutputValue' \
|
|
# --output text --region "$REGION")
|
|
# HTTP_CODE=$(curl -sf -o /dev/null -w '%{http_code}' "$API_URL/health")
|
|
# if [[ "$HTTP_CODE" != "200" ]]; then
|
|
# echo "ERROR: API health endpoint returned $HTTP_CODE"
|
|
# exit 1
|
|
# fi
|
|
# echo "API endpoint healthy."
|
|
|
|
echo "All health checks passed."
|