Skip to content

Fix all instances link (#8284) #2

Fix all instances link (#8284)

Fix all instances link (#8284) #2

Workflow file for this run

name: Deploy to AWS
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- 'go.work'
- 'go.work.sum'
- 'backend/**'
- 'deploy/**'
- 'docker/backend.Dockerfile'
- 'sdk/highlight-go/**'
- '.github/workflows/deploy.yml'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
migrate-database:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Add public IP to AWS security group
uses: sohelamin/aws-security-group-add-ip-action@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-2'
aws-security-group-id: ${{ secrets.AWS_RDS_SECURITY_GROUP_ID }}
port: '5432'
to-port: ''
protocol: 'tcp'
description: 'GitHub Action for migrate-database'
- name: Migrate database
run: |
cd backend/
make migrate
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
deploy-session-delete-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
CGO_ENABLED=0 go build ./lambda-functions/deleteSessions/getSessionIdsByQuery
zip getSessionIdsByQuery.zip getSessionIdsByQuery
CGO_ENABLED=0 go build ./lambda-functions/deleteSessions/deleteSessionBatchFromPostgres
zip deleteSessionBatchFromPostgres.zip deleteSessionBatchFromPostgres
CGO_ENABLED=0 go build ./lambda-functions/deleteSessions/deleteSessionBatchFromOpenSearch
zip deleteSessionBatchFromOpenSearch.zip deleteSessionBatchFromOpenSearch
CGO_ENABLED=0 go build ./lambda-functions/deleteSessions/deleteSessionBatchFromS3
zip deleteSessionBatchFromS3.zip deleteSessionBatchFromS3
CGO_ENABLED=0 go build ./lambda-functions/deleteSessions/sendEmail
zip sendEmail.zip sendEmail
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name getSessionIdsByQuery \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name deleteSessionBatchFromPostgres \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name deleteSessionBatchFromOpenSearch \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name deleteSessionBatchFromS3 \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name sendEmail \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy getSessionIdsByQuery
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: getSessionIdsByQuery
zip_file: backend/getSessionIdsByQuery.zip
- name: Deploy deleteSessionBatchFromPostgres
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: deleteSessionBatchFromPostgres
zip_file: backend/deleteSessionBatchFromPostgres.zip
- name: Deploy deleteSessionBatchFromOpenSearch
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: deleteSessionBatchFromOpenSearch
zip_file: backend/deleteSessionBatchFromOpenSearch.zip
- name: Deploy deleteSessionBatchFromS3
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: deleteSessionBatchFromS3
zip_file: backend/deleteSessionBatchFromS3.zip
- name: Deploy sendEmail
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: sendEmail
zip_file: backend/sendEmail.zip
deploy-session-export-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
CGO_ENABLED=0 go build ./lambda-functions/sessionExport/saveSessionExport
zip saveSessionExport.zip saveSessionExport
CGO_ENABLED=0 go build ./lambda-functions/sessionExport/sendEmail
zip sendEmail.zip sendEmail
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name saveSessionExport \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name sendSessionExportEmail \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy saveSessionExport
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: saveSessionExport
zip_file: backend/saveSessionExport.zip
- name: Deploy sendSessionExportEmail
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: sendSessionExportEmail
zip_file: backend/sendEmail.zip
deploy-digest-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
CGO_ENABLED=0 go build ./lambda-functions/digests/getProjectIds
zip getProjectIds.zip getProjectIds
CGO_ENABLED=0 go build ./lambda-functions/digests/getDigestData
zip getDigestData.zip getDigestData
CGO_ENABLED=0 go build ./lambda-functions/digests/sendDigestEmails
zip sendDigestEmails.zip sendDigestEmails
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name getProjectIds \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name getDigestData \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name sendDigestEmails \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy getProjectIds
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: getProjectIds
zip_file: backend/getProjectIds.zip
- name: Deploy getDigestData
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: getDigestData
zip_file: backend/getDigestData.zip
- name: Deploy sendDigestEmails
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: sendDigestEmails
zip_file: backend/sendDigestEmails.zip
deploy-session-insights-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
CGO_ENABLED=0 go build ./lambda-functions/sessionInsights/getSessionInsightsData
zip getSessionInsightsData.zip getSessionInsightsData
CGO_ENABLED=0 go build ./lambda-functions/sessionInsights/sendSessionInsightsEmails
zip sendSessionInsightsEmails.zip sendSessionInsightsEmails
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name getSessionInsightsData \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
aws lambda update-function-configuration --function-name sendSessionInsightsEmails \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy getSessionInsightsData
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: getSessionInsightsData
zip_file: backend/getSessionInsightsData.zip
- name: Deploy sendSessionInsightsEmails
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: sendSessionInsightsEmails
zip_file: backend/sendSessionInsightsEmails.zip
deploy-metering-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
GOARCH=arm64 GOOS=linux CGO_ENABLED=0 go build -o bootstrap ./lambda-functions/metering/awsMarketplaceListener
zip awsMarketplaceListener.zip bootstrap
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name awsMarketplaceListener \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy awsMarketplaceListener
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: awsMarketplaceListener
zip_file: backend/awsMarketplaceListener.zip
deploy-user-journey-lambdas:
needs: migrate-database
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v2
- name: Build and zip
run: |
cd backend/
CGO_ENABLED=0 go build ./lambda-functions/journeys/updateNormalnessScores
zip updateNormalnessScores.zip updateNormalnessScores
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Update Lambda secrets
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_PROD_AWS_LAMBDAS_SECRET }}
REACT_APP_COMMIT_SHA: ${{ github.sha }}
run: |
aws lambda update-function-configuration --function-name updateNormalnessScores \
--environment "$(doppler secrets download --no-file | jq ". + {REACT_APP_COMMIT_SHA: \"$REACT_APP_COMMIT_SHA\" }" | jq '{Variables: .}')" 2>&1 >/dev/null
- name: Deploy updateNormalnessScores
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-2
function_name: updateNormalnessScores
zip_file: backend/updateNormalnessScores.zip
deploy_backend:
needs: migrate-database
runs-on: buildjet-2vcpu-ubuntu-2204-arm
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push arm64 image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: highlight-production-ecr-repo
IMAGE_TAG: ${{ github.sha }}
run: |
docker buildx build --build-arg REACT_APP_COMMIT_SHA=${{ github.sha }} --platform linux/arm64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG.arm64 -f docker/backend.Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG.arm64
# Edit and deploy private-graph
- name: Replace image label for private-graph task
id: image-private-graph
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/private-graph-task.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS private-graph service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-private-graph.outputs.task-definition }}
service: private-graph-service
cluster: highlight-ec2-prod
# Edit and deploy public-graph
- name: Replace image label for public-graph task
id: image-public-graph
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/public-graph-task.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS public-graph service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-public-graph.outputs.task-definition }}
service: public-graph-service
cluster: highlight-production-cluster
# Edit and deploy worker
- name: Replace image label for worker task
id: image-worker
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/worker-task.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS worker service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-worker.outputs.task-definition }}
service: session-worker
cluster: highlight-ec2-prod
# Edit and deploy metric monitors
- name: Replace image label for metric monitors task
id: image-metric-monitor
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/metric-monitor-task.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS metric monitor service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-metric-monitor.outputs.task-definition }}
service: metric-monitor
cluster: highlight-production-cluster
# Edit and deploy log alerts
- name: Replace image label for log alerts task
id: image-log-alerts
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/log-alerts-task.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS log alerts service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-log-alerts.outputs.task-definition }}
service: log-alerts-service
cluster: highlight-production-cluster
# Edit and deploy public worker (main topic)
- name: Replace image label for public worker (main topic) service
id: image-public-worker-main
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/public-worker-main-service.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS public worker (main topic) service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-public-worker-main.outputs.task-definition }}
service: public-worker-main-service
cluster: highlight-ec2-prod
# Edit and deploy public worker (batched topic)
- name: Replace image label for public worker (batched topic) service
id: image-public-worker-batched
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/public-worker-batched-service.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS public worker (batched topic) service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-public-worker-batched.outputs.task-definition }}
service: public-worker-batched-service
cluster: highlight-ec2-prod
# Edit and deploy public worker (datasync topic)
- name: Replace image label for public worker (datasync topic) service
id: image-public-worker-datasync
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/public-worker-datasync-service.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS public worker (datasync topic) service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-public-worker-datasync.outputs.task-definition }}
service: public-worker-datasync-service
cluster: highlight-ec2-prod
# Edit and deploy public worker (traces topic)
- name: Replace image label for public worker (traces topic) service
id: image-public-worker-traces
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/public-worker-traces-service.json
container-name: highlight-backend
image: ${{ steps.login-ecr.outputs.registry }}/highlight-production-ecr-repo:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS public worker (traces topic) service
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-public-worker-traces.outputs.task-definition }}
service: public-worker-traces-service
cluster: highlight-ec2-prod
deploy_opentelemetry_collector:
runs-on: buildjet-2vcpu-ubuntu-2204-arm
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Check out the repo
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
otel-changed:
- 'deploy/opentelemetry-collector.Dockerfile'
- 'deploy/otel-collector.yaml'
# Edit and deploy opentelemetry collector
- name: Build, tag, and push arm64 image to Amazon ECR
if: steps.filter.outputs.otel-changed == 'true'
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: highlight-collector
IMAGE_TAG: ${{ github.sha }}
run: |
cd deploy
docker buildx build --platform linux/arm64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG.arm64 -f opentelemetry-collector.Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG.arm64
- name: Replace image label for opentelemetry collector
if: steps.filter.outputs.otel-changed == 'true'
id: image-opentelemetry-collector
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/collector-task.json
container-name: highlight-collector
image: ${{ steps.login-ecr.outputs.registry }}/highlight-collector:${{ github.sha }}.arm64
- name: Deploy to Amazon ECS opentelemetry collector service
if: steps.filter.outputs.otel-changed == 'true'
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.image-opentelemetry-collector.outputs.task-definition }}
service: opentelemetry-collector-service
cluster: highlight-production-cluster