No description
backend | ||
docs | ||
envs | ||
gitlab-ci | ||
src | ||
.gitignore | ||
.gitlab-ci.yml | ||
.pre-commit-config.yaml | ||
apigateway.tf | ||
data.tf | ||
ecs_autoscaling.tf | ||
ecs_service_frontend.tf | ||
ecs_task_definition_frontend.tf | ||
iam.tf | ||
lambda.tf | ||
locals.tf | ||
openapi.template.yaml | ||
providers.tf | ||
README.md | ||
variables.tf | ||
version.tf |
RAG Pattern :: Backend
This repository hosts the code for the frontend application built with Streamlit. The deployment process involves building a Docker image, pushing it to Amazon Elastic Container Registry (ECR), and running it as an ECS task using Terraform for infrastructure management.
Deployment Workflow
- 1️⃣ Docker Image Build and Push to ECR: The frontend application is containerized using Docker. The GitLab CI/CD pipeline builds the image and pushes it to an Amazon ECR repository.
- 2️⃣ Infrastructure Provisioning with Terraform: The necessary AWS infrastructure, including the ECR repository, ECS cluster, and networking resources, is defined and managed using Terraform.
- 3️⃣ ECS Task Deployment: The Docker image from ECR is deployed as an ECS task, running the Streamlit application in a containerized environment.
Detailed Steps
-
Docker Image Build & Push:
- The CI/CD pipeline builds the Streamlit application into a Docker image.
- The image is tagged with the commit SHA for version control.
- The image is pushed to Amazon ECR for storage.
-
Terraform-Based Infrastructure Deployment:
- The Terraform configuration provisions:
- An ECR repository for storing images.
- An ECS cluster with task definitions.
- Security groups, IAM roles, and networking components.
- The infrastructure is applied using GitLab CI/CD with
terraform apply
.
- The Terraform configuration provisions:
-
Deploying the Application to ECS:
- The ECS task definition is updated with the latest image.
- The ECS service is restarted to apply the new task definition.
- Load balancing and auto-scaling ensure availability and scalability.
ARCHITECTURE
In this architecture:
- The frontend container runs on Amazon ECS with Fargate.
- The container image is stored and retrieved from Amazon ECR.
- Network access is managed through security groups and, optionally, an Application Load Balancer.
- Terraform automates AWS infrastructure provisioning.
This setup ensures an automated, scalable, and reliable deployment pipeline for the frontend application.
DEPLOYEMENT
Requirements
The saeiagendocuref infrastructure should be deployed in your AWS account