A presentation at Devopsdays London 2019 in in London, UK by David McKay
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
Docker isn’t the answer. Docker is a means to an end.
Learn how to integrate Docker into your development workflow without ever knowing it’s there.
Here’s what was said about this presentation on social media.
Here are my slides from #DevOpsDaysLdnhttps://t.co/ArquzWhapU
— David McKay (@rawkode) September 27, 2019
Here's some dshell examples:https://t.co/umtSFHaMkUhttps://t.co/U9uUGScfDS
Thank you @rawkode for the laughs and helpful tips. #DevOpsDays
— Jennifer Davis @ #devopsdays Chattanooga (@sigje) September 27, 2019
I use a similar pattern. Just didn’t know it had a name 👍
— Shaun McLernon (@mclernon) September 27, 2019
Very much enjoying @rawkode's talk which centres around making things more difficult to make them easier by replacing `docker-compose up` with `make dshell` #DevOpsDays
— Jamie Tanna | www.jvt.me (@JamieTanna) September 27, 2019
Thanks for the tip @rawkode - I run bash in docker all the time. I love the idea of checking in a Makefile to give you an interactive shell in your container to make this easier! pic.twitter.com/yEUWpAyVx8
— Edward Thomson (@ethomson) September 27, 2019
Y'all have to go and speak to @rawkode about Influx Data at #DevOpsDays just to hear more about the amazing foot jumpers (socks) they have at their stand
— Jamie Tanna | www.jvt.me (@JamieTanna) September 27, 2019