Skip to content

Commit 6402651

Browse files
committed
migrate canary to fargate
1 parent bc2702d commit 6402651

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

bin/deploy-canary.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ LIB_PATH=$rootdir
88
CANARY_PATH=$LIB_PATH/tests/canary/agent
99
ACCOUNT_ID=863722843142
1010
REGION=us-west-2
11-
IMAGE_NAME=emf-python-canary
12-
ECS_CLUSTER_NAME=emf-canary
13-
ECS_TASK_FAMILY=emf-python-canary
14-
ECS_SERVICE_NAME=emf-python-canary
15-
ECR_REMOTE=$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME
11+
EMF_LANGUAGE=python
12+
IMAGE_NAME=emf-$EMF_LANGUAGE-canary
13+
ECS_CLUSTER_NAME=emf-canary-cluster
14+
ECS_TASK_FAMILY=emf-canary-$EMF_LANGUAGE-tasks
15+
ECS_SERVICE_NAME=emf-canary-$EMF_LANGUAGE-service
16+
ECR_ENDPOINT=$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
17+
ECR_REMOTE=$ECR_ENDPOINT/$IMAGE_NAME
1618

1719
pushd $CANARY_PATH
1820
echo 'INSTALLING LOCAL PROJECT'
1921
python3 -m venv venv
2022
source venv/bin/activate
2123
pip3 install $rootdir
22-
pip3 install psutil
23-
pip3 install getversion
2424

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

@@ -40,13 +40,13 @@ aws ecs update-service \
4040
--service $ECS_SERVICE_NAME \
4141
--force-new-deployment \
4242
--task-definition $(aws ecs register-task-definition \
43-
--network-mode bridge \
44-
--requires-compatibilities EC2 \
45-
--task-role arn:aws:iam::$ACCOUNT_ID:role/ecsTaskExecutionRole \
46-
--execution-role-arn "arn:aws:iam::$ACCOUNT_ID:role/ecsTaskExecutionRole" \
43+
--network-mode awsvpc \
44+
--requires-compatibilities FARGATE \
45+
--task-role arn:aws:iam::$ACCOUNT_ID:role/ECSCanaryTaskExecutionRole \
46+
--execution-role-arn "arn:aws:iam::$ACCOUNT_ID:role/ECSCanaryTaskExecutionRole" \
4747
--region $REGION \
48-
--memory 256 \
49-
--cpu '0.5 vcpu' \
48+
--memory 512 \
49+
--cpu '0.25 vcpu' \
5050
--family $ECS_TASK_FAMILY \
5151
--container-definitions "$(cat container-definitions.json)" \
5252
| jq --raw-output '.taskDefinition.taskDefinitionArn' | awk -F '/' '{ print $2 }')

tests/canary/agent/container-definitions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
"environment": [
1919
{
2020
"name": "AWS_EMF_AGENT_ENDPOINT",
21-
"value": "tcp://cloudwatch-agent-python:25888"
21+
"value": "tcp://127.0.0.1:25888"
2222
},
2323
{
2424
"name": "AWS_EMF_ENABLE_DEBUG_LOGGING",
2525
"value": "true"
2626
}
2727
],
2828
"image": "863722843142.dkr.ecr.us-west-2.amazonaws.com/emf-python-canary",
29-
"links": ["cloudwatch-agent-python"],
3029
"name": "emf-python-canary"
3130
},
3231
{

tests/canary/agent/start.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22
. /app/venv/bin/activate
3-
python ./canary.py
3+
4+
pip3 install psutil > /dev/null
5+
pip3 install getversion > /dev/null
6+
7+
python3 ./canary.py

0 commit comments

Comments
 (0)