Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment setup #31

Merged
merged 15 commits into from
Jan 11, 2024
2 changes: 1 addition & 1 deletion infra/pragma-ingestor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ USER ingestor:pragma
WORKDIR /home/pragma-ingestor

COPY --from=builder --chown=ingestor:pragma /home/pragma-ingestor/bin/pragma-ingestor /usr/local/bin/pragma-ingestor
COPY infra/pragma-ingestor/config/.env.example .env
# COPY infra/pragma-ingestor/config/.env.example .env

CMD ["pragma-ingestor"]
30 changes: 30 additions & 0 deletions infra/pragma-ingestor/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com/$ECR_REPOSITORY_NAME
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- ls -ltr
- docker build -f infra/pragma-ingestor/Dockerfile -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"%s","imageUri":"%s"}]' $ECS_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json
- infra/pragma-ingestor/config.yml
discard-paths: yes
11 changes: 11 additions & 0 deletions infra/pragma-ingestor/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
path: "/"
container_port: 8080
health_check_path: "/"
container_environment:
- region: "eu-west-3"
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}"
- keys:
- DATABASE_URL
- BROKERS
- TOPIC
- GROUP_ID
2 changes: 1 addition & 1 deletion infra/pragma-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ USER node:pragma
WORKDIR /home/pragma-node

COPY --from=builder --chown=node:pragma /home/pragma-node/bin/pragma-node /usr/local/bin/pragma-node
COPY infra/pragma-node/config/.env.example .env
# COPY infra/pragma-node/config/.env.example .env

EXPOSE 3000

Expand Down
8 changes: 3 additions & 5 deletions buildspec.yml → infra/pragma-node/buildspec.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
version: 0.2
phases:
install:
runtime-versions:
nodejs: 18
pre_build:
commands:
- echo Logging in to Amazon ECR...
Expand All @@ -16,7 +13,7 @@ phases:
- echo Build started on `date`
- echo Building the Docker image...
- ls -ltr
- docker build -t $REPOSITORY_URI:latest .
- docker build -f infra/pragma-node/Dockerfile -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
Expand All @@ -29,4 +26,5 @@ phases:
artifacts:
files:
- imagedefinitions.json
- config.yml
- infra/pragma-node/config.yml
discard-paths: yes
4 changes: 3 additions & 1 deletion config.yml → infra/pragma-node/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
path: "/"
container_port: 8080
alb_scheme: internal
health_check_path: "/node"
container_environment:
- region: "eu-west-3"
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}"
- keys:
- DATABASE_URL
- DATABASE_MAX_CONN
- TOPIC
- HOST
- PORT
- KAFKA_BROKERS