# Personal Lifecycle Tracker — Deployment & Infrastructure Guide This directory contains the Infrastructure as Code (IaC) templates, configurations, and step-by-step operational playbooks for deploying the **Personal Lifecycle Tracker** across two completely independent environments: 1. **Development (`dev`)**: Uses the existing infrastructure baseline, configured for development testing, zero cost / free tier resources, isolated non-overlapping VPC networks (`10.1.0.0/16`), and dev service identifiers. 2. **Production (`production`)**: A second, independent copy of the infrastructure provisioned for high availability and production workloads, utilizing isolated VPC networks (`10.0.0.0/16`), production service identifiers, and production security policies. --- ## Live Production Deployment & Reviewer Endpoints (Criterion 8 — 2 Points) The production environment is live and reachable globally on AWS CloudFront CDN and AWS Lambda: - **Web Application UI (React 19 SPA)**: [https://d1ca9upoitnq9b.cloudfront.net/](https://d1ca9upoitnq9b.cloudfront.net/) - **Backend API Gateway & Healthcheck**: [https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/health](https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/health) - **Interactive Swagger Documentation**: [https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/docs](https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/docs) - **Interactive ReDoc Documentation**: [https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/redoc](https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/redoc) - **OpenAPI 3.1.0 JSON Specification**: [https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/openapi.json](https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/openapi.json) ### Pre-Seeded Reviewer Credentials - **Email**: `alex@example.com` - **Password**: `password123` - *(Or click "Sign Up" in the navigation bar to test zero-state registration)* ### Quick Terminal Verification Commands ```bash # Verify CloudFront CDN distribution curl -sI https://d1ca9upoitnq9b.cloudfront.net/ | grep -E "HTTP|server|via" # Verify Lambda Backend Healthcheck (PostgreSQL connected) curl -s https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/health # Verify Live JWT Authentication curl -s -X POST https://7ksomsylvke2uawuhhccbfr6hy0agzyb.lambda-url.ap-south-1.on.aws/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"alex@example.com","password":"password123"}' | grep -o '"email":"alex@example.com"' ``` --- ## Environment Architecture Matrix | Capability / Resource | Development Environment (`dev`) | Production Environment (`production`) | |---|---|---| | **Render Blueprint** | [`render.yaml`](../../render.yaml) | [`render.prod.yaml`](../../render.prod.yaml) | | **Render Services** | `personal-lifecycle-*-dev` | `personal-lifecycle-*-prod` | | **Render Plan** | Free tier (`free`) | Starter tier (`starter`) | | **Render Terraform** | [`terraform/render/`](../../terraform/render/) (`default = "dev"`) | [`terraform/render-prod/`](../../terraform/render-prod/) (`default = "production"`) | | **AWS Terraform** | [`terraform/aws/`](../../terraform/aws/) (Serverless Lambda + S3 + CDN) | [`terraform/aws-prod/`](../../terraform/aws-prod/) (Serverless Lambda + S3 + CDN) | | **AWS CloudFormation**| [`cloudformation/aws-serverless-lambda.yaml`](../../cloudformation/aws-serverless-lambda.yaml) | [`cloudformation/aws-serverless-lambda-prod.yaml`](../../cloudformation/aws-serverless-lambda-prod.yaml) | | **CI/CD Triggers** | Pushes to `dev`/`develop` or manual dispatch | Pushes to `main` or manual dispatch | | **Local Compose** | `docker-compose.yaml` (Ports: `8003`, `3003`, `5434`) | `docker-compose.prod.yml` (Port: `8088`, Caddy Proxy) | --- ## Supported Deployment Options | Target Platform | Tooling / IaC | Architecture Model | Cost / Tier | Guide Link | |---|---|---|---|---| | **Render (Dev)** | Render Blueprint (`render.yaml`) | Managed PostgreSQL + Docker Web Services (Backend + Caddy Frontend) | Free | [Render Deployment Guide](render.md) | | **Render (Prod)** | Render Blueprint (`render.prod.yaml`) | Managed PostgreSQL + Docker Web Services (Independent Copy) | Free / Starter | [Render Deployment Guide](render.md) | | **Render (IaC)** | Terraform (`terraform/render/` & `terraform/render-prod/`) | Declarative infrastructure management via Render Terraform Provider | Free / Starter | [Render Deployment Guide](render.md) | | **CI/CD** | GitHub Actions (`.github/workflows/ci.yml`) | Parallel Tests + Docker Compose E2E + GitHub OIDC Auth + Multi-Env Render Deploy | Free Tier Eligible | [CI/CD Pipeline Guide](ci-cd.md) | | **Production Promotion** | GitHub Actions (`.github/workflows/promote-dev-to-prod.yml`) | Manual dev→production promotion, conflict check, test gates, SemVer tagging, GitHub Release & live deploy | Free Tier Eligible | [Production Promotion Guide](ci-cd.md#7-dev-to-production-manual-promotion-workflow-promote-dev-to-prodyml) | | **AWS (Dev)** | Terraform (`terraform/aws/`) | Serverless Lambda + CloudFront CDN + S3 + On-Call Responder | Free Tier Eligible (~$0/mo) | [AWS Terraform Guide](aws-terraform.md) | | **AWS (Prod)** | Terraform (`terraform/aws-prod/`) | Serverless Lambda + CloudFront CDN + S3 + On-Call Responder | Free Tier Eligible (~$0/mo) | [AWS Terraform Guide](aws-terraform.md) | | **AWS (CFN)** | CloudFormation (`cloudformation/`) | 1-Click Serverless Stacks (`aws-serverless-lambda.yaml` and `aws-serverless-lambda-prod.yaml`) | Free Tier Eligible (~$0/mo) | [AWS CloudFormation Guide](aws-cloudformation.md) | --- ## Zero-Host-Runtime Tooling (via Docker) In accordance with the **Zero-Host-Runtime Mandate**, you do not need Terraform, AWS CLI, Python, or Node installed on your local workstation. All validations, formatting, and operations can be executed via containerized Makefile targets: ```bash # Validate ALL Terraform environments simultaneously (AWS Dev, AWS Prod, Render Dev, Render Prod) make tf-validate # Validate individual environments make tf-validate-aws # AWS Dev make tf-validate-aws-prod # AWS Production copy make tf-validate-render # Render Dev make tf-validate-render-prod# Render Production copy # Format all Terraform files make tf-fmt # Validate CloudFormation templates make cf-validate # Validates both dev and prod templates make cf-validate-dev # Dev template make cf-validate-prod # Production copy template # Test the local container stacks make up # Local development stack (hot reload) make prod-up # Local production stack (Caddy reverse proxy) make prod-ps make prod-down ``` --- ## Directory Layout ``` . ├── render.yaml # Render Blueprint (Dev Environment) ├── render.prod.yaml # Render Blueprint (Production Environment Copy) ├── cloudformation/ │ ├── aws-ec2-compose.yaml # AWS CloudFormation (Dev Environment: 10.1.0.0/16) │ └── aws-ec2-compose-prod.yaml # AWS CloudFormation (Production Copy: 10.0.0.0/16) ├── terraform/ │ ├── aws/ # AWS Terraform (Dev Environment) │ │ ├── versions.tf │ │ ├── variables.tf # Default environment: dev, VPC: 10.1.0.0/16 │ │ ├── vpc.tf │ │ ├── security_groups.tf │ │ ├── iam.tf │ │ ├── user_data.sh # Cloud-init Docker Compose bootstrapper │ │ ├── ec2.tf │ │ ├── eip.tf │ │ ├── oidc.tf │ │ ├── outputs.tf │ │ ├── terraform.tfvars.dev │ │ └── terraform.tfvars.example │ ├── aws-prod/ # AWS Terraform (Production Environment Copy) │ │ ├── versions.tf │ │ ├── variables.tf # Default environment: production, VPC: 10.0.0.0/16 │ │ ├── vpc.tf │ │ ├── security_groups.tf │ │ ├── iam.tf │ │ ├── user_data.sh │ │ ├── ec2.tf │ │ ├── eip.tf │ │ ├── oidc.tf │ │ ├── outputs.tf │ │ ├── terraform.tfvars.prod │ │ └── terraform.tfvars.example │ ├── render/ # Render Terraform (Dev Environment) │ │ ├── versions.tf │ │ ├── variables.tf # Default environment: dev, plan: free │ │ ├── main.tf │ │ ├── outputs.tf │ │ ├── terraform.tfvars.dev │ │ └── terraform.tfvars.example │ └── render-prod/ # Render Terraform (Production Environment Copy) │ ├── versions.tf │ ├── variables.tf # Default environment: production, plan: starter │ ├── main.tf │ ├── outputs.tf │ ├── terraform.tfvars.prod │ └── terraform.tfvars.example └── docs/deployment/ ├── README.md # This overview index ├── ci-cd.md # GitHub Actions CI/CD & Multi-Env deployment guide ├── render.md # Render Blueprint & Terraform guide (Dev & Prod) ├── aws-terraform.md # AWS Terraform execution guide (Dev & Prod) └── aws-cloudformation.md # AWS CloudFormation execution guide (Dev & Prod) ```