How ghadeer-elsalhawy/cd0157-server-deployment-and-containerization works
Project Type and Purpose
• This project is a starter repository focused on containerizing and deploying a simple Flask API. It walks users through building, testing, and deploying a containerized Flask app to a Kubernetes cluster using AWS EKS, CodePipeline, and CodeBuild.
• Key operations include building a Docker container for the Flask API, writing deployment configurations, and guiding the CI/CD process with AWS services alongside Kubernetes for production deployments.
File Structure
• Top-Level Files: Notice the presence of key files such as Dockerfile, main.py, requirements.txt, and CI/CD configuration files (buildspec.yml, ci-cd-codepipeline.cfn.yml, simple_jwt_api.yml). These indicate the core functionality (Flask API) and multiple deployment pipelines.
• Directories:
• .github contains CI workflow definitions.
• examples provide multiple deployment and cloudformation templates that illustrate how to deploy using various AWS resources (CloudFormation for EC2, VPN, and pipelines) and also include examples for deploying Flask apps.
• Other configuration files (aws-auth-patch.yml, iam-role-policy.json, trust.json) signal AWS-specific configurations and permission policies.
• The organization hints at a modular design where various deployment examples and CloudFormation templates offer flexibility in infrastructure deployment approaches.
Extract Additional Insight from the README
• The README emphasizes the deployment steps—from Docker containerization, local testing, and then full deployment on AWS EKS using CodePipeline and CodeBuild.
• It specifies key endpoints of the Flask API, which reinforces that the app is lightweight and designed for demonstration (health check, authentication, content retrieval).
• It lays out prerequisites and instructions for AWS CLI, eksctl, and kubectl—indicating a production-grade deployment pipeline with a Kubernetes cluster.
a. Main Components to Include:
• Source Code Repository (GitHub): Including CI workflows (.github folder) that trigger on code updates.
• Build and CI/CD Pipeline: This includes CodePipeline and CodeBuild stages. The buildspec.yml and CodePipeline CloudFormation template are central here.
• Docker Build Process: Represents Dockerfile-based container build of the Flask API.
• Container Registry: Though not explicitly shown, assume use of a container repository (like AWS ECR) where the built images are stored.
• Kubernetes Cluster (AWS EKS): The deployment target for the Docker container. This is where the production-ready Gunicorn-based Flask API will run.
• AWS Infrastructure Components: CloudFormation templates, IAM role policies, and other AWS resources (e.g., for secret storage, VPN configuration) are part of the deployment infrastructure.
• Testing: Indicate components for testing the Flask API (locally via main.py and test_main.py).
b. Relationships and Interactions:
• Docker build process as part of CodeBuild, outputting a container image that’s pushed to the container registry.
• Monitoring/health check endpoints as a feedback loop (for example, the “/” endpoint for health checks).
c. Architectural Patterns/Design Principles:
• A clear separation of concerns: the CI/CD pipeline, containerization, and deployment onto a managed Kubernetes service.
• The use of Infrastructure-as-Code (CloudFormation templates and CI/CD definitions) to manage AWS resources.
• Modular design, as shown by the presence of multiple example directories for CloudFormation and deployment scenarios.
d. Relevant Technologies, Frameworks, and Services:
• Flask (for the API)
• Docker (for containerization)
• Gunicorn (as the production server for Flask)
• AWS EKS (for Kubernetes hosting)
• AWS CodePipeline and CodeBuild (for CI/CD)
• CloudFormation (for infrastructure deployment)
• AWS IAM (for role and policy management)
Final Reminder
• Every AWS and deployment component (e.g., CloudFormation templates, IAM roles, and secret management) is reflected in the architecture.
• The primary goal is to capture the flow from source code management, through CI/CD, containerization, and eventual deployment onto AWS EKS.