SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
@smanciot#DockerAnsible
PACKAGING ET DÉPLOIEMENT D’UNE
APPLICATION JAVAEE AVEC DOCKER ET
ANSIBLE
@smanciot
https://www.linkedin.com/in/smanciot
Architecte
@smanciot#DockerAnsible
Plan
• Docker
• Packaging
• Ambassador pattern
• Service discovery
• Ansible
• DevOps
@smanciot#DockerAnsible
Architecture
Backend
Run / Payment
Catalog
@smanciot#DockerAnsible
Docker - Pourquoi ?
• Portabilité
• Construction rapide d'images pouvant être partagées
(Dockerfile, docker-registry …)
• Performance :
• les avantages d'uneVM (isolation des processus, interface
réseau, ...) …
• … sans les inconvénients (processus exécutés au sein de
l'hôte, pas d'émulation de périphérique)
• Séparation des rôles
@smanciot#DockerAnsible
# Pull base image.
FROM mogobiz/busybox-oracle-java{{java_version}}
ENV MOGOBIZ_HOME /mogobiz
ENV JVM_OPT -Xmx1024M -XX:MaxPermSize=1024m
# Install mogobiz-admin.
ADD mogobiz-admin.jar /mogobiz/lib/mogobiz-admin.jar
# COPY ADMIN SQL SCRIPTS
RUN mkdir -p /data/sql/lib
COPY sql/sqlInstall.jar /data/sql/
COPY sql/sqlinstall.properties /data/sql/
COPY sql/lib/* /data/sql/lib/
COPY sql/{{tag}}.sh /data/sql/
RUN chmod +x /data/sql/{{tag}}.sh
ADD run.sh /run.sh
RUN chmod +x /*.sh
# Define mountable directories.
VOLUME ["/mogobiz/impex", "/mogobiz/logs", "/mogobiz/data", "/mogobiz/config", "/mogobiz/import", "/mogobiz/sql"]
# Expose ports.
EXPOSE 18080
# Define default command.
CMD /data/sql/{{tag}}.sh && /run.sh
Packaging - Dockerfile
image de base
variables d’environnement
copie de fichiers
exécution de commandes
points de montage
exposition de port(s)
commande par défaut
@smanciot#DockerAnsible
Docker - Problématique 1
backendnode1
192.168….
port ?
0.0.0.0:49154
@smanciot#DockerAnsible
backendnode1
pg_ambasador
Docker - Ambassador pattern
pg_client
172.17.0.5:5432
192.168.…:5432
@smanciot#DockerAnsible
web node1
Problématique 2
Catalog
Run / Payment
ip ? port ?
node2
Run / Payment
Run / Payment
@smanciot#DockerAnsible
node2
docker-register
Dynamic Service discovery
node1
docker-register
service registry
etcd
discover
registerregister
proxy proxy
web
docker-discover
@smanciot#DockerAnsible
Ansible
• Orchestration et automatisation des tâches d'administration
système
• provisioning
• déploiement d'application
@smanciot#DockerAnsible
Ansible - Pourquoi?
• Simplicité d’exécution : pas besoin d’agent sur les systèmes à
administrer (ssh)
• Mode Push
• Simplicité d’apprentissage (YAML)
• Performant : exécution des scripts en parallèle sur les machines
cible
• Extensible : python
• DRY : rôles
• Idempotent
• Sécurisé : ansible-vault
@smanciot#DockerAnsible
[admin]

preprod.mogobiz-admin.com



[run]

preprod.mogobiz-run.com



[mogobiz:children]

admin

run



[mogopay]

preprod.mogopay.com



[jahia]

preprod.jahiacommerce.com



[app:children]

jahia

mogobiz

mogopay
Ansible - Inventory
[admin]

prod.mogobiz-admin.com



[run]

prod.mogobiz-run.com



[mogobiz:children]

admin

run



[mogopay]

prod.mogopay.com



[jahia]

prod.jahiacommerce.com



[app:children]

jahia

mogobiz

mogopay
Hosts / pré-production Hosts / production
@smanciot#DockerAnsible
- name: Install mogobiz

hosts: mogobiz

user: $user

roles:

- {role: mogobiz-launcher, when: "'dockers' in group_names", launcher: "mogobiz"}

- {role: mogobiz-admin, when: "'dockers' in group_names"}



- name: Install mogopay

hosts: mogopay

user: $user

roles:

- {role: mogobiz-launcher, when: "not launch_all and 'dockers' in group_names",
launcher: "mogopay"}



- name: Install jahiacommerce

hosts: jahia

user: $user

roles:

- {role: jahia, when: "'dockers' in group_names"}

Ansible - Playbook
groupe de machines
roles
condition d’exécution
@smanciot#DockerAnsible
Ansible - Playbook / Rôle
rôle
variables
tâches
templates
playbook
@smanciot#DockerAnsible
- file: path=/elasticsearch/docker state=directory



- name: copy elasticsearch binary files

copy: src={{item}} dest=/elasticsearch/docker/

with_items:

- run.sh

register: elasticsearch_run



- name: copy elasticsearch docker file

template: src=Dockerfile.j2 dest=/elasticsearch/docker/Dockerfile

register: elasticsearch_dockerfile



- name: copy elasticsearch configuration file

template: src=elasticsearch.yml.j2 dest=/elasticsearch/docker/elasticsearch.yml

register: elasticsearch_configuration



- name: build elasticsearch

docker_image: path="/elasticsearch/docker"

name="mogobiz/busybox-elasticsearch-{{es_version}}"

state=build

register: build_elasticsearch

when: elasticsearch_run|changed or elasticsearch_dockerfile|changed or
elasticsearch_configuration|changed
Ansible - build image
fichiers à intégrer à l’image
template
build image
@smanciot#DockerAnsible
- name: ensure elasticsearch container is running

docker:

image: mogobiz/busybox-elasticsearch-{{es_version}}:latest

memory_limit: 1024MB

name: elasticsearch

ports: 9200,9300

state: reloaded

restart_policy: always

volumes: /var/lib/elasticsearch:/var/lib/elasticsearch:rw,/var/log/elasticsearch:/var/log/elasticsearch:rw

register: start_elasticsearch

when: "elasticsearch_running is not defined or not elasticsearch_running or stop_elasticsearch_container|changed"



- name: ensure elasticsearch ambassador is running

docker:

image: cpuguy83/docker-grand-ambassador

name: elasticsearch_ambassador

command: "-name elasticsearch"

net: "bridge"

expose: "9200,9300"

ports: "{{ hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] }}:9200:9200,
{{ hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] }}:9300:9300"

volumes: /var/run/docker.sock:/var/run/docker.sock:ro

state: reloaded

restart_policy: always

register: start_elasticsearch_ambassador
Ansible - launch containers
image
nom du container
bindings de ports
bindings points de montage
@smanciot#DockerAnsible
Démarche DevOps
1
2
3
4
5
Dev
Ops
Continuous delivery
platform
VCS
dev uat
prod
docker registry
6
@YourTwitterHandle@YourTwitterHandle@smanciot#DockerAnsible
Q & A

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Vagrant + Docker
Vagrant + DockerVagrant + Docker
Vagrant + Docker
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker Compose
 
Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and code
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Django via Docker
Django via DockerDjango via Docker
Django via Docker
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 

Ähnlich wie Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015

PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
Hannes Hapke
 

Ähnlich wie Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015 (20)

DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?Ruby on Rails and Docker - Why should I care?
Ruby on Rails and Docker - Why should I care?
 
Docker - Der Wal in der Kiste
Docker - Der Wal in der KisteDocker - Der Wal in der Kiste
Docker - Der Wal in der Kiste
 
Docker presentasjon java bin
Docker presentasjon java binDocker presentasjon java bin
Docker presentasjon java bin
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Docker 101
Docker 101 Docker 101
Docker 101
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM BluemixContinuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Techtalks: taking docker to production
Techtalks: taking docker to productionTechtalks: taking docker to production
Techtalks: taking docker to production
 
JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
 
Making Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container ServiceMaking Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container Service
 
Docker 1.9 Feature Overview
Docker 1.9 Feature OverviewDocker 1.9 Feature Overview
Docker 1.9 Feature Overview
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015