danrleypereira / JWTDotNetAPIWithRedux

1 stars 0 forks source link

Setup Full Stack CI/CD Pipeline with AWS Amplify and AWS AppRunner #13

Open danrleypereira opened 1 year ago

danrleypereira commented 1 year ago

Proposed Solution

Implement a full stack CI/CD pipeline using GitHub Actions for integration, AWS Amplify for frontend (React) deployment, AWS EC2 for backend (.NET Core API) deployment environment, and AWS CodeDeploy for backend deployment automation.

The proposed workflow should include the following steps: Code Commit: Developers commit the code to the GitHub repository. Any new commit to the main branch triggers the CI/CD pipeline. Build: GitHub Actions initiates the build process and runs the test cases. Amplify Deployment: If the build and tests are successful for the React app, GitHub Actions triggers a deployment process using AWS Amplify. CodeDeploy Deployment: If the build and tests are successful for the .NET Core API, GitHub Actions triggers a deployment process using AWS CodeDeploy. Deployment: AWS Amplify deploys the latest version of the React application. Simultaneously, AWS CodeDeploy deploys the latest version of the .NET Core API to an AWS EC2 instance. The successful deployment results in the latest full-stack application running with the React frontend on Amplify and .NET API on EC2.

Acceptance Criteria

A commit to the main branch should trigger the pipeline automatically. The pipeline should successfully build both the frontend and backend applications and run all the test cases. If the build or tests fail, the pipeline should halt and notify the team. If the build and tests are successful, AWS Amplify should automatically deploy the React application, and AWS CodeDeploy should automatically deploy the .NET Core API to AWS EC2. On successful deployment, the team should be notified.

Tasks

Create an IAM role with the necessary permissions for AWS CodeDeploy and EC2. Set up AWS CodeDeploy to deploy the .NET Core API to the EC2 instance. Set up AWS Amplify to deploy the React application. Write GitHub Actions workflow file for CI/CD, which includes building and testing for both frontend and backend, and deployment triggers for Amplify and CodeDeploy. Test the pipeline by making a commit to the main branch. Document the pipeline setup and workflow for future reference.

danrleypereira commented 1 year ago

Nos últimos dias o AppRunner parou realizar a pipeline de CD corretamente: image

danrleypereira commented 1 year ago

O tempo de build do Amplify está sendo muito longo, ocasionando um UNSUCCESSFUL BUILD. Para resolver preciso registrar o Dockerfile (karkar-react/Dockerfile) no ECR para diminuir o tempo de build.

PS.: o Amplify usa uma imagem padrão que instala python, dotnet, hugo, node etc.