Skip to content

Migrate canary to Fargate #68

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

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions bin/deploy-canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ LIB_PATH=$rootdir
CANARY_PATH=$LIB_PATH/tests/canary/agent
ACCOUNT_ID=863722843142
REGION=us-west-2
IMAGE_NAME=emf-python-canary
ECS_CLUSTER_NAME=emf-canary
ECS_TASK_FAMILY=emf-python-canary
ECS_SERVICE_NAME=emf-python-canary
ECR_REMOTE=$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME
EMF_LANGUAGE=python
IMAGE_NAME=emf-$EMF_LANGUAGE-canary
ECS_CLUSTER_NAME=emf-canary-cluster
ECS_TASK_FAMILY=emf-canary-$EMF_LANGUAGE-tasks
ECS_SERVICE_NAME=emf-canary-$EMF_LANGUAGE-service
ECR_ENDPOINT=$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
ECR_REMOTE=$ECR_ENDPOINT/$IMAGE_NAME

pushd $CANARY_PATH
echo 'INSTALLING LOCAL PROJECT'
python3 -m venv venv
source venv/bin/activate
pip3 install $rootdir
pip3 install psutil
pip3 install getversion

echo 'BUILDING THE EXAMPLE DOCKER IMAGE'
`aws ecr get-login --no-include-email --region $REGION`
aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $ECR_ENDPOINT
docker build . -t $IMAGE_NAME:latest
check_exit

Expand All @@ -40,13 +40,13 @@ aws ecs update-service \
--service $ECS_SERVICE_NAME \
--force-new-deployment \
--task-definition $(aws ecs register-task-definition \
--network-mode bridge \
--requires-compatibilities EC2 \
--task-role arn:aws:iam::$ACCOUNT_ID:role/ecsTaskExecutionRole \
--execution-role-arn "arn:aws:iam::$ACCOUNT_ID:role/ecsTaskExecutionRole" \
--network-mode awsvpc \
--requires-compatibilities FARGATE \
--task-role arn:aws:iam::$ACCOUNT_ID:role/ECSCanaryTaskExecutionRole \
--execution-role-arn "arn:aws:iam::$ACCOUNT_ID:role/ECSCanaryTaskExecutionRole" \
--region $REGION \
--memory 256 \
--cpu '0.5 vcpu' \
--memory 512 \
--cpu '0.25 vcpu' \
--family $ECS_TASK_FAMILY \
--container-definitions "$(cat container-definitions.json)" \
| jq --raw-output '.taskDefinition.taskDefinitionArn' | awk -F '/' '{ print $2 }')
Expand Down
3 changes: 1 addition & 2 deletions tests/canary/agent/container-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
"environment": [
{
"name": "AWS_EMF_AGENT_ENDPOINT",
"value": "tcp://cloudwatch-agent-python:25888"
"value": "tcp://127.0.0.1:25888"
},
{
"name": "AWS_EMF_ENABLE_DEBUG_LOGGING",
"value": "true"
}
],
"image": "863722843142.dkr.ecr.us-west-2.amazonaws.com/emf-python-canary",
"links": ["cloudwatch-agent-python"],
"name": "emf-python-canary"
},
{
Expand Down
6 changes: 5 additions & 1 deletion tests/canary/agent/start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash
. /app/venv/bin/activate
python ./canary.py

pip3 install psutil > /dev/null
pip3 install getversion > /dev/null

python3 ./canary.py