Skip to content

fixed the scale down policy config; #58

fixed the scale down policy config;

fixed the scale down policy config; #58

Workflow file for this run

name: Backend Workflow
on:
pull_request:
push:
branches:
- develop
- release
jobs:
flake8_checker:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install flake8
run: pip install flake8
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'flake8_checker' # NOTE: this needs to be the same as the job name
build-prod:
name: Build and push images
runs-on: ubuntu-latest
environment:
name: production
url: https://server.labs.thedeep.io/admin/
strategy:
matrix:
include:
- image: ./handlers/ecs/entryextraction/
ecr_repo: ENTRYEXTRACTION_REPO_NAME
- image: ./handlers/ecs/geolocations/
ecr_repo: GEOLOCATIONS_REPO_NAME
- image: ./handlers/ecs/ngrams/
ecr_repo: NGRAMS_REPO_NAME
- image: ./handlers/ecs/summarization_v2/
ecr_repo: SUMMARIZATION_V2_REPO_NAME
- image: ./handlers/ecs/textextraction/
ecr_repo: TEXTEXTRACTION_REPO_NAME
- image: ./handlers/ecs/topicmodeling/
ecr_repo: TOPICMODELING_REPO_NAME
- image: ./handlers/lambda/reliability
ecr_repo: RELIABILITY_REPO_NAME
if: github.ref == 'refs/heads/release'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push the image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets[matrix.ecr_repo] }}
IMAGE_TAG: latest
run: |
# Build a docker container and push it to ECR
cd ${{ matrix.image }}
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
terraform:
name: Terraform configurations
needs: build-prod
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./"
if: github.ref == 'refs/heads/release'
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.1.2
- name: Terraform init
id: init
run: terraform init -upgrade
- name: Terraform validate
id: validate
run: terraform validate
- name: Terraform plan
id: plan
run: terraform plan -var-file=prod.tfvars -no-color
- name: Terraform apply
id: apply
run: terraform apply -var-file=prod.tfvars -auto-approve -no-color