Este projeto é um sistema de gerenciamento de pedidos desenvolvido para uma lanchonete em expansão. A solução de software é projetada para ser responsiva tanto em plataformas Web quanto Mobile. O backend, documentado e acessível via Swagger, permite uma administração eficiente e integrada dos pedidos, garantindo escalabilidade e facilidade de manutenção.
Você encontrará todos os passos do nosso projeto através deste link na nossa Plataforma de Documentação.
The pipeline build-and-deploy is designed to build and push container images to Amazon ECR and deploy them to an EKS cluster based on specific triggers.
Note: This step is crucial to ensure a secure connection with AWS resources. Credentials are necessary for the pipeline to authenticate and interact with AWS ECR and EKS.
Update the repository settings under Secrets and variables
> Actions
with the following values:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
The pipeline is triggered by the following events:
- Issue Comment: When a comment is created, edited, or deleted on an issue that contains
/deploy-dev
- Push: When code is pushed to the
main
branch.
The following environment variables are defined for use throughout the pipeline:
AWS_REGION
: The AWS region where resources are located (us-east-1
).ECR_REPOSITORY
: The ECR repository name (app/web
).EKS_CLUSTER_NAME
: The EKS cluster name (EKS-lanchonete-cluster
).
This job runs on ubuntu-latest
and is executed if the event is an issue comment or a push to the main
branch.
-
Checkout Repository
- Uses the
actions/checkout@v4
action to check out the repository.
- Uses the
-
Check for Deploy-Dev Comment
- Checks if the event is an issue comment containing
/deploy-dev
and prints a message if true.
- Checks if the event is an issue comment containing
-
Versioning Image
- Determines the image tag based on the event type:
- Production: using
push
events to themain
branch, increments the semantic version, considering the main branch as production. - Development: it is triggered using the commit SHA with a
-dev
suffix.
- Production: using
- Determines the image tag based on the event type:
-
Configure AWS Credentials
- Uses the
aws-actions/configure-aws-credentials@v1
action to configure AWS credentials using secrets.
- Uses the
-
Login to ECR Registry
- Uses the
aws-actions/amazon-ecr-login@v1
action to log in to the ECR registry.
- Uses the
-
Build and Push the Container Image
- Builds and pushes the container image to the ECR repository using the tag.
-
Commit and Push Updated Version
- Commits and pushes the updated version file if the event is a push to the
main
branch.
- Commits and pushes the updated version file if the event is a push to the
-
Setup Kubeconfig
- Sets up the kubeconfig for the EKS cluster using AWS CLI.
-
Deploy Application to Kubernetes Cluster
- Deploys the application to the Kubernetes cluster in the
development
namespace if the event is an issue comment containing/deploy-dev
. - Deploys the application to the
production
namespace on the EKS cluster when a commit is pushed to themain
branch after merging a pull request.
- Deploys the application to the Kubernetes cluster in the
The deployment logic varies based on the environment:
- Development Environment: Triggered by issue comments containing
/deploy-dev
. - Production Environment: Triggered by pushes to the
main
branch.
The deployment process includes:
- Setting the environment and kustomize directory.
- Checking and creating the namespace if it doesn't exist.
- Updating the image in the kustomize configuration.
- Applying the Kubernetes resources using
kubectl
.