Skip to content

Commit

Permalink
Revert "Merge branch 'FEATURE/aws' into main"
Browse files Browse the repository at this point in the history
This reverts commit 6921618, reversing
changes made to bbade8b.
  • Loading branch information
ahoplock committed Nov 15, 2023
1 parent 20dd207 commit ade9c26
Show file tree
Hide file tree
Showing 46 changed files with 54,123 additions and 2,601 deletions.
200 changes: 6 additions & 194 deletions .github/workflows/aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,202 +17,14 @@ on:
version:
description: 'Version Number'
required: false
# push:
# branches:
# - main
# pull_request:

concurrency: ${{ github.event.inputs.environment }}

env:
DOCKER_TAGS: ${{ secrets.DOCKER_TAGS }}
IMAGE_ID: ${{ secrets.AWS_ECR_URI }}
IMAGE_NAME: bcer-api
TFC_WORKSPACE: ${{ github.event.inputs.environment }}
TF_VERSION: 1.3.7
TG_SRC_PATH: Terraform
TG_VERSION: 0.44.5

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

zap_scan:
description: 'Run ZAP Scan'
type: boolean
required: false
jobs:
docker_push:
name: Docker Push
environment: ${{ github.event.inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: FEATURE/aws

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_DEPLOY_ROLE_ARN }}
aws-region: ca-central-1

- name: Amazon ECR Login
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: 'true'

- name: Cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker images (run migrations)
if: inputs.migrations == true
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
context: packages/bcer-api/app
file: packages/bcer-api/app/Dockerfile.aws.migrations
push: true
tags: ${{ env.DOCKER_TAGS }}

- name: Build and push Docker images
if: inputs.migrations == false
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
context: packages/bcer-api/app
file: packages/bcer-api/app/Dockerfile.aws
push: true
tags: ${{ env.DOCKER_TAGS }}

terraform_apply:
name: Terraform Apply
environment: ${{ github.event.inputs.environment }}
runs-on: ubuntu-latest
needs: docker_push
steps:
- name: Set TF_VAR_TIMESTAMP
run: echo "TF_VAR_TIMESTAMP=$(date --rfc-3339=seconds)" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_DEPLOY_ROLE_ARN }}
aws-region: ca-central-1

- name: HashiCorp - Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}

- name: Terragrunt installer
uses: autero1/action-terragrunt@v1.3.2
with:
terragrunt_version: ${{ env.TG_VERSION }}

- name: Terragrunt Apply
working-directory: ${{ env.TG_SRC_PATH }}/${{ env.TFC_WORKSPACE }}
env:
app_image: ${{ env.IMAGE_ID }}:${{ github.sha }}
LICENSE_PLATE: ${{ secrets.MY_LICENSE_PLATE }}
run: |
terragrunt run-all apply --terragrunt-non-interactive
build_jobs:
name: Build Jobs
if: inputs.frontends == true
environment: ${{ github.event.inputs.environment }}
nothing:
name: nothing
runs-on: ubuntu-latest
needs: terraform_apply
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14

- name: Build project shared components
run: |
cd packages/bcer-shared-components
npm install
npm run build
- name: Copy env file to retailer app
run: |
cd packages/bcer-retailer-app
cp .config/.env.aws.${{ github.event.inputs.environment }} app/.env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_DEPLOY_ROLE_ARN }}
aws-region: ca-central-1

- name: Build project retailer app
run: |
cd packages/bcer-retailer-app/app
npm install
npm run build
- name: Upload to S3 bucket retail app
run: |
cd packages/bcer-retailer-app/app/build
aws s3 sync . s3://bcer-${{ github.event.inputs.environment }}/retailer --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: ca-central-1

- name: Copy env file to bcer-data-portal
run: |
cd packages/bcer-data-portal
cp .config/.env.aws.${{ github.event.inputs.environment }} app/.env
- name: Build project data portal frontend
run: |
cd packages/bcer-data-portal/app
npm install
npm run build
- name: Upload to S3 bucket data portal
run: |
cd packages/bcer-data-portal/app/build
aws s3 sync . s3://bcer-${{ github.event.inputs.environment }}/portal --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: ca-central-1
# ----------------------------Commenting out while trying to get rollback working-------------------------------
# bump_version:
# runs-on: ubuntu-latest
# permissions: write-all

# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: '0'

# - name: Bump version and push tag
# uses: anothrNick/github-tag-action@1.59.0 # Don't use @master unless you're happy to test the latest version
# env:
# DEFAULT_BUMP: major
# DEFAULT_BRANCH: main
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# RELEASE_BRANCHES : main
# WITH_V: true
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ cypress/videos/
# .tfstate files
*.tfstate
*.tfstate.*
.terraform.lock.hcl
**/.terragrunt-cache/**

# Crash log files
crash.log
Expand Down
11 changes: 0 additions & 11 deletions Database Scripts/aurora_create_db.sql

This file was deleted.

10 changes: 6 additions & 4 deletions Infrastructure/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ data "aws_alb_listener" "front_end" {
}

resource "aws_alb_target_group" "app" {
name = "${var.application}-${var.target_env}-target-group"
name = "bcer-dev-target-group"
port = var.app_port
protocol = "HTTP"
vpc_id = data.aws_vpc.main.id
target_type = "ip"
deregistration_delay = 30
lifecycle {
ignore_changes = [name]
create_before_destroy = true
}
stickiness {
type = "lb_cookie"

}

health_check {
Expand All @@ -36,7 +37,7 @@ resource "aws_alb_target_group" "app" {
unhealthy_threshold = "2"
}

tags = local.common_tags
tags = local.common_tags
}

resource "aws_lb_listener_rule" "host_based_weighted_routing" {
Expand All @@ -48,9 +49,10 @@ resource "aws_lb_listener_rule" "host_based_weighted_routing" {
type = "forward"
target_group_arn = aws_alb_target_group.app.arn
}
#figure out what to place here
condition {
path_pattern {
values = ["/*"]
}
}
}
}
51 changes: 0 additions & 51 deletions Infrastructure/api-gateway.tf

This file was deleted.

Loading

0 comments on commit ade9c26

Please sign in to comment.