Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker in Production (Docker Edinburgh, January...

David McKay
January 21, 2016

Docker in Production (Docker Edinburgh, January 2016)

Docker - the awesome utility that allows you to create a single, runnable, distributable application … but is it really that awesome?

In this talk I’ll discuss some of the common pitfalls and hurdles that one must navigate to have an enjoyable and fruitful relationship with Docker; giving you the confidence to take that relationship to the next stage: production.

David McKay

January 21, 2016
Tweet

More Decks by David McKay

Other Decks in Technology

Transcript

  1. [email protected] @rawkode github.com/rawkode Me! ★ Director of Development for TeamRock

    ★ Docker Glasgow Organiser Taking on consultancy work from Feb: • PHP ~ Go ~ Java ~ Obj-C • CQRS & Event Sourcing • DevOps / CI / CD / Docker • Domain-Driven Design • Framework agnostic code • TDD / BDD
  2. Challenge #1 - Bootstrapping a Machine (Old Way) • Instance

    boots • USER DATA script installs SaltStack (or whatever provisioning tool you use) • SaltStack Executes ◦ apt-get update ◦ apt-get install apache php5 php5-memcached ◦ Modify a bunch of configuration files for apache and php ◦ git clone codebase ◦ Get project dependencies (composer install | bundle install | goget, etc) ◦ Warm up caches ◦ Execute database migrations ◦ Finally … start apache
  3. Challenge #1 - Bootstrapping a Machine (New Way) • Instance

    boots • USER DATA script installs SaltStack (or whatever provisioning tool you use) • SaltStack Executes ◦ wget -qO- https://get.docker.com/ | sh ◦ docker pull ◦ docker run
  4. Faster Still • If you’re using AWS ◦ Use S3

    for your registry ◦ Build your own AMI with Docker installed ▪ Just remember to keep it updated / security patches
  5. Container the Agent? You can - you lose out on:

    • Disk IO metrics • System process metrics • Network metrics
  6. Integrations • MySQL • PostgreSQL • Mongo • Cassandra •

    All AWS services • PagerDuty • OpsGenie
  7. Future • Still looking at getting Prometheus or Sensu running

    • Smarter AutoScaling, based on containers - rather than instances
  8. How It Was Supposed to Work • Data Container Awesomeness

    • Container for forwarding • Sing the sweet praises of Docker
  9. Docker Log Driver Since Docker >= 1.6 --log-driver=<driver> • json-file

    • syslog • fluentd • awslogs • gelf (LogStash and Graylog)
  10. SaltStack Keeping it simple my-container: dockerng.running: - image: teamrock/blackbird:latest -

    require: - dockerng: my-container-pre my-container-pre: dockerng.running: - image: teamrock/blackbird:latest - entrypoint: /opt/deploy/pre.sh
  11. SaltStack Keeping it simple salt --async \ -C "G@ec2_tags:Environment:Production" \

    state.sls deploy \ "pillar={ 'project': 'blackbird',\ 'buildNumber': ‘BB-184’ }"
  12. SaltStack Pillars can live in: MySQL, PostgreSQL, redis, files, …

    my-container: dockerng.running: - image: teamrock/blackbird:latest - environment: - POSTGRES_URL: {{ salt[‘pillar’].get (‘postgres_url’) }} - require: - dockerng: my-container-pre