The DShell Pattern DevOps Days London, 2019

David McKay ➔ Developer Advocate for InfluxData ★ Scottish ➔ Kubernetes Release Team ★ Lover of esoteric programming languages ➔ Tweets @rawkode ★ Likes symmetry

Some* developers don’t want to use Docker * No developer with macOS wants to use Docker BREAKING NEWS

Docker is useful Encapsulated Dependencies Documented Build Process Deployable

3 Components Dockerfile Docker Compose Makefile

Dockerfile Make it work for all environments

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 … …

Docker Compose Make it as (more) painful as possible (than normal)

dshell dshell: @docker-compose run \ —rm \ —service-ports \ —user $UID \ —use-aliases \ —entrypoint=ash \ myapp

Encourage DShell Block Up service: myapp: entrypoint: sh command: echo Publish Service Ports Override Entrypoint —service-ports —entrypoint=ash

DO NOT use compose syntax v3 in dev UNPOPULAR OPINION

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

Makefile Unify Developers

The Sausage .PHONY: dshell dclean up up: deps @mix run —no-halt compile: deps @mix compile

up up: @npm run develop @mix test @FLASK_APP=hello flask run

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

Final API ❏ make dshell [host] ❏ make up [container] ❏ make test | deps | whatever [container] ❏ make dclean [host]

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.

VSCode Remotes { “dockerComposeFile”: [ “../docker-compose.yml”, ], “service”: “node”, }

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