`
sillycat
  • 浏览: 2539492 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

AMAZON ECR(1)Repository for Docker

 
阅读更多
AMAZON ECR(1)Repository for Docker

1 Prepare Repository for Docker
Login AMAZON Console
Click on ‘Amazon ECS’, click on ‘Repositories’

That is not git repository, my understanding is that it is docker repository. We need create one docker repository based on the name of our project.
Usually I already have that name configured in Makefile as follow:
IMAGE=sillycat/sillycat-billing-play
TAG=1.3
NAME=sillycat-billing-play
REPOSITORY=registry.sillycat.com

So the name should be sillycat/sillycat-billing-play, click on the button ‘Create repository'
Repository name: sillycat/sillycat-billing-play

Once we type the name there, the Repository URL will be: https://xxxxxxx.dkr.ecr.us-east-1.amazonaws.com/sillycat/sillycat-billing-play

Click on the ’Next’ button.

If you are the first hero doing these thing on the build server/local server/stage server. You need the first 2 steps as well.
> aws ecr get-login --region us-east-1

This command will generate the login command for you.
> docker login -u AWS -p xxxxxxxxxxxxxx -e none https://xxxxxxx.dkr.ecr.us-east-1.amazonaws.com


After that, we will just replace the URL in our Makefile
IMAGE=sillycat/sillycat-billing-play
TAG=1.3
NAME=sillycat-billing-play
REPOSITORY=https://xxxxxxx.dkr.ecr.us-east-1.amazonaws.com

#REPOSITORY=registry.sillycat.com

2 Build Docker Image

Update the codes before we build the image.
> git pull origin develop

Make the binary software build, since we are using scala play framework, the underline command in Makefile is
app-build:
sbt clean update compile package universal:packageZipTarball


Or we can easily type following command with the help of Makefile
>make app-build

Based on the base image and binary software, we build our release image
> make build

Till now, the release image is on our local server, we can test it, run it, debug it if we want. But here, we will push this release image to docker repository.
> make push-local

3 Upgrade ECS

Create Task Definition
Click on the ’Task Definitions’, find the task we have there like ’sillycat-billing-play’, select on that

Click on the button ‘Create new revision'

Click on the ‘Container Name’ like ’sillycat-billing-play'
Change the ‘Image’ value to “xxxxxxx.dkr.ecr.us-east-1.amazonaws.com/sillycat/sillycat-billing-play:1.3"

Click on the ’Save’/‘Create’ button. After that, you will see a new Task Definition name with a index number there like
sillycat-billing-play:5

Upgrade Service
Click on the ‘Cluster’ at top left.

Click on the ‘Cluster: sillycat-production’, actually that is our ECS cluster name.

Click on the service name like ‘BillingService'

On the top right, click on the button ‘Update’, update the ’Task Definition’ value to sillycat-billing-play:5’’, haha, usually, we just need to add up 1 number there.

Click on the button ‘Update Service'

Then, ECS will do that magic, it will speed up N new services, then switch the load balance to the new services. Finally it will take down the N old services.

References:
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics