??? ?? ??? ???? ?? ??? ??? ????, ???? ???? ???? ??? ???? ?????? ?? ?? ??? ?? ?????. ????? ????? ????? ??? ???? ??? ? ?? ??? ???? ??? Kubernetes service? ??? ?? ??????? | To understand Docker's underlying technology, we look at Docker's history and learn about the core concepts of Kubernetis, which operates a container environment in a cluster environment. Lastly, I will introduce Naver's cloud platform Kubernetes service, which allows you to easily create and manage Kubernetes clusters, through a demo.
55. How to do Docker Automaition Build
circle.yml
deployment:
develop:
branch: develop
commands:
- sh docker/run_git_diff.sh:
timeout: 1500
betax:
branch: betax
commands:
- sh docker/run_git_diff.sh:
timeout: 1500
staging:
branch: staging
commands:
- sh docker/run_git_diff.sh:
timeout: 1500
production:
branch: production
commands:
- sh docker/run_git_diff.sh:
timeout: 1500
?? docker?? ??? circleCI?deployment ???
??? ??
?? ????? ???? ??? ??
run_git_diff.sh????? ??? ??? ?? docker
build? ???? ???
56. How to do Docker Automaition Build
git diff???
#!/bin/sh
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD)¡°
branch_name="${CIRCLE_BRANCH}"
updated_nginx_status=false
updated_unicorn_status=false
updated_td-agent_status=false
updated_rails_status=false
for var in $changed_files
do
if [[ $var =~ ^docker/nginx/$branch_name ]]; then
updated_nginx_status =true
elif [[ $var =~ ^docker/unicorn/$branch_name ]]; then
updated_unicorn_status=true
elif [[ $var =~ ^docker/td-agent/$branch_name ]]; then
updated_td-agent_status =true
else
updated_rails_status=true
fi
done
57. How to do Docker Automaition Build
git diff???
#!/bin/sh
if [ $updated_nginx_status ]; then
sh docker/nginx/$branch_name/build_docker.sh //docker build
sh docker/nginx/$branch_name/run_docker.sh //docker run
sh docker/nginx/$branch_name/test/run_test.sh //serverspec?? ??? ????? ?? ???
sh docker/nginx/$branch_name/push_docker.sh //???? ??? ??? aws ecr? docker push
else
fi
if [ $updated_unicorn_status ]; then
sh docker/unicorn/$branch_name/build_docker.sh
sh docker/unicorn/$branch_name/run_docker.sh
sh docker/unicorn/$branch_name/test/run_test.sh
sh docker/unicorn/$branch_name/push_docker.sh
else
fi
autumation docker run,test,push? ??? ??
58. How to do Docker Automaition Build
???? ??? ????
rails_root
docker
nginx
unicorn
development
beta
staging
productoon
shared
memcached
redis
elasticsearch development Build_docker.sh
td-agent production
mysql
base
Dockerfile
docker-
compose.yml
docker/nginx/beta/xx
docker/elasticsearch/d
evelopment/xxx
docker/td-
agent/production/xxx
?? ?? ??? development
branch? merge???
59. How to do Docker Automaition Build
???? ??? ????
rails_root
docker
nginx
unicorn
development
beta
staging
productoon
shared
memcached
redis
elasticsearch development Build_docker.sh
td-agent production
mysql
base
Dockerfile
docker-
compose.yml
docker/nginx/beta/xx
docker/elasticsearch/
development/xxx
docker/td-
agent/production/xxx
?? ?? ??? development
branch? merge???
Development ????? ???
elasticsearch/development/build_
docker.sh??? ???
60. How to do Docker Automaition Build
???? ??? ????
rails_root
docker
nginx production build_docker.sh
unicorn
development
beta
staging
productoon build_docker.sh
shared
memcached
redis
elasticsearch development build_docker.sh
td-agent production build_docker.sh
mysql
base
Dockerfile
docker-
compose.yml
docker/nginx/production
/xx
docker/elasticsearch/dev
elopment/xxx
docker/td-
agent/production/xxx
?? ?? ??? production
branch? merge???
docker/unicorn/producti
on/xxx
61. How to do Docker Automaition Build
???? ??? ????
rails_root
docker
nginx production build_docker.sh
unicorn
development
beta
staging
productoon build_docker.sh
shared
memcached
redis
elasticsearch development build_docker.sh
td-agent production build_docker.sh
mysql
base
Dockerfile
docker-
compose.yml
docker/nginx/production
/xx
docker/elasticsearch/dev
elopment/xxx
docker/td-
agent/production/xxx
?? ?? ??? production
branch? merge???
docker/unicorn/producti
on/xxx
Production ????? ???
nginx,unicorn,td-agent?
build_docker.sh??? ??
???
62. How to do auto deployment
? ?? ??? AWS ECS? ??? ?? ???????.
? Git push -> circlieci -> git diff -> build_docker.sh -
>run_docker.sh -> run_test.sh -> push_docker.sh ->
create_task_def.sh -> update_task_def.sh
63. How to do auto deployment
??? ???
? AWS ECS? ???? ?????
? Blue green deployment??? ??? ?? ????
???? ??
? AWS ECS?Minimum healthy percent,Maximum percent??
? ????? ??? ????? ??
? ?????? ???20?? ??? ?? Minimum healthy
percent:50, Maximum percent 100? ????? 10??
????? ?? ??? ????? ??? -> ???
10?? ????? ?? ??? ????? ???? ?
64. How to do auto deployment
about deploy directory
Docker build?
???? ????
Docker_build_root
Rails_env
{development
staging,
production}
files test deploy
create_task_
def.sh
dynamic_gen
_task_def_js
on.sh
task_def.tem
plate
update_task
_def.sh
??? ??
create_task_def.sh ?? docker build?? ?? ???? ???? task definition??
dynamic_gen_task_def_json.sh task_def.templat? ???? task_def.json??? ??(envsubust??? ??)
task_def.template Dynamic_gen_task_def_json.sh???? ???? ???
update_task_def.sh ??? task_definition?? ??
65. How to do auto deployment
dynamic_gen_task_def_json.sh + task_def.template
#!/bin/sh
cd docker/unicorn/$BRANCH/deploy/
envsubst '$CIRCLE_PR_NUMBER' < task_def.template > task_def.json
dynamic_gen_task_def_json.sh
{
"containerDefinitions": [ {
"name": "unicorn",
"image": ¡°xx.dkr.ecr.ap-northeast-1.amazonaws.com/xx:${CIRCLE_PR_NUMBER}",
"essential": true,
¡
task_def.template
66. How to do auto deployment
create_task_def.sh
#!/bin/sh
cd docker/unicorn/$BRANCH/deploy/
sh dynamic_gen_task_def_json.sh
aws ecs register-task-definition --cli-input-json file://task-def.json
//?? ??? task definition? aws ecs? ??
create_task_def.sh