Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Microplugins with Docker
Search
Julien Vey
April 17, 2015
Programming
5
940
Microplugins with Docker
Julien Vey
April 17, 2015
Tweet
Share
More Decks by Julien Vey
See All by Julien Vey
Du Dev à la Prod... et ensuite ?
julienvey
0
18
On-Demand CI/CD with Gitlab and Kubernetes
julienvey
0
32
From CI to CD in a microservice architecture
julienvey
1
61
Terraform
julienvey
1
250
OpenStack Solum Presentation
julienvey
0
120
Use OpenStack as a Vagrant Provider
julienvey
0
160
Docker and its Ecosystem
julienvey
8
1.2k
Introducing Solum: Application Development in OpenStack
julienvey
1
810
Docker, Get used to it !
julienvey
7
3.1k
Other Decks in Programming
See All in Programming
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Jakarta EE meets AI
ivargrimstad
0
140
受け取る人から提供する人になるということ
little_rubyist
0
230
EventSourcingの理想と現実
wenas
6
2.3k
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
subpath importsで始めるモック生活
10tera
0
300
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Ethereum_.pdf
nekomatu
0
460
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Contemporary Test Cases
maaretp
0
130
Featured
See All Featured
BBQ
matthewcrist
85
9.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Music & Morning Musume
bryan
46
6.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Transcript
Microplugins DOCKER ******************* WITH *******************
Freelance « DevOps » JULIEN VEY ERIC BELLEMON ********************************************* at
bywan @julienvey @haklop
BY NOW, WE THINK YOU KNOW WHAT IS DOCKER WHAT
?
DOCKER HOW ? Patterns *******************************************
MICROSERVICES
A MICROSERVICE IS USUALLY A PERSISTANT SERVICE YOU CAN ACCESS
VIA AN API
GO GO PYTHON RUBY NODE JAVA JAVA PHP ANY LANGUAGE
UBUNTU REDHAT DEBIAN CENTOS FEDORA FEDORA DEBIAN CENTOS ANY DISTRIBUTION
AWS GCE COREOS ANY WHERE
WHY CONTAINERS AND NOT VMS? CONTAINERS ARE LIGHTWEIGHT SPAWN FAST
USE LAYERS
DOCKER Tips n’ Tricks ******************************************* HOW ?
DOCKER IN DOCKER
THE DOCKER MODEL DOCKER DAEMON UNIX SOCKET DOCKER REMOTE API
DOCKER CLI creates an which exposes the that can be used by the
FIRST APPROACH
DOCKER IN DOCKER IN DOCKER …
docker run --privileged -t -i jpetazzo/dind SPECIAL DOCKER IMAGE
docker run --privileged -t -i jpetazzo/dind PRIVILEGED MODE
docker run --privileged -t -i jpetazzo/dind PRIVILEGED MODE
IT RAISES SOME PROBLEMS INIT SYSTEM DISK SPACE CUSTOM IMAGE
SECOND APPROACH
DOCKER IN DOCKER IN DOCKER … DOCKER HOST DOCKER SOCKET
docker run -v /var/run/docker.sock:/var/run/docker.sock [your image] DOCKER SOCKET AS A
DOCKER VOLUME
docker run -v /var/run/docker.sock:/var/run/docker.sock [your image] DOCKER SOCKET AS A
DOCKER VOLUME
NO PRIVILEGED MODE ONLY ONE DOCKER DAEMON (INSTEAD OF ONE
PER CONTAINER)
What about ? MICRO PLUGINS *********************************************
MICROSERVICE: A SMALL SERVICE RUNNING IN A CONTAINER
MICROPLUGIN: A SMALL PLUGIN RUNNING IN A CONTAINER
What is a ? Plugin Architecture *********************************************
A STANDARD INTERFACE A LOADING MECHANISM A PACKAGING MECHANISM A
DISTRIBUTION MECHANISM
VAGRANT ******************* WITH ******************* A PLUGIN ARCHITECTURE RUBY EXAMPLE
A STANDARD INTERFACE require 'vagrant' module VagrantPlugins module Openstack class
Provider < Vagrant.plugin('2', :provider) RUBY CLASSES
A LOADING MECHANISM RUBY DYNAMIC LOADING SOURCES INSTALLED IN VAGRANT
BUNDLE DIR
A PACKAGING MECHANISM RUBY GEM PACKAGE CODE AND DOCUMENTATION DESCRIBE
DEPENDENCIES
A DISTRIBUTION MECHANISM RUBYGEMS.ORG
****************** AND ****************** PROS CONS
PLATFORM INDEPENDANT PACKAGING AND DISTRIBUTION ARE NOT SPECIFIC TO VAGRANT
PROS
RUBY ONLY DEPENDENCY MANAGEMENT CAN BE HARD CONS
JENKINS ****************** WITH ****************** A PLUGIN ARCHITECTURE JAVA EXAMPLE
A STANDARD INTERFACE package jenkins.plugins.git; public abstract class AbstractGitSCMSource extends
SCMSource { protected SCMRevision retrieve(…) protected void retrieve(…) } JAVA INTERFACES & CLASSES
A LOADING MECHANISM JAVA CLASSLOADING
A PACKAGING MECHANISM JPI/HPI = JENKINS/HUDSON PLUG IN CUSTOM PACKAGING
(JPI/HPI)
UPDATES.JENKINS-CI.ORG A DISTRIBUTION MECHANISM JENKINS HAS ITS OWN
****************** AND ****************** PROS CONS
PLATFORM INDEPENDANT COMPILED PROS
JVM ONLY DISTRIBUTION CONS SPECIFIC MECHANISM PACKAGING
Can we do DOCKER ? a Plugin Architecture *********************** WITH
***********************
Docker ****************** WITH ****************** A PLUGIN ARCHITECTURE
A STANDARD INTERFACE
A STANDARD INTERFACE DOCKER VOLUMES ├ config │ ├ config.json
│ ├ key ├ src │ ├ main.go │ ├ main_test.go │ ├ Makefile DOCKER PLUGIN INPUT & OUPUT
A STANDARD INTERFACE DOCKER VOLUMES ├ config │ ├ config.json
│ ├ key ├ src │ ├ main.go │ ├ main_test.go │ ├ Makefile DOCKER PLUGIN A DOCKER PLUGIN B ├ binaries │ ├ main_darwin_amd64 │ ├ main_linux_x86 INPUT & OUPUT
A STANDARD INTERFACE ENVIRONMENT VARIABLES docker run my_plugin -e URL=github.com
-e DEPTH=3 INPUT ONLY
A STANDARD INTERFACE DOCKER EXIT CODE OUTPUT ONLY docker run
my_image echo $?
A LOADING MECHANISM
A LOADING MECHANISM DOCKER RUN docker run my_plugin
A PACKAGING MECHANISM
A PACKAGING MECHANISM DOCKER BUILD DOCKER IMAGES DOCKERFILES
A DISTRIBUTION MECHANISM
A DISTRIBUTION MECHANISM DOCKER HUB HUB.DOCKER.COM FOR PUBLIC PLUGINS
A DISTRIBUTION MECHANISM ANY DOCKER REGISTRY FOR PUBLIC AND PRIVATE
PLUGINS (OR DOCKER DISTRIBUTION NOW)
****************** VS ****************** CLASSIC PLUGIN Docker ****************** VS ****************** ARCHITECTURE
NEED TO LEARN ONLY ONE LANGUAGE BUT TIED TO THIS
LANGUAGE LANGUAGE AGNOSTIC PROGRAMMING LANGUAGE CLASSIC DOCKER
NEED TO BE WRAPPED CAN BE NATIVE LANGUAGE CAN BE
CHOSEN ACCORDINGLY NATIVE TOOLS CLASSIC DOCKER
VERY SPECIALIZED INTERFACES HARD TO MAINTAIN RETRO-COMPATIBILITY SIMPLE INTERFACES BUT
ALSO PERMISSIVE COMPATIBILITY CLASSIC DOCKER
MANUALLY IMPLEMENTED DOCKER ECOSYSTEM CAN BE TRICKY WITH VOLUMES SCALING
CLASSIC DOCKER
GIT PLUGIN ******************* WITH ******************* AN EXAMPLE COMPARISON
THE COMPETITION RETRIEVE SOURCE CODE Git URL Git Branch SSH
Private key Source Code ?
JENKINS
JENKINS ~600 LINES OF CODE TO DO ‘GIT CLONE’
JENKINS ~600 LINES OF CODE TO DO ‘GIT CLONE’
DOCKER ├ private-key ├ out │ ├ main.go │ ├
main_test.go │ ├ Makefile GIT PLUGIN CONTAINER $SCM_URL $SCM_BRANCH
DOCKER FROM debian:jessie RUN apt-get update \ && apt-get install
-y git ADD run.sh /run.sh RUN echo "IdentityFile /private-key" \ >> /etc/ssh/ssh_config CMD ["/run.sh"] #!/bin/bash git clone "$SCM_URL" --recursive /out cd /out && git checkout "$SCM_BRANCH" Dockerfile run.sh
NOW THAT WE HAVE 1 PLUGIN, HOW CAN WE ORCHESTRATE
MULTIPLE PLUGINS ?
BUILD PIPELINE EXAMPLE 1. FETCH SOURCE CODE 2. COMPILE &
PACKAGE 3. TEST IT
BUILD PIPELINE EXAMPLE ORCHESTRATOR CONTAINER
GIT PLUGIN CONTAINER ├ private-key $SCM_URL $SCM_BRANCH BUILD PIPELINE EXAMPLE
ORCHESTRATOR CONTAINER docker run git_plugin
GIT PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH BUILD PIPELINE EXAMPLE ORCHESTRATOR CONTAINER docker run git_plugin
GIT PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH BUILD PIPELINE EXAMPLE MAVEN PLUGIN CONTAINER ORCHESTRATOR CONTAINER docker run git_plugin docker run maven_plugin
GIT PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH BUILD PIPELINE EXAMPLE MAVEN PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run git_plugin docker run maven_plugin
GIT PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH BUILD PIPELINE EXAMPLE MAVEN PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run git_plugin docker run maven_plugin docker run selenium_plugin echo $?
GIT PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH MERCURIAL INSTEAD OF GIT ? MAVEN PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run git_plugin docker run maven_plugin docker run selenium_plugin echo $?
HG PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH MERCURIAL INSTEAD OF GIT ? MAVEN PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run hg_plugin docker run maven_plugin docker run selenium_plugin echo $?
HG PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH MAVEN PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run hg_plugin docker run maven_plugin docker run selenium_plugin echo $? GRADLE INSTEAD OF MAVEN ?
HG PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH GRADLE INSTEAD OF MAVEN ? GRADLE PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run hg_plugin docker run gradle_plugin docker run selenium_plugin echo $?
HG PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH ANOTHER BUILD WORKFLOW ? GRADLE PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war ORCHESTRATOR CONTAINER docker run hg_plugin docker run gradle_plugin docker run selenium_plugin echo $?
HG PLUGIN CONTAINER ├ private-key ├ src │ ├ Main.java
│ ├ pom.xml $SCM_URL $SCM_BRANCH ANOTHER BUILD WORKFLOW ? GRADLE PLUGIN CONTAINER SELENIUM PLUGIN CONTAINER ├ output │ ├ main.war YOUR OWN ORCHESTRATOR CONTAINER docker run hg_plugin docker run gradle_plugin docker run selenium_plugin echo $?
Our Experiment BAZOOKa ******************* WITH *******************
Our Experiment BAZOOKa ******************* WITH *******************
None
CONCLUSION *************************************************
DOCKER MICROPLUGINS EASY TO SETUP EXTENSIBLE PERMISSIVE EASY TO DISTRIBUTE
LANGUAGE AGNOSTIC
QUESTIONS?