How claudio888/getip-infra-deploy-gaction works
Project Type and Purpose
• This is an “Infrastructure-as-Code” (IaC) repository for the getip-app, composed of Packer and Terraform configurations.
• It builds a custom AWS AMI (with Docker, Docker-Compose, AWS CLI, Python3) and then uses Terraform (with workspaces) to deploy Blue/Green environments (EC2, S3, Security Groups, local hosts file).
File Structure Highlights
• Top-level directories:
• .github/workflows: CI pipeline definition (ci.yml)
• packer: Packer image.json, setup.sh, and test script
• terraform: main.tf, modules (ec2, s3, security-group, localfile), vars, workspaces (dev-blue, dev-green), outputs.tf
• Key patterns: separation of image build (Packer) vs. infrastructure provisioning (Terraform), use of Terraform workspaces for immutable Blue/Green deployments.
README Insights
• Describes Packer custom image and Terraform resources.
• Explains Blue/Green deployment via Terraform workspaces (dev-blue vs. dev-green).
• Mentions Ansible role “get-hosts” in getip-app repo for dynamic hosts file in deployment (external to this repo).
• Lists AWS prerequisites (IAM keys, ECR, PEM key).
a. Main Components to Show
• Developer Workstation / CI (GitHub Actions)
• Packer Process (builds and pushes AMI to AWS)
• Terraform Process (plan/apply with workspace)
• AWS Cloud:
• EC2 Instances (blue group & green group) using the custom AMI
• S3 Bucket(s) for application logs or state (if used)
• Security Groups controlling ingress/egress
• Localfile resource producing hosts file for Ansible
• (Optional) Ansible Controller pointing at EC2 instances via generated hosts file
b. Relationships & Data Flows
• Flow from Terraform localfile → hosts file → Ansible (in getip-app)
• In AWS, show EC2 ↔ Security Group, EC2 ↔ S3 (if the app writes to S3)
c. Architectural Patterns & Design Principles
• Immutable Infrastructure: Packer-built AMI as golden image
• Blue/Green deployments via Terraform workspaces
• IaC modularity: separate modules/resources for EC2, S3, security groups, localfile
• CI/CD integration: GitHub Actions automates packer build & Terraform apply
d. Technologies & Frameworks
• Packer (image.json, setup.sh)
• Terraform (HCL, workspaces, modules)
• AWS (EC2, S3, IAM, Security Groups)
• Localfile provisioner
• (External) Ansible for application deployment