SlideShare a Scribd company logo
Can Puppet help you run
Docker on a T2.micro?
Presented by: Neil Millard
www.mitese.co.uk
whoami
• Always programming
• IT professional since 1995
• Devops / Infrastructure as Code
• Helicopter pilot
Encryptinator!
• Uses https://github.com/TomPoulton/hiera-eyaml Ruby gem
• Containerised Sinatra app
agenda
• Masterless puppet
• Hieradata
• Roles and Profiles
• Modules
• Ordering
• AWS EC2
• Stages
• Docker
Why Masterless puppet
• Pets VS
• Scale UP
Cattle
Scale OUT
http://www.slideshare.net/gmccance/cern-data-centre-evolution - attrib Bill Baker/Microsoft
https://www.iha.com
Why Masterless puppet
• Puppet Masters
• Pets
• Maintenance
• Care
• Sometimes fragile
Why Masterless puppet
• Rebuild
rather than
reconfigure
• Temporary
• Build Server
-> work/develop
-> destroy server
Masterless puppet
• Bootstrapping
• Cloud-init
• userdata
- Environment
- Role
Masterless puppet
• Bake or not to bake?
• Preparing to run puppet
Tru-strap https://github.com/MSMFG/tru-strap
Args: Provisioning or configuration repository
Role + Environment Facts, for hiera lookup
• Install puppet
Masterless puppet
• Fetch configuration (infrastructure as code)
• Puppet
• hieradata
• Puppetfiles
• manifests
• modules
• profiles
• roles
• https://github.com/neilmillard/puppet-dockerhost
agenda
• Masterless puppet
• Hieradata
• Roles and Profiles
• Modules (via Puppetfiles)
• Ordering
• AWS EC2
• Stages
• Docker
hieradata
• Separation of data from code
docker::run { $container:
image => $image,
command => $command,
memory_limit => $memory_limit,
cpuset => $cpuset,
ports => $ports,
expose => $expose,
volumes => $volumes,
links => $links,
use_name => $use_name,
running => $running,
volumes_from => $volumes_from,
net => $net,
username => $username,
hostname => $hostname,
env => $env,
dns => $dns,
dns_search => $dns_search,
lxc_conf => $lxc_conf,
restart_service => $restart_service,
disable_network => $disable_network,
privileged => $privileged,
detach => $detach,
extra_parameters => $extra_parameters,
pull_on_start => $pull_on_start,
depends => $depends,
tty => $tty,
require => $requires,
}
eyamld:
image: "nginx"
ports:
- "80:80"
env:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
use_name: true
docker::run { ‘eyamld’:
image => "nginx",
command => undef,
memory_limit => 0b,
cpuset => [],
ports => ["80:80“],
expose => [],
volumes => [],
links => [],
use_name => true,
running => true,
volumes_from => [],
net => 'bridge',
username => false,
hostname => false,
env => [NGINX_HOST=foobar.com,
NGINX_PORT=80
],
dns => [],
dns_search => [],
lxc_conf => [],
restart_service => true,
disable_network => false,
privileged => false,
detach => true,
extra_parameters => undef,
pull_on_start => false,
depends => [],
tty => false,
require => [],
}
+ =
hieradata
• Separation of data from code
• Automatic parameter lookup
# In this example, $parameter's value gets set
# when `myclass` is eventually declared.
# Class definition:
class myclass ($parameter_one = "default text") {
file {'/tmp/foo':
ensure => file,
content => $parameter_one,
}
}
hieradata
• Separation of data from code
• Automatic parameter lookup
• Code reuse with lookups
profile::docker_containers::containers:
eyamld:
image: "nginx"
ports:
- "80:80"
env:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
use_name: true
# profile::docker_containers
class profile::docker_containers
($containers={}) {
create_resources (
'profile::docker_container', $containers )
}
hieradata
• Hiera.yaml – configuration
---
:backends:
- eyaml
- yaml
:eyaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem
:pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem
:yaml:
:datadir: /etc/puppetlabs/puppet/hieradata
:hierarchy:
- "%{::init_env}/%{::init_role}"
- "%{::init_role}"
- "%{::init_env}"
- common
Roles and Profiles
• Business Layer (Roles)
only includes profiles
no logic
one server, one role
• Implementation Layer (Profiles)
Includes classes
Modules and Resources
create_resources{}
Craig Dunn - http://www.slideshare.net/PuppetLabs/roles-talk
Puppet - https://docs.puppet.com/pe/2016.2/r_n_p_intro.html
http://www.slideshare.net/DaeHyung/learning-puppet-basic-thing #64
Roles and Profiles
• Defined as classes within either Roles Module or Profiles Module
• Roles contain Profiles
• Use include, require or class
class role::dockerhost {
include ::profile::base
include ::profile::os_limits
include ::profile::docker_base
include ::profile::docker_containers
class { '::profile::swapfile':
before => Class['profile::base']
}
}
# profile::docker_containers
class profile::docker_containers
($containers={}) {
create_resources (
'profile::docker_container', $containers )
}
Modules
• Puppetforge or Git (Github)
Modules
• Librarian or r10k from Puppetfile
forge "https://forgeapi.puppetlabs.com"
# Base modules
mod "saz/timezone", "3.0.1"
mod "saz/rsyslog", "4.0.2"
agenda
• Masterless puppet
• Hieradata
• Roles and Profiles
• Modules
• Ordering
• AWS EC2
• Stages
• Docker
ordering
• Puppet execution is in parallel
• Dependencies need order
anchor { 'ntp::begin': } ->
class { '::ntp::install': } ->
class { '::ntp::config': } ~>
class { '::ntp::service': } ->
anchor { 'ntp::end': }
ordering
• Require and before
class { ‘install-ssl':
installdir => "$installdir",
require => Exec['unarchive-source'],
before => File['copy-init-file'],
}
ordering
• ->
• Everything else is attempted at the same time
->
class { ‘install-ssl':
installdir => "$installdir",
}
->
The Puppet Run
• Puppet catalog compilation
• Puppet catalog apply
http://www.slideshare.net/bernstein_aaron/puppet-introduction-26593192 #25
Data
Hieradata
agenda
• Masterless puppet
• Hieradata
• Roles and Profiles
• Modules
• Ordering
• AWS EC2
• Stages
• Docker
AWS EC2
• Flexible workloads
• Is limiting on memory
• May need a swapfile
Model vCPU (burst) Mem (GiB)
t2.nano 1 0.5
t2.micro 1 1
t2.small 1 2
t2.medium 2 4
t2.large 2 8
Stages
• Simple manifests best
• swapfile stage
stage { 'swapfile':
before => Stage['main'],
}
class { '::profile::swapfile':
stage => swapfile
before => Class['profile::base']
}
Stages
• Catalog compiles
• Runs each stage based on order
Notice: Compiled catalog for ip-10-96-4-130.internal in environment production in 2.10
Notice: /Stage[swapfile]/Profile::Swapfile/Exec[Create swap file /mnt/swap.1]/returns:
Notice: /Stage[swapfile]/Profile::Swapfile/File[/mnt/swap.1]/mode: mode changed '0644'
...
Notice: /Stage[main]/Profile::Docker_base/Exec[yum install -y docker-io]/returns:
Notice: /Stage[main]/Docker::Service/File[/etc/sysconfig/docker]/content: content
Stages
• Ordering across stages
WILL break
• WARNING – use with care.
Can cause dependency cycles
agenda
• Masterless puppet
• Hieradata
• Roles and Profiles
• Modules
• Ordering
• AWS EC2
• Stages
• Docker
Docker
• Containers https://docs.docker.com/engine/understanding-docker/
Docker
• WhaleSay
$ docker run docker/whalesay cowsay boo
Unable to find image 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e9e06b06e14c: Pull complete
a82efea989f9: Pull complete
37bea4ee0c81: Pull complete
...
99da72cfe067: Pull complete
5d5bd9951e26: Pull complete
fb434121fc77: Already exists
Digest: sha256:d6ee73f978a366cf97974115abe9c4099ed59c6f75c23d03c64446bb9cd49163
Status: Downloaded newer image for docker/whalesay:latest
_____
< boo >
-----
Docker
• Dockerhost configuration
docker run --name eweb -p 80:80 –e “NGINX_HOST=foobar.com” –e “NGINX_PORT=80” –d nginx
• Docker compose
profile::docker_containers::containers:
eweb:
image: "nginx"
ports:
- "80:80"
env:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
use_name: true
# profile::docker_containers
class profile::docker_containers
($containers={}) {
create_resources (
'profile::docker_container', $containers )
}
Docker
• Volumes
• Network
• Resource Constraints
• Ref: https://docs.docker.com/engine/reference/run/
Docker
• Production?
• Serverless
• Jenkins builds
• Scale
Docker
• Swarm
https://docs.docker.com/engine/swarm/swarm-tutorial/
https://github.com/jimfdavies/vagrant-docker-swarm
• Amazon EC2 Container Service
container management that supports Docker containers
Can Puppet help you run Docker on a T2.micro?
• Boot, prep and build instance
• Puppet builds catalog and
apply configuration from
your heiradata
• Fetch images and run docker
containers
Neil Millard
Mitese Group
w: www.mitese.co.uk & https://github.com/neilmillard
e: neil@mitese.co.uk

More Related Content

KEY
20100425 Configuration Management With Puppet Lfnw
PPTX
An intro to Docker, Terraform, and Amazon ECS
PDF
Ansible, best practices
PPTX
Terraform Modules and Continuous Deployment
PDF
Usecase examples of Packer
PPT
Ansible presentation
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
20100425 Configuration Management With Puppet Lfnw
An intro to Docker, Terraform, and Amazon ECS
Ansible, best practices
Terraform Modules and Continuous Deployment
Usecase examples of Packer
Ansible presentation
Ansible is the simplest way to automate. MoldCamp, 2015

What's hot (20)

PPTX
Ansible fest Presentation slides
KEY
Making Your Capistrano Recipe Book
PDF
Ansible Meetup Hamburg / Quickstart
PDF
Automating Complex Setups with Puppet
PDF
Automation with Ansible and Containers
PDF
A tour of Ansible
PDF
JUDCon 2010 Boston : BoxGrinder
PDF
Network Automation: Ansible 102
PDF
Automating CloudStack with Puppet - David Nalley
PDF
Amazon EC2 Container Service in Action
PPTX
Vagrant, Ansible, and OpenStack on your laptop
PDF
Introductory Overview to Managing AWS with Terraform
PPTX
Stack kicker devopsdays-london-2013
PDF
Terraform in deployment pipeline
PPTX
"Continuously delivering infrastructure using Terraform and Packer" training ...
PDF
Infrastructure as Code with Terraform
PDF
Apache Cassandra and Go
PPTX
Ansible presentation
PDF
Declarative & workflow based infrastructure with Terraform
ZIP
mtl_rubykaigi
Ansible fest Presentation slides
Making Your Capistrano Recipe Book
Ansible Meetup Hamburg / Quickstart
Automating Complex Setups with Puppet
Automation with Ansible and Containers
A tour of Ansible
JUDCon 2010 Boston : BoxGrinder
Network Automation: Ansible 102
Automating CloudStack with Puppet - David Nalley
Amazon EC2 Container Service in Action
Vagrant, Ansible, and OpenStack on your laptop
Introductory Overview to Managing AWS with Terraform
Stack kicker devopsdays-london-2013
Terraform in deployment pipeline
"Continuously delivering infrastructure using Terraform and Packer" training ...
Infrastructure as Code with Terraform
Apache Cassandra and Go
Ansible presentation
Declarative & workflow based infrastructure with Terraform
mtl_rubykaigi
Ad

Viewers also liked (16)

PDF
Integrating Puppet with Cloud Infrastructures-Remco Overdijk
PDF
Troubleshooting docker
PDF
Infrastructure as code with Terraform
PDF
PuppetConf 2016: Running Puppet Software in Docker Containers – Gareth Rushgr...
PDF
Monitoring microservices: Docker, Mesos and Kubernetes visibility at scale
PDF
Declarative Infrastructure Tools
PDF
Kickstart, Puppet, Docker
PPTX
PuppetConf 2016: Scaling Puppet on AWS ECS with Terraform and Docker – Maxime...
PDF
PuppetConf 2016: Using Puppet with Kubernetes and OpenShift – Diane Mueller, ...
PDF
From dev to prod: Kubernetes on AWS (short ver.)
PPTX
Docker for Ops: Docker Storage and Volumes Deep Dive and Considerations by Br...
PPTX
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
PPTX
Comprehensive Terraform Training
PDF
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
PDF
Docker by Example - Basics
PPTX
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Integrating Puppet with Cloud Infrastructures-Remco Overdijk
Troubleshooting docker
Infrastructure as code with Terraform
PuppetConf 2016: Running Puppet Software in Docker Containers – Gareth Rushgr...
Monitoring microservices: Docker, Mesos and Kubernetes visibility at scale
Declarative Infrastructure Tools
Kickstart, Puppet, Docker
PuppetConf 2016: Scaling Puppet on AWS ECS with Terraform and Docker – Maxime...
PuppetConf 2016: Using Puppet with Kubernetes and OpenShift – Diane Mueller, ...
From dev to prod: Kubernetes on AWS (short ver.)
Docker for Ops: Docker Storage and Volumes Deep Dive and Considerations by Br...
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Comprehensive Terraform Training
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Docker by Example - Basics
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Ad

Similar to Can puppet help you run docker on a T2.Micro? (20)

PPTX
Short lived immutable servers with masterless puppet
PDF
Our Puppet Story (GUUG FFG 2015)
PPTX
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
PDF
Kubernetes Boston — Custom High Availability of Kubernetes
PDF
From SaltStack to Puppet and beyond...
PDF
Automating complex infrastructures with Puppet
PDF
Agiles Peru 2019 - Infrastructure As Code
PPTX
ansible-app-platforme-2024-presentation-
PDF
Container Days Boston - Kubernetes in production
PPTX
Ansible presentation
PPTX
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
ODP
Infrastructure as code with Puppet and Apache CloudStack
ODP
Puppet and Apache CloudStack
ODP
Puppet and CloudStack
PDF
20090514 Introducing Puppet To Sasag
PDF
Functional Hostnames and Why they are Bad
PDF
Bye bye $GLOBALS['TYPO3_DB']
ODP
Puppetpreso
PDF
Docker and Puppet for Continuous Integration
PDF
Top ten-list
Short lived immutable servers with masterless puppet
Our Puppet Story (GUUG FFG 2015)
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Kubernetes Boston — Custom High Availability of Kubernetes
From SaltStack to Puppet and beyond...
Automating complex infrastructures with Puppet
Agiles Peru 2019 - Infrastructure As Code
ansible-app-platforme-2024-presentation-
Container Days Boston - Kubernetes in production
Ansible presentation
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Infrastructure as code with Puppet and Apache CloudStack
Puppet and Apache CloudStack
Puppet and CloudStack
20090514 Introducing Puppet To Sasag
Functional Hostnames and Why they are Bad
Bye bye $GLOBALS['TYPO3_DB']
Puppetpreso
Docker and Puppet for Continuous Integration
Top ten-list

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Machine learning based COVID-19 study performance prediction
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Weekly Chronicles - August'25 Week I
Machine learning based COVID-19 study performance prediction
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation_ Review paper, used for researhc scholars
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Can puppet help you run docker on a T2.Micro?

  • 1. Can Puppet help you run Docker on a T2.micro? Presented by: Neil Millard www.mitese.co.uk
  • 2. whoami • Always programming • IT professional since 1995 • Devops / Infrastructure as Code • Helicopter pilot
  • 4. agenda • Masterless puppet • Hieradata • Roles and Profiles • Modules • Ordering • AWS EC2 • Stages • Docker
  • 5. Why Masterless puppet • Pets VS • Scale UP Cattle Scale OUT http://www.slideshare.net/gmccance/cern-data-centre-evolution - attrib Bill Baker/Microsoft https://www.iha.com
  • 6. Why Masterless puppet • Puppet Masters • Pets • Maintenance • Care • Sometimes fragile
  • 7. Why Masterless puppet • Rebuild rather than reconfigure • Temporary • Build Server -> work/develop -> destroy server
  • 8. Masterless puppet • Bootstrapping • Cloud-init • userdata - Environment - Role
  • 9. Masterless puppet • Bake or not to bake? • Preparing to run puppet Tru-strap https://github.com/MSMFG/tru-strap Args: Provisioning or configuration repository Role + Environment Facts, for hiera lookup • Install puppet
  • 10. Masterless puppet • Fetch configuration (infrastructure as code) • Puppet • hieradata • Puppetfiles • manifests • modules • profiles • roles • https://github.com/neilmillard/puppet-dockerhost
  • 11. agenda • Masterless puppet • Hieradata • Roles and Profiles • Modules (via Puppetfiles) • Ordering • AWS EC2 • Stages • Docker
  • 12. hieradata • Separation of data from code docker::run { $container: image => $image, command => $command, memory_limit => $memory_limit, cpuset => $cpuset, ports => $ports, expose => $expose, volumes => $volumes, links => $links, use_name => $use_name, running => $running, volumes_from => $volumes_from, net => $net, username => $username, hostname => $hostname, env => $env, dns => $dns, dns_search => $dns_search, lxc_conf => $lxc_conf, restart_service => $restart_service, disable_network => $disable_network, privileged => $privileged, detach => $detach, extra_parameters => $extra_parameters, pull_on_start => $pull_on_start, depends => $depends, tty => $tty, require => $requires, } eyamld: image: "nginx" ports: - "80:80" env: - NGINX_HOST=foobar.com - NGINX_PORT=80 use_name: true docker::run { ‘eyamld’: image => "nginx", command => undef, memory_limit => 0b, cpuset => [], ports => ["80:80“], expose => [], volumes => [], links => [], use_name => true, running => true, volumes_from => [], net => 'bridge', username => false, hostname => false, env => [NGINX_HOST=foobar.com, NGINX_PORT=80 ], dns => [], dns_search => [], lxc_conf => [], restart_service => true, disable_network => false, privileged => false, detach => true, extra_parameters => undef, pull_on_start => false, depends => [], tty => false, require => [], } + =
  • 13. hieradata • Separation of data from code • Automatic parameter lookup # In this example, $parameter's value gets set # when `myclass` is eventually declared. # Class definition: class myclass ($parameter_one = "default text") { file {'/tmp/foo': ensure => file, content => $parameter_one, } }
  • 14. hieradata • Separation of data from code • Automatic parameter lookup • Code reuse with lookups profile::docker_containers::containers: eyamld: image: "nginx" ports: - "80:80" env: - NGINX_HOST=foobar.com - NGINX_PORT=80 use_name: true # profile::docker_containers class profile::docker_containers ($containers={}) { create_resources ( 'profile::docker_container', $containers ) }
  • 15. hieradata • Hiera.yaml – configuration --- :backends: - eyaml - yaml :eyaml: :datadir: /etc/puppetlabs/puppet/hieradata :pkcs7_private_key: /etc/puppet/secure/keys/private_key.pkcs7.pem :pkcs7_public_key: /etc/puppet/secure/keys/public_key.pkcs7.pem :yaml: :datadir: /etc/puppetlabs/puppet/hieradata :hierarchy: - "%{::init_env}/%{::init_role}" - "%{::init_role}" - "%{::init_env}" - common
  • 16. Roles and Profiles • Business Layer (Roles) only includes profiles no logic one server, one role • Implementation Layer (Profiles) Includes classes Modules and Resources create_resources{} Craig Dunn - http://www.slideshare.net/PuppetLabs/roles-talk Puppet - https://docs.puppet.com/pe/2016.2/r_n_p_intro.html http://www.slideshare.net/DaeHyung/learning-puppet-basic-thing #64
  • 17. Roles and Profiles • Defined as classes within either Roles Module or Profiles Module • Roles contain Profiles • Use include, require or class class role::dockerhost { include ::profile::base include ::profile::os_limits include ::profile::docker_base include ::profile::docker_containers class { '::profile::swapfile': before => Class['profile::base'] } } # profile::docker_containers class profile::docker_containers ($containers={}) { create_resources ( 'profile::docker_container', $containers ) }
  • 19. Modules • Librarian or r10k from Puppetfile forge "https://forgeapi.puppetlabs.com" # Base modules mod "saz/timezone", "3.0.1" mod "saz/rsyslog", "4.0.2"
  • 20. agenda • Masterless puppet • Hieradata • Roles and Profiles • Modules • Ordering • AWS EC2 • Stages • Docker
  • 21. ordering • Puppet execution is in parallel • Dependencies need order anchor { 'ntp::begin': } -> class { '::ntp::install': } -> class { '::ntp::config': } ~> class { '::ntp::service': } -> anchor { 'ntp::end': }
  • 22. ordering • Require and before class { ‘install-ssl': installdir => "$installdir", require => Exec['unarchive-source'], before => File['copy-init-file'], }
  • 23. ordering • -> • Everything else is attempted at the same time -> class { ‘install-ssl': installdir => "$installdir", } ->
  • 24. The Puppet Run • Puppet catalog compilation • Puppet catalog apply http://www.slideshare.net/bernstein_aaron/puppet-introduction-26593192 #25 Data Hieradata
  • 25. agenda • Masterless puppet • Hieradata • Roles and Profiles • Modules • Ordering • AWS EC2 • Stages • Docker
  • 26. AWS EC2 • Flexible workloads • Is limiting on memory • May need a swapfile Model vCPU (burst) Mem (GiB) t2.nano 1 0.5 t2.micro 1 1 t2.small 1 2 t2.medium 2 4 t2.large 2 8
  • 27. Stages • Simple manifests best • swapfile stage stage { 'swapfile': before => Stage['main'], } class { '::profile::swapfile': stage => swapfile before => Class['profile::base'] }
  • 28. Stages • Catalog compiles • Runs each stage based on order Notice: Compiled catalog for ip-10-96-4-130.internal in environment production in 2.10 Notice: /Stage[swapfile]/Profile::Swapfile/Exec[Create swap file /mnt/swap.1]/returns: Notice: /Stage[swapfile]/Profile::Swapfile/File[/mnt/swap.1]/mode: mode changed '0644' ... Notice: /Stage[main]/Profile::Docker_base/Exec[yum install -y docker-io]/returns: Notice: /Stage[main]/Docker::Service/File[/etc/sysconfig/docker]/content: content
  • 29. Stages • Ordering across stages WILL break • WARNING – use with care. Can cause dependency cycles
  • 30. agenda • Masterless puppet • Hieradata • Roles and Profiles • Modules • Ordering • AWS EC2 • Stages • Docker
  • 32. Docker • WhaleSay $ docker run docker/whalesay cowsay boo Unable to find image 'docker/whalesay:latest' locally latest: Pulling from docker/whalesay e9e06b06e14c: Pull complete a82efea989f9: Pull complete 37bea4ee0c81: Pull complete ... 99da72cfe067: Pull complete 5d5bd9951e26: Pull complete fb434121fc77: Already exists Digest: sha256:d6ee73f978a366cf97974115abe9c4099ed59c6f75c23d03c64446bb9cd49163 Status: Downloaded newer image for docker/whalesay:latest _____ < boo > -----
  • 33. Docker • Dockerhost configuration docker run --name eweb -p 80:80 –e “NGINX_HOST=foobar.com” –e “NGINX_PORT=80” –d nginx • Docker compose profile::docker_containers::containers: eweb: image: "nginx" ports: - "80:80" env: - NGINX_HOST=foobar.com - NGINX_PORT=80 use_name: true # profile::docker_containers class profile::docker_containers ($containers={}) { create_resources ( 'profile::docker_container', $containers ) }
  • 34. Docker • Volumes • Network • Resource Constraints • Ref: https://docs.docker.com/engine/reference/run/
  • 35. Docker • Production? • Serverless • Jenkins builds • Scale
  • 37. Can Puppet help you run Docker on a T2.micro? • Boot, prep and build instance • Puppet builds catalog and apply configuration from your heiradata • Fetch images and run docker containers
  • 38. Neil Millard Mitese Group w: www.mitese.co.uk & https://github.com/neilmillard e: neil@mitese.co.uk