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
170
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
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1k
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
Go の GC の不得意な部分を克服したい
taiyow
2
770
Zoneless Testing
rainerhahnekamp
0
120
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
Symfony Mapper Component
soyuka
2
730
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
310
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
CSC305 Lecture 26
javiergs
PRO
0
140
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
Bash Introduction
62gerente
608
210k
Writing Fast Ruby
sferik
628
61k
Thoughts on Productivity
jonyablonski
67
4.4k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
A Philosophy of Restraint
colly
203
16k
GraphQLとの向き合い方2022年版
quramy
44
13k
The Invisible Side of Design
smashingmag
298
50k
Speed Design
sergeychernyshev
25
670
How GitHub (no longer) Works
holman
311
140k
The Language of Interfaces
destraynor
154
24k
Adopting Sorbet at Scale
ufuk
73
9.1k
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?