Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
UFO
Tung Nguyen
Jan 2017
About Me
I’ve done a little bit of everything. Both dev and ops.
@tongueroo - Twitter.
https://medium.com/@tongueroo - Blo...
lono - CloudFormation template generator.
jack - Manage ElasticBeanstalk environments.
thor_template - used this to genera...
Why?
Wanted get my hands dirty with ECS.
Wanted more control over the ECS task definition.
Wanted to automated the buildin...
ECS Introduction - Terms
Task definition - blueprint for docker container.
Task - Actual running container.
Service - Long...
ECS Introduction - Terms
Steps for Deploying on ECS
1.Build and push docker image
2.Build and register task definition
3.Update the ECS service (cr...
Google Search: “deploying to ecs”
silinternational/ecs-deploy - pulls down existing task
definition.
CircleCI deploy.sh ex...
Wanted more control over the task definition template.
Would be nice if the task definition could be reused for
common and...
Task Definition Similarities
$ cat ufo/output/hi-web.json
{
"family": "hi-web",
"containerDefinitions": [
{
"name": "web",...
UFO Template DSL
UFO will use a ERB template to generate the task
definition for all the processes you need: web, clock,
w...
UFO Task Definition Template DSL
$ cat ufo/templates/main.json.erb
{
"family": "<%= @family %>",
"containerDefinitions": [...
UFO Task Definition Output
$ cat ufo/output/hi-web.json
{
"family": "hi-web",
"containerDefinitions": [
{
"name": "web",
"...
ufo ship: whole point of this tool
NOTE: The ECS Cluster and a Container Instance must
already exist. I created Container ...
UFO Demo
ufo ship demo
What Happened Review Summary
ufo init - generates the skeleton ufo files.
Mainly ufo/task_definitons.rb and
ufo/templates/...
In ufo/task_definitions.rb there are some helper methods.
helper.full_image_name - this is the generated docker
image name...
ufo docker build - only build the docker image
ufo tasks build - only build the task definitions
ufo scale hi-web 1 - scal...
THE END
Hacker Noon Blog Post - Ufo—Easily Build Docker Images
and Ship Containers to AWS ECS
Setting up CI with UFO, ECS,...
Nächste SlideShare
Wird geladen in …5
×

Ufo Ship for AWS ECS

799 Aufrufe

Veröffentlicht am

Overview of ufo tool that is useful for shipping docker images to AWS ECS.

Veröffentlicht in: Ingenieurwesen
  • Writing a good research paper isn't easy and it's the fruit of hard work. For help you can check writing expert. Check out, please ⇒ www.HelpWriting.net ⇐ I think they are the best
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • To get professional research papers you must go for experts like ⇒ www.WritePaper.info ⇐
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • The difference between "like" and "love" (most women miss this) ☞☞☞ https://dwz1.cc/C0LOhFpr
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Gehören Sie zu den Ersten, denen das gefällt!

Ufo Ship for AWS ECS

  1. 1. UFO Tung Nguyen Jan 2017
  2. 2. About Me I’ve done a little bit of everything. Both dev and ops. @tongueroo - Twitter. https://medium.com/@tongueroo - Blog. tongueroo.com - Personal Site.
  3. 3. lono - CloudFormation template generator. jack - Manage ElasticBeanstalk environments. thor_template - used this to generate this tool. ufo - ship docker images to ecs. What this talk is about. These tools are in Ruby. More: http://tongueroo.com/projects/ Other Tools
  4. 4. Why? Wanted get my hands dirty with ECS. Wanted more control over the ECS task definition. Wanted to automated the building of the docker image as part of building task definition. Ending up using it on my side projects.
  5. 5. ECS Introduction - Terms Task definition - blueprint for docker container. Task - Actual running container. Service - Long running tasks. Cluster - Logic group of EC2 Container instances. Container Instance - EC2 instance that is part of an ECS Cluster.
  6. 6. ECS Introduction - Terms
  7. 7. Steps for Deploying on ECS 1.Build and push docker image 2.Build and register task definition 3.Update the ECS service (create the service if needed)
  8. 8. Google Search: “deploying to ecs” silinternational/ecs-deploy - pulls down existing task definition. CircleCI deploy.sh example - nice and simple easy to build from. Empire - heroku like opensource SaaS from Remind engineering. A little more than I need but cool project. Programmer Virtue #1: Laziness -> Research
  9. 9. Wanted more control over the task definition template. Would be nice if the task definition could be reused for common and similar processes: web, clock, worker. More Control
  10. 10. Task Definition Similarities $ cat ufo/output/hi-web.json { "family": "hi-web", "containerDefinitions": [ { "name": "web", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "portMappings": [ { "containerPort": "3000", "protocol": "tcp" } ], "command": [ "bin/web" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true $ cat ufo/output/hi-worker.json { "family": "hi-worker", "containerDefinitions": [ { "name": "worker", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "command": [ "bin/worker" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true } ] }$
  11. 11. UFO Template DSL UFO will use a ERB template to generate the task definition for all the processes you need: web, clock, worker, etc. Allows sharing of code and settings. Let’s see what it looks like.
  12. 12. UFO Task Definition Template DSL $ cat ufo/templates/main.json.erb { "family": "<%= @family %>", "containerDefinitions": [ { "name": "<%= @name %>", "image": "<%= @image %>", "cpu": <%= @cpu %>, <% if @memory %> "memory": <%= @memory %>, <% end %> <% if @memory_reservation %> "memoryReservation": <%= @memory_reservation %>, <% end %> <% if @container_port %> "portMappings": [ { "containerPort": "<%= @container_port %>", "protocol": "tcp" } ], <% end %> "command": <%= @command.to_json %>, <% if @environment %> $ cat ufo/task_definitions.rb common = { image: helper.full_image_name, cpu: 128, memory_reservation: 256, environment: env_file(".env") } task_definition "hi-web" do source "main" variables(common.dup.deep_merge( family: task_definition_name, name: "web", container_port: helper.dockerfile_port, command: ["bin/web"] )) end task_definition "hi-worker" do source "main" variables(common.dup.deep_merge( family: task_definition_name, name: "worker", command: ["bin/worker"] )) end
  13. 13. UFO Task Definition Output $ cat ufo/output/hi-web.json { "family": "hi-web", "containerDefinitions": [ { "name": "web", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "portMappings": [ { "containerPort": "3000", "protocol": "tcp" } ], "command": [ "bin/web" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true $ cat ufo/output/hi-worker.json { "family": "hi-worker", "containerDefinitions": [ { "name": "worker", "image": "tongueroo/hi:ufo-2016-12-04T17-54- 23-2d1634d", "cpu": 128, "memoryReservation": 256, "command": [ "bin/worker" ], "environment": [ { "name": "ADMIN_PASSWORD", "value": "secret" } ], "essential": true } ] }$
  14. 14. ufo ship: whole point of this tool NOTE: The ECS Cluster and a Container Instance must already exist. I created Container Instances with the lono tool. 1. Build and push docker image 2. Build and register task definition 3. Update the ECS service (create the service automatically if needed)
  15. 15. UFO Demo ufo ship demo
  16. 16. What Happened Review Summary ufo init - generates the skeleton ufo files. Mainly ufo/task_definitons.rb and ufo/templates/main.json.erb - most configurations and changes go in here. ufo/settings.yml - is nice to know about a useful setting in here. bin/deploy - wrapper script.
  17. 17. In ufo/task_definitions.rb there are some helper methods. helper.full_image_name - this is the generated docker image name. helper.dockerfile_port - parsed from the Dockerfile. env_file - useful helper method to translate a env list to the json formatted list for an ECS Task definition. Review tasks_definitions.rb Helpers
  18. 18. ufo docker build - only build the docker image ufo tasks build - only build the task definitions ufo scale hi-web 1 - scale up and down tasks Misc ufo commands
  19. 19. THE END Hacker Noon Blog Post - Ufo—Easily Build Docker Images and Ship Containers to AWS ECS Setting up CI with UFO, ECS, and CircleCI GitHub - https://github.com/tongueroo/ufo Slideshare - http://www.slideshare.net/tongueroo/ufo- ship-for-aws-ecs-70885296 tongueroo@gmail.com - feel free to contact me

×