사실 이전 블루그린 배포 스크립트에서
Deploy CLI --deployment-config-name CodeDeployDefault.OneAtATime 옵션 부분을 수정해서
마지막 Deploy Script만 다음과 같이 고치면, Canary로 할 것인지 Linear로 할 것인지 정할 수 있습니다.
withAWS(credentials:"$AWS_CREDENTIALS") {
sh"""
aws deploy create-deployment \
--application-name AppECS-${CLUSTER_NAME}-${SERVICE_NAME} \
--deployment-config-name CodeDeployDefault.ECSLinear10PercentEvery1Minutes \
--deployment-group-name DgpECS-${CLUSTER_NAME}-${SERVICE_NAME} \
--region ap-northeast-2 \
--s3-location bucket=cb-test-deploy,bundleType=YAML,key=${env.JOB_NAME}/${env.BUILD_NUMBER}/appspec.yaml \
--output json > DEPLOYMENT_ID.json
"""
}
따라서 이전 스크립트에서 해당 부분만 추가하여서 구성해보도록 하겠습니다.
배포가 정상적으로 끝난 것을 볼 수 있습니다.
중간중간 트래픽에 대한 테스트를 해봤는데, 트래픽의 10% 만큼 제대로 적용되는 부분을 체크할 수 있었습니다.
웹 소스가 꽤 길어서 해당 부분을 좀 생략하고 결과를 적으면 다음과 같이 나오는 것을 확인할 수 있었습니다.
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:5</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:5</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:2</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:2</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:5</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:2</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:2</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
</html>
[ec2-user@ip-192-168-11-30 ~]$ curl https://cb-test-ecs.hyeonho.shop
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<title>Platform Biz Test WEB</title>
</head>
<body>
<div class="col-sm-4">
<h1 id="module_name" class="display-3">cb-test-api-ecs-linear:2</h1>
<p class="lead">This is a deom web page to save logs.</p>
<hr class="my-4">
<p class="lead">
<br><br>
<button id="info" type="button" class="btn btn-info">Info</button>
<button id="warn" type="button" class="btn btn-warning">Warning</button>
<button id="error" type="button" class="btn btn-danger">ERROR</button><br>
<br>
<button type="button" onclick="startWorker()" class="btn btn-outline-success">Start Worker</button>
<button type="button" onclick="stopWorker()" class="btn btn-outline-danger">Stop Worker</button>
</p>
</div>
</body>
일단, 배포가 순차적 트래픽을 증가시키는 것은 확실하게 확인할 수 있었으나
리소스가 너무 적은 상태의 배포여서 그런것인지 아니면 제가 Linear와 Canary의 차이를 정확히 이해 못한 것인지 모르겠으나
제가 이해한 카나리방식으로 배포되는 모습을 보여줬습니다.
다음 포스터에서는 카나리방식으로 배포형태를 바꾸고 수행해보도록 하겠습니다.
'CICD > ECS' 카테고리의 다른 글
ECS CICD Automation - 11. ECS Canary Deployment (0) | 2020.02.11 |
---|---|
ECS CICD Automation - 9. ECS Linear, Canary Deployment Intro (0) | 2020.02.09 |
ECS CICD Automation - 8. Jenkins Job (ECS Fargate Blue Green) (0) | 2020.01.31 |
ECS CICD Automation - 8. ECS Fargate Blue/Green 생성 (0) | 2020.01.31 |
ECS CICD Automation - 7. Jenkins Job (ECS Fargate Rolling) (0) | 2020.01.31 |