How ehoang0106/containerized works
Project type and purpose
• This is a containerized full-stack web application: a Python Flask “orbwatch” service serving HTML/CSS/JS, running in Docker on AWS ECS, with a MySQL/MariaDB backend on AWS RDS. All AWS resources (VPC, subnets, ECS cluster, RDS, etc.) are provisioned via Terraform (split into terraform/network and terraform/infra).
File structure
• myapp/webapp
– app.py, orbwatch.py: Flask entrypoints and business logic
– static/, templates/: frontend assets and HTML templates
• Dockerfile + requirements.txt: container build instructions
• terraform/network: Terraform code for VPC, subnets, IGW, NAT, security groups
• terraform/infra: Terraform code for ECS cluster/Service/Task Definition, ALB, RDS instance, IAM roles, user-data templates
Extract architecture details from README
• Frontend: Flask app in Docker
• Containerization: Docker → AWS ECS (Fargate or EC2)
• Database: AWS RDS (MySQL/MariaDB)
• IaC: Terraform modules for network then application infrastructure
• Environment variables injected at runtime for DB connectivity
Main components & their interactions
a. Users & Clients
• Web browser/mobile app → HTTP(S) requests
b. Networking Layer (Terraform “network” module)
• VPC
• Public subnets + Internet Gateway (for ALB)
• Private subnets + NAT Gateway (for ECS tasks, if needed)
• Security Groups
c. Load Balancer
• AWS Application Load Balancer (deployed in public subnets)
• Listens on TCP/HTTP(S) 80/443
d. Container Compute (Terraform “infra” module)
• ECS Cluster
• ECS Service + Task Definition (Docker image “orbwatch”)
• Flows: ALB → ECS Service → Docker container (Flask)
e. Data Layer
• AWS RDS instance (MySQL/MariaDB) in private subnets
• ECS containers connect to RDS over private network
f. Infrastructure as Code
• Terraform drives creation of all above
• Two modules: network first, then infra (depends on network outputs)
Architectural patterns & principles
• Layered: Presentation (Flask templates), Application (Flask API), Data (RDS)
• Twelve-factor app: config via environment variables (DB_HOST, etc.)
• Immutable infrastructure: containers deployed via ECS with Terraform
• Infrastructure modularization: separate network vs. app modules