Skip to content

Commit

Permalink
chore: organizing the project to be open-source.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-jhon committed Mar 11, 2024
1 parent 026c783 commit 198e97a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 88 deletions.
6 changes: 0 additions & 6 deletions devops/ecs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ COPY ./src/ /project/src/
COPY ./config/ /project/config/

# 👇 Install pytnon packages
#RUN pip install -r requirements.txt
RUN poetry source add spectral-data-repository --secondary https://finance-362197681756.d.codeartifact.us-east-2.amazonaws.com/pypi/spectral-data-repository/simple/ \
&& poetry config repositories.spectral-data-repository https://finance-362197681756.d.codeartifact.us-east-2.amazonaws.com/pypi/spectral-data-repository/ \
&& poetry config http-basic.spectral-data-repository aws ${CODEARTIFACT_TOKEN}

# Installing project's module dependencies
RUN poetry install --no-interaction --no-ansi --no-dev

# 👇 Fixing Critical vulnerabilites - GHSA-xvch-5gv4-984h and CVE-2021-44906
Expand Down
71 changes: 0 additions & 71 deletions devops/ecs/infrastructure/.terraform.lock.hcl

This file was deleted.

8 changes: 4 additions & 4 deletions devops/ecs/infrastructure/build_and_push_ecr_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ set -e
IMAGE_NAME=$1
ENVIRONMENT=$2
DOMAIN_NAME=finance
DOMAIN_OWNER=362197681756
DOMAIN_OWNER=${DOMAIN_OWNER}

cd ../../../; # go to root of project

# login to ECR
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 362197681756.dkr.ecr.us-east-2.amazonaws.com;
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin ${DOMAIN_OWNER}.dkr.ecr.us-east-2.amazonaws.com;

# Build the docker image
docker build --platform=linux/amd64 --build-arg CODEARTIFACT_TOKEN=`aws codeartifact get-authorization-token --domain ${DOMAIN_NAME} \
--domain-owner ${DOMAIN_OWNER} --query authorizationToken --output text` \
-t data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT} -f devops/ecs/Dockerfile .;

# Tag the image
docker tag data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest 362197681756.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest;
docker tag data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest ${DOMAIN_OWNER}.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest;

# Push the image to ECR
docker push 362197681756.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest;
docker push ${DOMAIN_OWNER}.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/${IMAGE_NAME}-${ENVIRONMENT}:latest;
6 changes: 2 additions & 4 deletions devops/ecs/infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ data "aws_iam_policy_document" "ecs_task_execution_role" {
]
effect = "Allow"
resources = [
"arn:aws:s3:::spectral-athena-results",
"arn:aws:s3:::spectral-athena-results/*",
"arn:aws:s3:::data-lakehouse-dev",
"arn:aws:s3:::data-lakehouse-dev/*",
"arn:aws:s3:::data-lakehouse-prod",
"arn:aws:s3:::data-lakehouse-prod/*",
"arn:aws:s3:::aws-athena-query-results-362197681756-us-east-2",
"arn:aws:s3:::aws-athena-query-results-362197681756-us-east-2/*",
"arn:aws:s3:::aws-athena-query-results",
"arn:aws:s3:::aws-athena-query-results/*",
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions devops/ecs/infrastructure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ locals {
env = terraform.workspace == "default" ? "dev" : terraform.workspace
project = "defi-features-data-pipeline"
team = "data-engineering"
account_id = "362197681756" #TODO: Remove this hardcode and use data.aws_caller_identity.current.account_id
account_id = "account_id" #TODO: Remove this hardcode and use data.aws_caller_identity.current.account_id
}

variable "ecr_repo_url" {
type = string
description = "URI of the ECR repository"
default = "362197681756.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/defi-features-data-pipeline"
default = "account_id.dkr.ecr.us-east-2.amazonaws.com/data-lakehouse/defi-features-data-pipeline"
}

variable "ecr_repo_image_tag" {
Expand Down
2 changes: 1 addition & 1 deletion devops/ecs/infrastructure/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.13"

backend "s3" {
bucket = "spectral-terraform-state"
bucket = "bucket-terraform-state"
key = "tf-worskpaces/defi-features-data-pipeline/terraform.tfstate"
region = "us-east-2"
}
Expand Down

0 comments on commit 198e97a

Please sign in to comment.