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

The DShell Pattern (DevOpsDays London 2019)

David McKay
September 27, 2019

The DShell Pattern (DevOpsDays London 2019)

David McKay

September 27, 2019
Tweet

More Decks by David McKay

Other Decks in Technology

Transcript

  1. The DShell Pattern DevOps Days London, 2019

  2. David McKay ➔ Developer Advocate for InfluxData ➔ Kubernetes Release

    Team ➔ Tweets @rawkode ★ Scottish ★ Lover of esoteric programming languages ★ Likes symmetry
  3. BREAKING NEWS Some* developers don’t want to use Docker *

    No developer with macOS wants to use Docker
  4. Docker is useful Encapsulated Dependencies Documented Build Process Deployable

  5. 3 Components Dockerfile Docker Compose Makefile

  6. Dockerfile Make it work for all environments

  7. Dockerfile FROM elixir:1.9-alpine AS base FROM base AS development RUN

    apk add --update vim git make FROM base AS build RUN make compile FROM base AS production COPY --from=build … ...
  8. Docker Compose Make it as (more) painful as possible (than

    normal)
  9. dshell dshell: @docker-compose run \ --rm \ --service-ports \ --user

    $UID \ --use-aliases \ --entrypoint=ash \ myapp
  10. Encourage DShell Block Up service: myapp: entrypoint: sh command: echo

    Publish Service Ports --service-ports Override Entrypoint --entrypoint=ash
  11. UNPOPULAR OPINION DO NOT use compose syntax v3 in dev

  12. Best Practice Use Depends On depends_on: mongodb: condition: service_healthy 12-Factor

    env_file: .env env_file: - .env - .env.secret
  13. Makefile Unify Developers

  14. The Sausage .PHONY: dshell dclean up up: deps @mix run

    --no-halt compile: deps @mix compile
  15. up up: @npm run develop @mix test @FLASK_APP=hello flask run

  16. dclean! dclean: @docker-compose down --rmi=local -v

  17. Final API ❏ make dshell [host] ❏ make up [container]

    ❏ make test | deps | whatever [container] ❏ make dclean [host]
  18. Better Together We’re deploying Docker to production (I hope), so

    encourage (not force) it’s usage for local development; make it easy for people to dip their toe in.
  19. VSCode Remotes { "dockerComposeFile": [ "../docker-compose.yml", ], "service": "node", }

  20. Thank You ➔ Follow me on Twitter (@rawkode) ➔ At

    the InfluxData booth (I’ve got badges and stickers) ➔ Come speak to me about InfluxDB, Cloud Native, Monitoring, Docker, or Kubernetes