diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6495df3..f50dcd9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,7 @@ name: CI and deploy on: + workflow_dispatch: push: branches: [main] pull_request: @@ -30,7 +31,7 @@ jobs: deploy-frontend: name: Frontend → Cloudflare Pages - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' needs: validate runs-on: ubuntu-latest steps: @@ -62,7 +63,7 @@ jobs: deploy-backend: name: Backend → EC2 - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' needs: validate runs-on: ubuntu-latest permissions: diff --git a/infra/aws/README.md b/infra/aws/README.md index 5a01ccd..c1e9a6f 100644 --- a/infra/aws/README.md +++ b/infra/aws/README.md @@ -1,27 +1,27 @@ # TigerMap production infrastructure -TigerMap uses Cloudflare Pages for the web app and one EC2 instance for the +TigerMap uses Cloudflare Pages for the web app and the shared TigerApps-Combined EC2 host for the Fastify API and its local SQLite data. ## AWS resources -- API instance: `i-0e1651e5f2954427d` (`tigermap-api`) -- API Elastic IP: `3.91.107.148` -- API security group: `sg-052b6b922dce1a08e` (`tigermap-api-sg`) -- Instance role/profile: `TigerMapInstanceRole` +- API instance: `i-0b2bfc5624ab3f9bf` (`TigerApps-Combined`) +- API Elastic IP: `3.91.107.148` (preserved, mapped to secondary private IP `172.31.39.135`) +- API security group: `sg-0e59d8cec0a11e75b` (`TigerApps-Combined`) +- Instance profile: `HarnessEc2SsmProfile` - GitHub OIDC deploy role: `TigerMapGitHubDeployRole` - Encrypted runtime parameters: `/tigermap/production/*` The GitHub role is scoped to the `main` branch of the exact TigerAppsOrg -repository ID. It can only send an SSM command to the TigerMap instance and +repository ID. It can only send an SSM command to the Combined instance and read that command's result. No long-lived AWS key is stored in GitHub. The EC2 environment file remains the runtime source for the current service. Its values are also backed up as encrypted SSM parameters for recovery. Never commit decrypted parameter values. -The API security group exposes HTTP on port 80 for the Pages Function proxy. -Administrative access uses SSM, so the instance has no public SSH ingress. +The shared host exposes HTTP/HTTPS through nginx. The TigerMap virtual host +proxies to port 3001. Deployment uses SSM; the shared host also supports SSH. ## GitHub configuration @@ -29,7 +29,7 @@ Repository variables: - `AWS_REGION=us-east-1` - `AWS_DEPLOY_ROLE_ARN=arn:aws:iam::104733724423:role/TigerMapGitHubDeployRole` -- `EC2_INSTANCE_ID=i-0e1651e5f2954427d` +- `EC2_INSTANCE_ID=i-0b2bfc5624ab3f9bf` - `CLOUDFLARE_ACCOUNT_ID=e2744783298a24185adfbc07174ba2ae` - `VITE_CAMPUS_MAP_TOKEN` (public token embedded in the web bundle) - `VITE_CAMPUS_MAP_STYLE` @@ -42,3 +42,16 @@ Repository secrets: Backend deployment uses SSM. The production checkout is updated with a fast-forward-only merge, dependencies are installed from the lockfile, and the API is restarted only after those steps succeed. + +## Consolidation — 2026-11-20 + +The original API instance was migrated to Combined. `/home/ubuntu/TigerMap`, +its SQLite databases and images, runtime environment, Bun binary, and the +`tigermap-api` systemd service retain their existing paths. The public API IP +and Cloudflare Pages API_HOST continue to work unchanged. Secondary addresses +are persisted in `/etc/netplan/60-consolidated-apps.yaml`. + +The GitHub repository variable and `DeployTigerMapOnly` IAM policy must both +target Combined. The workflow supports manual deployment as well as main pushes. +Because this is a shared host, avoid host-wide restarts or cleanup in deployment +commands; restart only `tigermap-api`. diff --git a/infra/aws/github-deploy-policy.json b/infra/aws/github-deploy-policy.json index 15cc127..23821b6 100644 --- a/infra/aws/github-deploy-policy.json +++ b/infra/aws/github-deploy-policy.json @@ -6,7 +6,7 @@ "Effect": "Allow", "Action": "ssm:SendCommand", "Resource": [ - "arn:aws:ec2:us-east-1:104733724423:instance/i-0e1651e5f2954427d", + "arn:aws:ec2:us-east-1:104733724423:instance/i-0b2bfc5624ab3f9bf", "arn:aws:ssm:us-east-1::document/AWS-RunShellScript" ] },