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
- :one: *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.
- :two: *Infrastructure Provisioning with Terraform*: The necessary AWS infrastructure, including the ECR repository, ECS cluster, and networking resources, is defined and managed using Terraform.
- :three: *ECS Task Deployment*: The Docker image from ECR is deployed as an ECS task, running the Streamlit application in a containerized environment.
## Detailed Steps
1.**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.
2.**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`.
3.**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.
The [saeiagendocuref infrastructure](https://git.cloud.safran/safranae/saeawspfiagendocuref/saeiagendocuref/frontend-chatbot/infrastructure/-/tree/main) should be deployed in your AWS account