Automated infrastructure

Kaunas Java User Group
Kaunas Java User GroupSenior Java Software Engineer at Kaunas Java User Group
Automated 
Infrastructure 
Laurynas Tret jakovas 
laurynas.tret jakovas@gmail.com 
Kaunas Java User Group, 2014 1
Agenda 
• Manual Infrastructure vs Automated Infrastructure 
• Puppet 
• Docker 
• Vagrant 
• Demo 
• Q & A 
Kaunas Java User Group, 2014 2
Manual vs Automated 
Automated infrastructure has the following benefits: 
• Version control the configuration 
• Reusable 
• Cheaper for the organization 
• Provision a fleet of nodes with a single click 
• Works well with continious integration and delivery 
• New servers on demand – scalability 
• Smaller chance for human error 
• Is fun, motivates and creates a sense of accomplishment 
Kaunas Java User Group, 2014 3
Kaunas Java User Group, 2014 4
Puppet 
• Open source configuration management utility 
• Ensures that the node is in a defined state 
• Ruby DSL 
• Cross-platform 
• Agents can fetch configuration form the master 
• Enterprise edition is free if managing 10 or less nodes 
• Lots of modules in Puppet Forge 
Kaunas Java User Group, 2014 5
Puppet 
• Puppet configuration files are called manifests 
• Manifests do not apply actions from top to bottom, they use relationships to 
determine the order, in which the resources should be set up 
Kaunas Java User Group, 2014 6
Puppet 
Kaunas Java User Group, 2014 7
Kaunas Java User Group, 2014 8
Kaunas Java User Group, 2014 9
Kaunas Java User Group, 2014 10
Kaunas Java User Group, 2014 11
Puppet 
• Do not forget to define dependencies 
• Test your configuration with CI, use puppet parser validate and 
puppet-lint 
• Write module tests 
• Use puppet librarian to update and install modules 
• Manage node configuration with Hiera 
• Write classes and in the main fail only include the classes 
Kaunas Java User Group, 2014 12
Kaunas Java User Group, 2014 13
Docker 
• An open source platform for developers and system administrators to build, 
ship, and run distributed applications 
• “Dockerized” apps are portable and can run on most popular Linux distributions 
• On other OS, use boot2docker VM – a lightweight Linux distribution made 
specifically to run Docker containers 
• System administrators can use Docker to standardize development 
environments and abstract away differences in different OS distributions 
• Docker hub contains thousands of apps 
Kaunas Java User Group, 2014 14
Kaunas Java User Group, 2014 15
Docker Images 
Docker image is a read-only template. An image could contain an 
Ubuntu operating system with Tomcat and your web application 
installed. Images are used to create Docker containers. Docker 
provides a simple way to build new images or update existing 
images, or you can download Docker images that other people have 
already created. Docker images are the build component of Docker 
Kaunas Java User Group, 2014 16
Docker Registries 
Docker registries hold images. These are public or private stores from 
which you upload or download images. The public Docker registry is 
called Docker Hub. It provides a huge collection of existing images 
for your use. These can be images you create yourself or you can use 
images that others have previously created. Docker registries are the 
distribution component of Docker 
Kaunas Java User Group, 2014 17
Docker Containers 
Docker containers are similar to a directory. A Docker container holds 
everything that is needed for an application to run. Each container is 
created from a Docker image. Docker containers can be run, started, 
stopped, moved, and deleted. Each container is an isolated and 
secure application platform. Docker containers are the run 
component of Docker 
Kaunas Java User Group, 2014 18
Docker Images 
• Image name pattern – vendor/imageName:tag 
• Each image starts from a base image, for example a base Ubuntu 
image 
• Each image consists of a series of layers that are combined into a 
single image, every change to an image is a new layer, which can be 
saved as a new image 
• Docker images can be built by hand or by using a Dockerfile with a 
set of instructions 
Kaunas Java User Group, 2014 19
Docker Containers 
• Running a command from an image creates a container. After that 
command exits, container stops 
• One container should only do a single thing, don‘t run an ssh service 
• Upstart does not work in containers 
• To share data between containers create data volumes and mount 
them into containers 
Kaunas Java User Group, 2014 20
Docker Containers 
• Containers get an IP from a pool, there is no way to explicity assign 
an ip 
• Use –p flag to forward ports when starting a container 
• To access one container from the other, you have to link them: 
docker run -d --name web --link db:db training/webapp 
• Linked container‘s IP is available from the hosts file 
Kaunas Java User Group, 2014 21
Ubuntu with Oracle JDK 
Kaunas Java User Group, 2014 22
Tomcat 8 
Kaunas Java User Group, 2014 23
Web Application 
Kaunas Java User Group, 2014 24
Docker 
• Group common commands into a single statement, so only one 
layer is created 
• Install with --no-install-recommends 
• Don‘t overwrite existing tags, use new ones each time so you can 
fall back easily 
• Use automated builds in the hub 
• Avoid private registries as Docker Hub server files over a cdn 
Kaunas Java User Group, 2014 25
Kaunas Java User Group, 2014 26
Vagrant 
• Create VMs locally for development 
• Portable and version controlled configuration 
• Replicate production environment 
• Every team member has the exact same setup 
• No more “works on my machine” 
• A place to test your automated infrastructure scripts 
• Has plugin API 
• Provisioning with Puppet, Chef, Ansible and more 
Kaunas Java User Group, 2014 27
Vagrant 
• Install Virtualbox or other VM provider 
• Install Vagrant 
• Create Vagrantfile with configuration 
• Base boxes are available from vagrant cloud 
• vagrant up 
Kaunas Java User Group, 2014 28
Vagrant 
• Vagrant can automatically build and run docker images for you 
• You do not save much from this, but it can spin up a boot2docker 
VM if your host OS does not support docker 
Kaunas Java User Group, 2014 29
Vagrant 
Kaunas Java User Group, 2014 30
Vagrant 
Kaunas Java User Group, 2014 31
Vagrant 
• Use shell provisioning to install and run Puppet 
• Use NFS file shares on Linux hosts 
• Do not write to shared folders, it is slow 
• On Windows hosts, even reading from shared folders can be slow, 
so avoid doing that as much as you can 
Kaunas Java User Group, 2014 32
Demo 
Kaunas Java User Group, 2014 33
Automated infrastructure
1 of 34

Recommended

Introduction to automated environment management with Docker Containers - for... by
Introduction to automated environment management with Docker Containers - for...Introduction to automated environment management with Docker Containers - for...
Introduction to automated environment management with Docker Containers - for...Lucas Jellema
1.6K views78 slides
Introduction to container based virtualization with docker by
Introduction to container based virtualization with dockerIntroduction to container based virtualization with docker
Introduction to container based virtualization with dockerBangladesh Network Operators Group
3.2K views25 slides
Docker Basics by
Docker BasicsDocker Basics
Docker BasicsDuckDuckGo
1.1K views33 slides
containers and virtualization tools ( Docker ) by
containers and virtualization tools ( Docker )containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )Imo Inyang
467 views28 slides
Virtualization, Containers, Docker and scalable container management services by
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesabhishek chawla
2.3K views56 slides
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To... by
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...Edureka!
3.6K views20 slides

More Related Content

What's hot

Docker introduction for the beginners by
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginnersJuneyoung Oh
6.3K views17 slides
Docker: From Zero to Hero by
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Herofazalraja
1.9K views21 slides
Docker and containers : Disrupting the virtual machine(VM) by
Docker and containers : Disrupting the virtual machine(VM)Docker and containers : Disrupting the virtual machine(VM)
Docker and containers : Disrupting the virtual machine(VM)Rama Krishna B
812 views25 slides
[@NaukriEngineering] Docker 101 by
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101Naukri.com
317 views41 slides
The ABC of Docker: The Absolute Best Compendium of Docker by
The ABC of Docker: The Absolute Best Compendium of DockerThe ABC of Docker: The Absolute Best Compendium of Docker
The ABC of Docker: The Absolute Best Compendium of DockerAniekan Akpaffiong
1.7K views235 slides
Docker, a new LINUX container technology based light weight virtualization by
Docker, a new LINUX container technology based light weight virtualizationDocker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualizationSuresh Balla
4.9K views24 slides

What's hot(20)

Docker introduction for the beginners by Juneyoung Oh
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
Juneyoung Oh6.3K views
Docker: From Zero to Hero by fazalraja
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
fazalraja1.9K views
Docker and containers : Disrupting the virtual machine(VM) by Rama Krishna B
Docker and containers : Disrupting the virtual machine(VM)Docker and containers : Disrupting the virtual machine(VM)
Docker and containers : Disrupting the virtual machine(VM)
Rama Krishna B812 views
[@NaukriEngineering] Docker 101 by Naukri.com
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
Naukri.com317 views
The ABC of Docker: The Absolute Best Compendium of Docker by Aniekan Akpaffiong
The ABC of Docker: The Absolute Best Compendium of DockerThe ABC of Docker: The Absolute Best Compendium of Docker
The ABC of Docker: The Absolute Best Compendium of Docker
Aniekan Akpaffiong1.7K views
Docker, a new LINUX container technology based light weight virtualization by Suresh Balla
Docker, a new LINUX container technology based light weight virtualizationDocker, a new LINUX container technology based light weight virtualization
Docker, a new LINUX container technology based light weight virtualization
Suresh Balla4.9K views
Containerization and Docker by Megha Bansal
Containerization and DockerContainerization and Docker
Containerization and Docker
Megha Bansal184 views
A Shift from Monolith to Microservice using Docker by Ajeet Singh Raina
A Shift from Monolith to Microservice using DockerA Shift from Monolith to Microservice using Docker
A Shift from Monolith to Microservice using Docker
Ajeet Singh Raina844 views
Docker introduction by dotCloud
Docker introductionDocker introduction
Docker introduction
dotCloud455.8K views
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12 by dotCloud
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
dotCloud4.9K views
Introduction to Docker - Vellore Institute of Technology by Ajeet Singh Raina
Introduction to Docker - Vellore Institute of TechnologyIntroduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of Technology
Ajeet Singh Raina473 views
A new model for Docker image distribution by Docker, Inc.
A new model for Docker image distributionA new model for Docker image distribution
A new model for Docker image distribution
Docker, Inc.11.4K views
Intro Docker october 2013 by dotCloud
Intro Docker october 2013Intro Docker october 2013
Intro Docker october 2013
dotCloud6.7K views
Docker 101: Introduction to Docker by Docker, Inc.
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
Docker, Inc.71.2K views
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp... by Edureka!
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Edureka!2.5K views

Similar to Automated infrastructure

Automated Infrastructure by
Automated InfrastructureAutomated Infrastructure
Automated InfrastructureLaurynas Tretjakovas
184 views34 slides
Undine: Turnkey Drupal Development Environments by
Undine: Turnkey Drupal Development EnvironmentsUndine: Turnkey Drupal Development Environments
Undine: Turnkey Drupal Development EnvironmentsDavid Watson
562 views35 slides
A to Z of Docker by
A to Z of DockerA to Z of Docker
A to Z of DockerSwapnil Jain
313 views78 slides
Getting Started with Docker by
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
791 views39 slides
Django and Docker by
Django and DockerDjango and Docker
Django and DockerDocker, Inc.
2.2K views78 slides
Docker at Djangocon 2013 | Talk by Ken Cochrane by
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochranedotCloud
16.6K views78 slides

Similar to Automated infrastructure(20)

Undine: Turnkey Drupal Development Environments by David Watson
Undine: Turnkey Drupal Development EnvironmentsUndine: Turnkey Drupal Development Environments
Undine: Turnkey Drupal Development Environments
David Watson562 views
Django and Docker by Docker, Inc.
Django and DockerDjango and Docker
Django and Docker
Docker, Inc.2.2K views
Docker at Djangocon 2013 | Talk by Ken Cochrane by dotCloud
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
dotCloud16.6K views
2014, April 15, Atlanta Java Users Group by Todd Fritz
2014, April 15, Atlanta Java Users Group2014, April 15, Atlanta Java Users Group
2014, April 15, Atlanta Java Users Group
Todd Fritz2.7K views
Docker introduction (1) by Gourav Varma
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
Gourav Varma175 views
Docker introduction (1) by Gourav Varma
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
Gourav Varma355 views
Docker introduction (1) by Kalkey
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
Kalkey19 views
Dockerize the World by damovsky
Dockerize the WorldDockerize the World
Dockerize the World
damovsky753 views
Fits docker into devops by Evans Ye
Fits docker into devopsFits docker into devops
Fits docker into devops
Evans Ye1.6K views
Containers docker-docker hub-azureacr-azure aci by Rajesh Kolla
Containers docker-docker hub-azureacr-azure aciContainers docker-docker hub-azureacr-azure aci
Containers docker-docker hub-azureacr-azure aci
Rajesh Kolla42 views
Docker 101 - Nov 2016 by Docker, Inc.
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
Docker, Inc.7.3K views
Docker Introduction by w_akram
Docker IntroductionDocker Introduction
Docker Introduction
w_akram1.2K views
Dockerizing OpenStack for High Availability by Daniel Krook
Dockerizing OpenStack for High AvailabilityDockerizing OpenStack for High Availability
Dockerizing OpenStack for High Availability
Daniel Krook8.5K views

More from Kaunas Java User Group

Smart House Based on Raspberry PI + Java EE by Tadas Brasas by
Smart House Based on Raspberry PI + Java EE by Tadas BrasasSmart House Based on Raspberry PI + Java EE by Tadas Brasas
Smart House Based on Raspberry PI + Java EE by Tadas BrasasKaunas Java User Group
469 views19 slides
Presentation by
PresentationPresentation
PresentationKaunas Java User Group
614 views12 slides
Adf presentation by
Adf presentationAdf presentation
Adf presentationKaunas Java User Group
1.4K views1 slide
Bye Bye Cowboy Coder Days! (Legacy Code & TDD) by
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Kaunas Java User Group
1.3K views34 slides
Building with Gradle by
Building with GradleBuilding with Gradle
Building with GradleKaunas Java User Group
1.7K views17 slides
Flyway by
FlywayFlyway
FlywayKaunas Java User Group
3.9K views25 slides

More from Kaunas Java User Group(13)

Recently uploaded

Generative AI: Shifting the AI Landscape by
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI LandscapeDeakin University
53 views55 slides
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...ShapeBlue
132 views13 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
159 views14 slides
CryptoBotsAI by
CryptoBotsAICryptoBotsAI
CryptoBotsAIchandureddyvadala199
40 views5 slides
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...ShapeBlue
119 views17 slides
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...ShapeBlue
139 views29 slides

Recently uploaded(20)

Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue132 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue119 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue139 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li85 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty64 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue252 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue166 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue173 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10139 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu423 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue186 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue152 views

Automated infrastructure

  • 1. Automated Infrastructure Laurynas Tret jakovas laurynas.tret jakovas@gmail.com Kaunas Java User Group, 2014 1
  • 2. Agenda • Manual Infrastructure vs Automated Infrastructure • Puppet • Docker • Vagrant • Demo • Q & A Kaunas Java User Group, 2014 2
  • 3. Manual vs Automated Automated infrastructure has the following benefits: • Version control the configuration • Reusable • Cheaper for the organization • Provision a fleet of nodes with a single click • Works well with continious integration and delivery • New servers on demand – scalability • Smaller chance for human error • Is fun, motivates and creates a sense of accomplishment Kaunas Java User Group, 2014 3
  • 4. Kaunas Java User Group, 2014 4
  • 5. Puppet • Open source configuration management utility • Ensures that the node is in a defined state • Ruby DSL • Cross-platform • Agents can fetch configuration form the master • Enterprise edition is free if managing 10 or less nodes • Lots of modules in Puppet Forge Kaunas Java User Group, 2014 5
  • 6. Puppet • Puppet configuration files are called manifests • Manifests do not apply actions from top to bottom, they use relationships to determine the order, in which the resources should be set up Kaunas Java User Group, 2014 6
  • 7. Puppet Kaunas Java User Group, 2014 7
  • 8. Kaunas Java User Group, 2014 8
  • 9. Kaunas Java User Group, 2014 9
  • 10. Kaunas Java User Group, 2014 10
  • 11. Kaunas Java User Group, 2014 11
  • 12. Puppet • Do not forget to define dependencies • Test your configuration with CI, use puppet parser validate and puppet-lint • Write module tests • Use puppet librarian to update and install modules • Manage node configuration with Hiera • Write classes and in the main fail only include the classes Kaunas Java User Group, 2014 12
  • 13. Kaunas Java User Group, 2014 13
  • 14. Docker • An open source platform for developers and system administrators to build, ship, and run distributed applications • “Dockerized” apps are portable and can run on most popular Linux distributions • On other OS, use boot2docker VM – a lightweight Linux distribution made specifically to run Docker containers • System administrators can use Docker to standardize development environments and abstract away differences in different OS distributions • Docker hub contains thousands of apps Kaunas Java User Group, 2014 14
  • 15. Kaunas Java User Group, 2014 15
  • 16. Docker Images Docker image is a read-only template. An image could contain an Ubuntu operating system with Tomcat and your web application installed. Images are used to create Docker containers. Docker provides a simple way to build new images or update existing images, or you can download Docker images that other people have already created. Docker images are the build component of Docker Kaunas Java User Group, 2014 16
  • 17. Docker Registries Docker registries hold images. These are public or private stores from which you upload or download images. The public Docker registry is called Docker Hub. It provides a huge collection of existing images for your use. These can be images you create yourself or you can use images that others have previously created. Docker registries are the distribution component of Docker Kaunas Java User Group, 2014 17
  • 18. Docker Containers Docker containers are similar to a directory. A Docker container holds everything that is needed for an application to run. Each container is created from a Docker image. Docker containers can be run, started, stopped, moved, and deleted. Each container is an isolated and secure application platform. Docker containers are the run component of Docker Kaunas Java User Group, 2014 18
  • 19. Docker Images • Image name pattern – vendor/imageName:tag • Each image starts from a base image, for example a base Ubuntu image • Each image consists of a series of layers that are combined into a single image, every change to an image is a new layer, which can be saved as a new image • Docker images can be built by hand or by using a Dockerfile with a set of instructions Kaunas Java User Group, 2014 19
  • 20. Docker Containers • Running a command from an image creates a container. After that command exits, container stops • One container should only do a single thing, don‘t run an ssh service • Upstart does not work in containers • To share data between containers create data volumes and mount them into containers Kaunas Java User Group, 2014 20
  • 21. Docker Containers • Containers get an IP from a pool, there is no way to explicity assign an ip • Use –p flag to forward ports when starting a container • To access one container from the other, you have to link them: docker run -d --name web --link db:db training/webapp • Linked container‘s IP is available from the hosts file Kaunas Java User Group, 2014 21
  • 22. Ubuntu with Oracle JDK Kaunas Java User Group, 2014 22
  • 23. Tomcat 8 Kaunas Java User Group, 2014 23
  • 24. Web Application Kaunas Java User Group, 2014 24
  • 25. Docker • Group common commands into a single statement, so only one layer is created • Install with --no-install-recommends • Don‘t overwrite existing tags, use new ones each time so you can fall back easily • Use automated builds in the hub • Avoid private registries as Docker Hub server files over a cdn Kaunas Java User Group, 2014 25
  • 26. Kaunas Java User Group, 2014 26
  • 27. Vagrant • Create VMs locally for development • Portable and version controlled configuration • Replicate production environment • Every team member has the exact same setup • No more “works on my machine” • A place to test your automated infrastructure scripts • Has plugin API • Provisioning with Puppet, Chef, Ansible and more Kaunas Java User Group, 2014 27
  • 28. Vagrant • Install Virtualbox or other VM provider • Install Vagrant • Create Vagrantfile with configuration • Base boxes are available from vagrant cloud • vagrant up Kaunas Java User Group, 2014 28
  • 29. Vagrant • Vagrant can automatically build and run docker images for you • You do not save much from this, but it can spin up a boot2docker VM if your host OS does not support docker Kaunas Java User Group, 2014 29
  • 30. Vagrant Kaunas Java User Group, 2014 30
  • 31. Vagrant Kaunas Java User Group, 2014 31
  • 32. Vagrant • Use shell provisioning to install and run Puppet • Use NFS file shares on Linux hosts • Do not write to shared folders, it is slow • On Windows hosts, even reading from shared folders can be slow, so avoid doing that as much as you can Kaunas Java User Group, 2014 32
  • 33. Demo Kaunas Java User Group, 2014 33

Editor's Notes

  1. Kalbėsiu apie: Rankomis valdomą infrastruktūrą ir jos minusus, Automatinę infrastruktūrą ir jos pliusais/minusais Tuomet konkrečiai pašnekėsiu apie keletą automatinės infrastruktūros įrankių: Vagrant, Puppet ir Docker. Tuomet parodysiu demo su Docker ir kaip jame paleisti java aplikaciją. Apie kiekvieną iš šių technologijų atskirai galima padaryti po prezentaciją, todėl šiandien paliesime tik patį paviršių ir svarbiausius dalykus.
  2. Jeigu infrastruktūrą yra automatinė, tai reikia kažkokio būdo kaip tą infrastruktūrą aprašyt. Jeigu turim kaip ją aprašyt, reiškias galim ir versijuot. O jeigu galim versijuot tai galim ir atrevertint esant reikalui. Galima pernaudot pilnas konfiguracijas ar jos dalis. Pvz turite konfigūracijos modulius Javai, Tocmatui, Jboss. Kitam projektui prireikė naujų aplinkų, bet tik su Java, Paėmėt Java modulį ir paleidot ant naujų serverių, viskas. Automatinė infrastruktūrą yra pigiau. Tarkime turime organizaciją užsiemančia smulkiais projektais. Kiekvienam projektui turi DEV, TEST, PROD aplinkas, load balancerius ir keletą duomenų bazių. Labai nesunkiai serverių skaičius gali išaugti iki 100 ir tai tikrai nėra daug. Jeigu rankomis valdotę infrastruktūrą, praktiškai kiekvienam iš projektų reikės dedikuoto žmogaus aplinkoms valdyti. Jeigu neturėsi kiekvienam atskirai, tai gali turėt bendrai kokius 10 100 serverių, arba vieną žmogų keliems projektams, bet dažniausiai nutinka taip, kad tų žmonių vistiek neužtenka ir darbai stringa, ypač atsiradus naujoms saugumo spragoms, kurios pastaruoju metu tikrai padažnėjo. Kaip buvo su shellsock. Tik paskelbė apie tai, visi pradėjo exploitinti per botnetus, paleidinėti vulnerability scannerius, į tokias spragas reikia labai greitai reaguoti. Rankinėje infrastruktūroje administratoriai eis per kiekvieną serverį ir updatins bash‘ą, o projektų darbai tuo metu lauks. Su automatine infrastruktūra galima turėti vos keletą žmonių, kurie spės padaryt darbus. Iš pradžių gali būt sunkiau, bet poto kai jau turės daug pernaudojamų dalių, bus žymiai greičiau ir paprasčiau. Taip pat galima valdyti userių roles, kiekviename serveryje rankomis nekurti userių. Kaip ir minėjau ankščiau, galimybė vienu kartu visiems serveriams ar serverių grupei atlikti kažkokius pakeitimus ir nesijungiant ir nesitreliojant su kiekvienu atskirai. Galima automatiškai konfigūruoti naujos jenkins slaves. Naują serverio konfigūracija tampa visos aplikacijos deliverinimo etapu. Taip pat automatinės infrastruktūros sistemos labai gerai veikia kartu su monitorinimo sistemomis. Jeigu jūsų visi serveriai cloud‘e, jūs galite labai lengvai paprašyti naujo serverio arba esamus pašalinti. Amazon AWS leidžia monitorinti trafficą ir pasiekus tam tikrą lygį, pridėti naujų serverių į stacką. Automatinė infrastruktūros sistema tada tą serverį sukonfigūruoja ir ideda ten aplikaciją. Naudojant kažkokia kitą cloud sistema galima pasileisti kokią kitą monitorinimo sistemą ir serverius kurti per API callsus. Kuo daugiau žingsnių reikia atlikti rankomis, tuo didesnė tikimybė, kad bus padaryta kažkokia klaida. Su atuomatine infrastruktūro taip nebus, jeigu buvo ištestuota. Ir toks taip vadinamas added bonus tai, kad tai yra žymiai įdomiau, linksmiau ir svarbiausia – motyvuoja. Tai tokį nuobodų darbą kaip serverių administravimas gali padaryt įdomų ir patiems programuotojams. O kai kažką tokio padarai tai ir pats jauti pasitenkinimą.
  3. Visų pirma, yra ir kitų alternatyvų. Būtinai pasidomėkite apie Chef ir Ansible. Pasakoju apie puppet nes kolkas tik su juo turiu patirties. Tai puppet yra open source mašinų konfigūravimo sistema. Tai iš pradžių reikia suprasti kaip tokios sistemos skiriasi nuo paprastų shell scriptų. Su shell scriptais taip pat galima iki tam tikro lygio automatizuoti infrastruktūrą. Tačiau naudojant shell scriptus, tu aprašai ką reikia padaryti, pvz įrašyk man duombazė, tada užkelk tokius duombazės konfigūracijos failus, tada įrašyk man tomcat‘ą, tada dar kažką ir dar kažką... Tačiau tokie dalykai labai greitai griūna kai bandai tą patį reikalą paleisti antrą kartą. Esant paprastiems install komandoms tai nepasijaučia, bet sudėtingesniai scenarijais jau reikia tikrinti ar scriptas leidžiasi pirmą kartą ar ne. Tai va, shell scriptams reikia pasakyti ką daryti, o puppetui tu sakai kokiam state turi būti mašina. Reiškias tu sakai, kad tau reikia duombazės su tokia ir tokia konfigūracija ir tomcato, tada jeigu pirmą kartą paleisi viską surašys. Jeigu antrą kartą paleisi jau nieko nedarys. Jeigu rankom prikeitaliosi duombazės konfigus, tai vėl paleidus jis tau tik configus pakeis į tuos kuriuos aprašei. Žodžiu užtikrina mašinos state‘ą. Ir toks dalykas yra netgi žymiai skaitomesnis, nes tau nebereikia skaityt ką shell scriptas daro ir koks viso to yra tikslas ir koks bus rezultatas, iš puppet manifestų viskas labai aiškiai matosi. Naudoja Ruby DSLą Veikia ant populiariausių linux distribucijų, taip pat ir ant windowsų. Paprastai manifestai turi būti tame pačiame serveryje kuris bus konfigūruojamas. Reiškias prieš tai į serverį reikia įrašyti puppet, ten sukelti failus ir paleisti komandą, tačiau galima sukonfigūruoti ir master serverį. Master serveris saugos visas agentų konfiūracijas ir kompiliuos manifestus, o agentai paprašys konfigūracijos ir masteris pats susigaudys kurią konfiguraciją jam reikia grąžinti. Agentas tuomet įsivykdis tuos skriptus. Pats puppet yra open source, tačiau yra ir enterprise versija. Enterprise versisjoje pagrinde yra WEB UI, kuriame galima matyti master serverius ir visus agentus, taip pat kada ten buvo paskutinį kartą provisioninta ir panašiai. Daugumai dalykų jau yra parašyti moduliai ir patalpinti į puppet forge, kuriuos tereikia parsisiųsti.
  4. Primenu, kad manifeste nevyksta reikalai nuo viršaus į apačią, nepamirškit nurodyti ryšius Konfigūracijai galima pakurti ci, kuris kiekvieno commito metu, paleistų parserį ar sintaksė validi ir praneštų apie puppet-lint klaidas ir warningus Įmanoma testus rašyti, gal šiek tiek per daug laiko užimti, nes dauguma dalyku sunku patestuoti realiai nepaleidus ir nepacheckinus kas įvyko Norint pasiimti modulį iš puppet forge, reikia rašyti puppet module install arba naudoti puppet librarian. Puppet librarian iš nurodyto failo parsiųs modulius į katalogą arba atnaujins. Poto paleidžiant puppet reikia nurody dvi modulių direktorijas – savo parašytų ir kur librarian updatina Naudokit Hiera. Hiera yra key value storage‘as konfigūracijai. Reiškias kiekvienas nodas gali turėti konfigus, su tais pačiais raktais, bet skirtingom reikšmėm. Tada manifestuose juos galima naudoti ir turėti tik vieną manifesto faila vienai mašinų grupei.
  5. Dockeris yra opensourcinė linux konteinerių sistemą. Supakuoji aplikaciją į docker konteinerius ir poto gali leist kur nori ant daugumos linux distribucijų Jeigu ant jūsų os dockeris neveikia, galima paleisti ant VM. Boot2docker ~30MB ir užsikrauna per ~5sec Galima naudoti dockerį visų aplinkų standartizavimui. Kiekvienas docker image‘as turi turėti base image, pagrindą. Toks pagrindas gali būti standartizuotas įmonėje. Jeigu pasikeičia pagrindas, poto daug darbo nereikia, kad ant najo viską perdaryt Yra docker hub kur jau yra dockerizuota daug aplikacijų, yra tomcatai jbosstai ir tt, duombazės įvairios. Tokias duombazes labai patogu naudot dirbant lokaliai
  6. Docker image‘ai turi būti atitinkamai pavadinti, va paternas. Lokaliai galima kaip nori vadint, bet pushinant į registrą reikia šito laikytis Viskas turi turėti base image Kiekvienas pakeitimas image sukuria naują sluoksnį, visi sluoksniai yra sujungiami, kad gauti image. Padarius kažkokį pakeitimą į image, turi gali toliau ir seną turėt ir naują išsisaugot su tuo pakeitimu Image galima ranka sudaryt ir poto išsaugot arba iš failo, perduodant instrukcijas
  7. Kai ant image paleidi komandą, pradeda veikti konteineris, tai kaip VM jau, kai ta komanda baigiasi, konteineris irgi nustoja veikti. Konteineriai turi daryt vieną ir vienintelį dalyką. Jeigu ant jo paleidot ssh servisą ir poto jungiatės per ssh, kad daryt dalykus tai jau blogai, taip pat ten neveiks upstarst ir kiti servisai, reikia leisti executables Kadangi pasibaigus komandai nutrūksta ir konteineris, reikia kažkaip persistinti duomenis. Tam yra data containers kuriuos poto galima mountinti į kitus konteinerius
  8. Vagrantas pagal nustatyta konfigūracija sukuria virtualią mašiną arba mašinas jeigu reikia clusterio. Konfigūracija yra versijuojama ir visi komandos nariai turi vienodą setupą. Tai yra didelis privalumas sprendžiant kažkokias problemas. Taip pat, jeigu projekte atsiranda naujas dependencis, jį sukonfigūruoti užtenka vienam komandos nariui, kitas tiesiog atsinaujins repositoriją ir gaus pakeitimus į virtualią mašiną. Tai gera proga replikuti production environentą. Reiškias jūs galite pasikelti su ta pačia linux distribucija ir versija, ten surašyti tos pačios versijos application serverius ir tt. Tai smarkiai sumažina šansą, kad productione kažkas neveiks. Na ir žinoma nenėra tokiu pasiteisinimų, kad pas mane lokaliai viskas veikė.
  9. Vagrantas pagal nustatyta konfigūracija sukuria virtualią mašiną arba mašinas jeigu reikia clusterio. Konfigūracija yra versijuojama ir visi komandos nariai turi vienodą setupą. Tai yra didelis privalumas sprendžiant kažkokias problemas. Taip pat, jeigu projekte atsiranda naujas dependencis, jį sukonfigūruoti užtenka vienam komandos nariui, kitas tiesiog atsinaujins repositoriją ir gaus pakeitimus į virtualią mašiną. Tai gera proga replikuti production environentą. Reiškias jūs galite pasikelti su ta pačia linux distribucija ir versija, ten surašyti tos pačios versijos application serverius ir tt. Tai smarkiai sumažina šansą, kad productione kažkas neveiks. Na ir žinoma nenėra tokiu pasiteisinimų, kad pas mane lokaliai viskas veikė.
  10. Pradžiai reikia labai nedaug, įsirašyti Virtualbox ar kitą VM providerį, tiesa vagrant su Vmware integracija yra mokamas, įsirašyti vagrantą, sukurto konfiguracijos failą ir parašyti vagrant up. Konfigūracijos failą dėti kartu su projektu ir commitinti. Vagrant cloud turi labai daug base boxu pradžiai. Dažniausiai žmonės ima base ubuntu/debian su įrašytu puppet ar chef.
  11. Pradžiai reikia labai nedaug, įsirašyti Virtualbox ar kitą VM providerį, tiesa vagrant su Vmware integracija yra mokamas, įsirašyti vagrantą, sukurto konfiguracijos failą ir parašyti vagrant up. Konfigūracijos failą dėti kartu su projektu ir commitinti. Vagrant cloud turi labai daug base boxu pradžiai. Dažniausiai žmonės ima base ubuntu/debian su įrašytu puppet ar chef.
  12. Galima iškart paleisti puppetą, bet per shellą geriau, nes prieš tai galima atnaujinti patį puppetą ir jo modulius Aš rekomenduočiau viską ko reikia projektui sukompiliuoti turėti lokaliai, o viską ko reikia paleidimui – vagrante. Tuomet .war‘ą pasiekti per shared folderius ir įsikopijuoti lokaliai