D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O...
Transcript of D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O...
![Page 1: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/1.jpg)
DE DESARROLLO A PRODUCCIÓN USANDODE DESARROLLO A PRODUCCIÓN USANDO
DOCKERDOCKER
Christian A. Rodriguez
https://github.com/chrodriguez@car_unlp
![Page 2: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/2.jpg)
AGENDAAGENDADocker: introducción rápidaConsideraciones para trabajar con dockerVolumenesDocker ComposeWork�ow de desarrolloDocker en producciónRancherWork�ow completo
![Page 3: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/3.jpg)
DOCKERDOCKERINTRODUCCIÓN RÁPIDAINTRODUCCIÓN RÁPIDA
![Page 4: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/4.jpg)
¿QUÉ ES DOCKER?¿QUÉ ES DOCKER?Contenedores de software.
Empaqueta aplicaciones en una unidad estándarde intercambio.
Única pieza de software en un �lesystem completoque contiene todo lo necesario para ejecutar unaaplicación: código, librerías, herramientas, etc.Garantiza que el software siempre correrá de igualforma sin importar su ambiente.
![Page 5: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/5.jpg)
¿POR QUÉ DOCKER?¿POR QUÉ DOCKER?Rápida con�guración de entornos de desarrollo.Favorece las arquitecturas de microservicios.Diferencias entre el ambiente de desarrollo, testing yproducción.Instalación de una aplicación en diferentesplataformas.Deploy de aplicaciones complejas.Ejecución de código antiguo.Escalamiento horizontal.
![Page 6: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/6.jpg)
¿DÓNDE CORRE DOCKER?¿DÓNDE CORRE DOCKER?Docker puede correrse en:
Linux.MacOS.Windows.
![Page 7: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/7.jpg)
LA IDEA DETRÁS DE LOS CONTENEDORESLA IDEA DETRÁS DE LOS CONTENEDORESSistema Operativo recortado.Un único proceso corriendo: buena práctica.
No utilizan manejadores de procesos tipo systemd.Red privada bridgeada en los contenedores.
Si se quiere exponer un puerto se debe realizarexplícitamente.
El �lesystem utiliza Union File System ( ).Basado en capas.Al eliminar un contenedor, su �lesystemdesaparece.
UFS
![Page 8: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/8.jpg)
IMÁGENES Y CONTENEDORESIMÁGENES Y CONTENEDORESImagen:
Filesystem y parámetros para utilizarla.No cambia nunca y no tiene estados.
Contenedor:Instancia de una imagen (resultado de ejecutarla).Tiene una capa de RW volátil.
![Page 9: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/9.jpg)
IMÁGENES Y CONTENEDORESIMÁGENES Y CONTENEDORES
![Page 10: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/10.jpg)
IMÁGENES Y CONTENEDORESIMÁGENES Y CONTENEDORES
![Page 11: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/11.jpg)
IMÁGENES Y CONTENEDORESIMÁGENES Y CONTENEDORES
![Page 12: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/12.jpg)
IMÁGENES Y CONTENEDORESIMÁGENES Y CONTENEDORES
![Page 13: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/13.jpg)
COMANDOS BÁSICOSCOMANDOS BÁSICOS# Más usados docker run docker ps docker build docker images docker logs docker inspect docker volume # Otros comandos comunes docker commit docker pull docker push docker tag
![Page 14: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/14.jpg)
UN EJEMPLO DE USO DE DOCKERUN EJEMPLO DE USO DE DOCKEREl siguiente es un ejemplo interactivo
$ docker run --rm -it ubuntu:14.04 Unable to find image 'ubuntu:14.04' locally 14.04: Pulling from library/ubuntu c2c80a08aa8c: Pull complete 6ace04d7a4a2: Pull complete f03114bcfb25: Pull complete 99df43987812: Pull complete 9c646cd4d155: Pull complete Digest: sha256:b92dc7814b2656da61a52a50020443223445fdc2caf1ea0c Status: Downloaded newer image for ubuntu:14.04 root@99a3403db59a:/# cat /etc/issue Ubuntu 14.04.5 LTS \n \l
![Page 15: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/15.jpg)
CREANDO IMÁGENESCREANDO IMÁGENESLas imágenes docker pueden crearse:
A partir de un contenedor óUsando Docker�les
![Page 16: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/16.jpg)
IMÁGENES A PARTIR DE UN CONTENEDORIMÁGENES A PARTIR DE UN CONTENEDORComo los contenedores establecen una capa volátil por
encima de la pila de capas de una imagen origen, unavez editado todo lo necesario en un contenedor, los
cambios pueden comitirse en una imagen.$ docker run -it ubuntu:14.04 root@7c78d0a777df:/# apt-get update \ && apt-get install -y nginx && apt-get clean root@7c78d0a777df:/# exit
![Page 17: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/17.jpg)
IMÁGENES A PARTIR DE UN CONTENEDORIMÁGENES A PARTIR DE UN CONTENEDORVeri�camos el contenedor anterior
CREAMOS LA IMAGENCREAMOS LA IMAGEN
A partir de ahora es posible utilizar la imagen chrodriguez/nginx:ubuntu-14.04
$ docker ps -a CONTAINER ID IMAGE COMMAND 7c78d0a777df ubuntu:14.04 "/bin/bash"
$ docker commit 7c78d0a777df chrodriguez/nginx:ubuntu-14.04
$ docker run --rm -p 8080:80 chrodriguez/nginx:ubuntu-14.04 \ nginx -g "daemon off;"
![Page 18: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/18.jpg)
DOCKERFILEDOCKERFILEArchivo de texto plano para crear imágenes deDocker.Permite escribir instrucciones a ejecutar.Automatiza el proceso de la creación de imágenes.Permite repetir y modi�car fácilmente una imagen.Generar de forma simple imágenes derivadas.
![Page 19: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/19.jpg)
DOCKERFILEDOCKERFILE
CREAMOS LA IMAGENCREAMOS LA IMAGEN
FROM ubuntu:16.04 # Instalar Nginx y configurar una página personalizada RUN apt-get update && apt-get install -y nginx RUN mkdir /var/www/html/ejemplo RUN echo "<html><h1>Nginx en Docker</h1></html>" > /var/www/html/ EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
docker build -f Dockerfile -t chrodriguez/nginx:ubuntu-16.04 .
![Page 20: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/20.jpg)
HISTORIA DE IMAGENHISTORIA DE IMAGEN$ docker history chrodriguez/nginx:ubuntu-16.04 IMAGE CREATED CREATED BY 8fd110f3364a 9 minutes ago /bin/sh -c #(nop) CMD ["nginx" df1abe4570d5 9 minutes ago /bin/sh -c #(nop) EXPOSE 80/tcp 4c9ad433769b 9 minutes ago /bin/sh -c echo "<html><h1>Nginx aff42d6aa899 9 minutes ago /bin/sh -c mkdir /var/www/html/e 136943551ea1 9 minutes ago /bin/sh -c apt-get update && apt f753707788c5 4 weeks ago /bin/sh -c #(nop) CMD ["/bin/ba <missing> 4 weeks ago /bin/sh -c mkdir -p /run/systemd <missing> 4 weeks ago /bin/sh -c sed -i 's/^#\s*\(deb. <missing> 4 weeks ago /bin/sh -c rm -rf /var/lib/apt/l <missing> 4 weeks ago /bin/sh -c set -xe && echo '#! <missing> 4 weeks ago /bin/sh -c #(nop) ADD file:b1cd0
![Page 21: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/21.jpg)
LA REGISTRYLA REGISTRYServicio para almacenar y distribuir imágenes deDocker.Disponible en forma local o usar servicios en la nube:
Instalación local:Acceso local para mayor velocidad de descarga.Imágenes privadas en un ambiente controlado ygestionado por la organización.
Servicios en la nube:Generalmente las registries privadas tienencosto.
![Page 22: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/22.jpg)
REGISTRY COMO SERVICIOSREGISTRY COMO SERVICIOS
Gratis para imágenes públicas.Plan pago para imágenes privadas.Soporta builds automáticos.Cuentas para organizaciones.
Gratis para imágenes públicas o privadas.Soporta builds automáticos.Cuentas para organizaciones.
Docker Hub
Gitlab Registry
![Page 23: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/23.jpg)
CONSIDERACIONESCONSIDERACIONESPARA TRABAJAR CONPARA TRABAJAR CON
DOCKERDOCKER
![Page 24: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/24.jpg)
INTRODUCCIÓNINTRODUCCIÓNYa sabemos que:
Las imágenes Docker son inmutables.Los contenedores crean una capa con lasdiferencias correspondientes respecto de laimagen original.
Entonces los contenedores deberían minimizar loscambios respecto de la imagen original.
Optimizando el uso de espacio y evitandoimpactos de performance.Promoviendo la reusabilidad.
![Page 25: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/25.jpg)
INMUTABILIDAD EN LA INFRAESTRUCTURAINMUTABILIDAD EN LA INFRAESTRUCTURADesplegar una actualización de una aplicación,consiste en crear nuevas intancias y destruir lasanteriores, en vez de actualizarlas sobre la instanciaproductiva.Una vez que una aplicación está corriendo,¡evitamos tocarla! promoviendo así:
Repetibilidad.Reducir costos de mantenimiento.Simpli�car rollbacks.
![Page 26: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/26.jpg)
LOGRAR INMUTABILIDADLOGRAR INMUTABILIDADDeben cumplirse los siguientes requerimientos:
La aplicación debe ser stateless. Su estado debealmacenarse en un servicio por fuera del alcancede la infraestructura inmutable.Existe un template y/o conjunto de instruccionesque permiten desplegar una instancia de laaplicación desde cero.
El segundo punto lo resuelve fácilmente Docker.
![Page 27: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/27.jpg)
¿QUÉ ES DINÁMICO ENTONCES?¿QUÉ ES DINÁMICO ENTONCES?Archivos que se generan por la aplicación.Uploads desde la aplicación.Logs.Spool.
![Page 28: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/28.jpg)
IMÁGENES MAL FORMADASIMÁGENES MAL FORMADASUn mal diseño de las imágenes impactará en la
performance de los contenedores que generarángrandes capas con datos dinámicos.
Ante la actualización del contenedor, estos datos seperderán.
![Page 29: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/29.jpg)
¿CÓMO VERIFICAR UN MAL DISEÑO?¿CÓMO VERIFICAR UN MAL DISEÑO?La opción -s visualiza el tamaño de la capa del
contenedor. Su valor debe tender a cero$ docker ps -s docker ps -s CONTAINER ID IMAGE .... SIZE 6ce39ac62830 ubuntu:16.04 .... 0B (virtual 120MB)
root@6ce39ac62830:/# echo "hola" > /tmp/prueba
$ docker ps -s docker ps -s CONTAINER ID IMAGE .... SIZE 6ce39ac62830 ubuntu:16.04 .... 5B (virtual 120MB)
![Page 30: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/30.jpg)
¿CÓMO VERIFICAR UN MAL DISEÑO?¿CÓMO VERIFICAR UN MAL DISEÑO?El tamaño es lo que crece el contenedor respecto de la imagen. El tamaño virtual es lo que
ocupa el contenedor sumado al tamaño de la imagen.
root@6ce39ac62830:/# dd if=/dev/zero of=/tmp/lala.img bs=1M count10+0 records in 10+0 records out 10485760 bytes (10 MB, 10 MiB) copied, 0.0127865 s, 820 MB/s
$ docker ps -s docker ps -s CONTAINER ID IMAGE .... SIZE 6ce39ac62830 ubuntu:16.04 .... 10.5MB (virtual 13
$ docker diff 6ce39ac62830 C /tmp A /tmp/lala.img A /tmp/prueba
![Page 31: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/31.jpg)
BUENAS PRÁCTICASBUENAS PRÁCTICASLos contenedores deben ser efímeros: pararlos,destruirlos y volverlos a iniciar con una mínimacon�guración.Evitar paquetes innecesarios: las imágenes nodeben incluir paquetes que no se utilicen.Un proceso por contenedor: en la mayoría de loscasos, se debe correr un proceso por contenedor.La (in)necesidad de ssh: acceder a un contenedor esalgo que debemos evitar.
![Page 32: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/32.jpg)
VOLÚMENESVOLÚMENES
![Page 33: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/33.jpg)
¿CÓMO SE PERSISTEN LOS DATOS?¿CÓMO SE PERSISTEN LOS DATOS?Los contenedores son volátiles e inmutables.Debemos preservar la información importante.¿Dónde?
En volúmenes de datos.
![Page 34: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/34.jpg)
CARACTERÍSTICAS DE LOS VOLÚMENESCARACTERÍSTICAS DE LOS VOLÚMENESNo utilizan un sistema de archivos de unión (UFS).Pueden compartirse y reusarse entre contenedores.Los cambios se hacen directamente en el volumen.La información del volumen no se incluye en laimagen.Persisten aún cuando se eliminen todos loscontenedores que los usan.
Pueden quedar volúmenes sin referenciar.
![Page 35: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/35.jpg)
TIPOS DE VOLÚMENESTIPOS DE VOLÚMENESVolúmenes anónimos.Volúmenes nombrados.Volúmenes desde el SO host.
![Page 36: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/36.jpg)
TIPOS DE VOLÚMENESTIPOS DE VOLÚMENESAl crear un volúmen anónimo o nombrado, lainformación que exista en el punto de montaje secopia al volumen.Con volúmenes desde el SO host o desde otrocontenedor, se oculta la información que exista en elpunto de montaje.
Correspondencia con el comando mount.
![Page 37: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/37.jpg)
MANEJO DE VOLÚMENESMANEJO DE VOLÚMENES$ docker run -it -v /prueba ubuntu:16.04 /bin/bash root@a9c1a6e6c0ea:/# ls /prueba/ root@a9c1a6e6c0ea:/# echo "Prueba" > /prueba/archivo root@a9c1a6e6c0ea:/# exit $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS a9c1a6e6c0ea ubuntu "/bin/bash" 2 minutes ago Exited (0) A $ docker volume ls DRIVER VOLUME NAME local e9c7022b8c7bec55891ca44b8c40de1e5f41cf0fe9505a334bca0 $ ls /var/lib/docker/volumes/e9c7022b8c7bec55891ca44b8c40de1e5f41 archivo
![Page 38: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/38.jpg)
VOLÚMENES NOMBRADOSVOLÚMENES NOMBRADOS$ docker run -it -v test:/prueba ubuntu /bin/bash root@7def6f99f957:/# ls /prueba/ root@7def6f99f957:/# echo "Prueba" > /opt/archivo root@7def6f99f957:/# exit $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS 7def6f99f957 ubuntu "/bin/bash" 2 minutes ago Exited (0) $ docker volume ls DRIVER VOLUME NAME local test $ ls /var/lib/docker/volumes/test/_data archivo
![Page 39: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/39.jpg)
DOCKER COMPOSEDOCKER COMPOSE
![Page 40: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/40.jpg)
¿QUÉ ES DOCKER COMPOSE?¿QUÉ ES DOCKER COMPOSE?Herramienta que permite correr aplicacionescompuestas por múltiples contenedores.La arquitectura se de�ne y con�gura en un archivode texto ( ).
Simple e intuitivo.Se vale de un comando para:
Iniciar, detener y reconstruir servicios.Ver el estado de los servicios, los logs, etc.
YAML
![Page 41: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/41.jpg)
VERSIONES DE DOCKER COMPOSEVERSIONES DE DOCKER COMPOSEHay tres versiones mayores diferentes, la 1, la 2 y la3.Entre la 1 y la 2 no son compatibles entre sí, entre la2 y la 3 comparten estructura, pero se quitan algunasopciones en la 3.Veremos la sintaxis de la versión 3.
![Page 42: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/42.jpg)
DOCKER COMPOSE: EJEMPLODOCKER COMPOSE: EJEMPLOInstalación de Wordpress.
Vamos a crear un archivo llamado docker-compose.yml.De�niremos allí la arquitectura de la aplicación.Nos valdremos del comando docker-composepara levantar Wordpress e interactuar con loscontenedores generados.
![Page 43: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/43.jpg)
DOCKER COMPOSE PARA WORDPRESSDOCKER COMPOSE PARA WORDPRESS
Descargar
version: '3' services: db: image: mysql:5.7 volumes: - dbdata:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: super_secret MYSQL_DATABASE: wordpress wordpress: depends_on: - db
image: wordpress:4.9.5-php7.0-apache
docker-compose.yml
![Page 44: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/44.jpg)
INICIANDO LOS SERVICIOS DE WORDPRESSINICIANDO LOS SERVICIOS DE WORDPRESS$ docker-compose up -d Creating network "wordpress_default" with the default driver Creating volume "wordpress_dbdata" with default driver Creating volume "wordpress_site" with default driver Creating wordpress_db_1 ... done Creating wordpress_wordpress_1 ... done $ docker-compose ps Name Command State -----------------------------------------------------------------wordpress_db_1 docker-entrypoint.sh mysqld Up wordpress_wordpress_1 docker-entrypoint.sh apach ... Up
![Page 45: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/45.jpg)
USAMOS WORDPRESSUSAMOS WORDPRESS
$ docker-compose logs -f wordpress_1 | 172.27.0.1 - - [18/Apr/2018:17:40:45 +0000] "GET / wordpress_1 | 172.27.0.1 - - [18/Apr/2018:17:40:45 +0000] "GET /wAppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safarwordpress_1 | 172.27.0.1 - - [18/Apr/2018:17:40:47 +0000] "GET /Safari/537.36"
![Page 46: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/46.jpg)
INICIANDO Y DETENIENDO WORDPRESSINICIANDO Y DETENIENDO WORDPRESSPara detenerlo
Para iniciarlo
docker-compose down detiene y luego remueve los contenedores
$ docker-compose stop Stopping wordpress_wordpress_1 ... done Stopping wordpress_db_1 ... done
$ docker-compose start Starting db ... done Starting wordpress ... done
![Page 47: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/47.jpg)
WORKFLOW DEWORKFLOW DEDESARROLLODESARROLLO
![Page 48: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/48.jpg)
LOS EQUIPOS DE DESARROLLO…LOS EQUIPOS DE DESARROLLO…Deben
Versionar el código: SVN, GIT..
DeberíanAplicar Testing: TDD o mejor aún BDD.Revisión de código.Integración continua.Flujos claros de versionado de código: ,
, .
Utilizar Versionado semántico
git-�owGitLab Flow Github Flow
![Page 49: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/49.jpg)
LA INFRAESTRUCTURA…LA INFRAESTRUCTURA…Debe proveer ambientes diferentes para poder aplicarcontroles de calidad previos a la puesta en producción:
PreproducciónQAPruebas
Automatizar la creación y mantenimiento de estosambientes
![Page 50: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/50.jpg)
EL VERSIONADOEL VERSIONADOImplementando un �ujo para el uso del versionadode código, se realizan varios merge a la ramaprincipal, generalmente master.
Integración continua.Correr tests antes de cada merge.Revisión de código: simple con �ujos propuestos porGitHub/Gitlab a través PR/MR.
![Page 51: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/51.jpg)
NUEVOS RELEASESNUEVOS RELEASESUn nuevo release respeta semver, entonces sunombre será X.Y.Z.
Según el lenguaje, será necesario compilar y subirel binario a un repositorio: o .Con docker es el momento de crear una imagendocker y subirla a la registry
Si automatizamos estas tareas estamos implementando
Artifactory Nexus
entrega continua
![Page 52: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/52.jpg)
DESPLIEGUE DE VERSIONESDESPLIEGUE DE VERSIONESNo es lo mismo un despliegue de cero que unaactualización
Existe estrategias de actualización:
Esta tarea es complicada si se realiza manualSobre todo con aplicaciones que escalanhorizontalmenteDocker es una gran simpli�cación a esteproblema
Canary deploymentBlue Green deployment
![Page 53: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/53.jpg)
DOCKER ENDOCKER ENPRODUCCIÓNPRODUCCIÓN
![Page 54: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/54.jpg)
DOS ENFOQUESDOS ENFOQUESUsar Docker para iniciar servicios de forma aislada.Usar un cluster de Docker.
![Page 55: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/55.jpg)
DOCKER EN FORMA AISLADADOCKER EN FORMA AISLADACada servidor Linux corre el servicio de Docker.Los contenedores pueden iniciarse automáticamentedurante el booteo usando:
Manejadores de procesos: , o, etc
A través de políticas de reinicio (Docker >= 1.2).
upstart systemdsupervisor
![Page 56: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/56.jpg)
CLUSTERS DOCKERCLUSTERS DOCKERUn cluster dispone de nodos corriendo Docker Engine
de tal forma de poder utilizarlos para corrercontenedores.
Estos nodos pueden usar SO muy pequeños (~ 50MB)dado que su única razón de ser es la de proveer un
kernel con docker engine:
![Page 57: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/57.jpg)
LOS CLUSTERS MÁS CONOCIDOSLOS CLUSTERS MÁS CONOCIDOS
Swarm
Cattle/Rancher
Kubernetes
Apache Mesos
![Page 58: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/58.jpg)
CARACTERÍSTICAS DE TODOS LOSCARACTERÍSTICAS DE TODOS LOSCLUSTERSCLUSTERS
Diseño descentralizado.Servicios, pods o stacks en vez de contenedores.Posibilidad de escalar.Conciliación para alcanzar el estado deseado.Service discovery.Load balancing.Actualizaciones en caliente.
![Page 59: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/59.jpg)
CONSIDERACIONESCONSIDERACIONESEl scheduler es el encargado de determinar dónde seinicia cada contenedor.Asociado al scheduler trabajan los health checks quegarantizan la conciliación de un estado deseado: quehaya N contenedores para el servicio X.La distribución mágica del scheduler complica elmanejo de volúmenes.
Los volúmenes pertenecen a un nodo.Si el nodo cambia, se pierden los datos.
![Page 60: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/60.jpg)
VOLÚMENES DISTRIBUIDOSVOLÚMENES DISTRIBUIDOSNecesidad de compartir datos entre los nodos delcluster.Aparecen diferentes implementaciones devolúmenes compartidos. Las más populares son:
NFSFlocker
![Page 61: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/61.jpg)
RANCHERRANCHERInterfaz web amigable para gestionar un cluster deDocker.Incluye una API que permite administrar el cluster.Utilidades de línea de comandos.Soporta múltiples plataformas de clustering paraDocker:
CattleKubernetesSwarmApache MesosWindows
![Page 62: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/62.jpg)
EJEMPLO RANCHEREJEMPLO RANCHER
![Page 63: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/63.jpg)
WORKFLOW COMPLETOWORKFLOW COMPLETO
![Page 64: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/64.jpg)
UN EJEMPLO EN GITLABUN EJEMPLO EN GITLABhttps://gitlab.com/chrodriguez/demo-lb
![Page 65: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/65.jpg)
EL PROYECTO EN DESARROLLOEL PROYECTO EN DESARROLLOSegún el readme, corremos:
Notar que pasamos 2 docker-compose.yml
En esta modalidad podemos trabajar sin instalar nadaen nuestra PC, editando el
archivo php de la raíz del proyecto
cd docker docker-compose -p demo-lb-dev \ -f docker-compose.yml -f docker-compose.dev.yml up
![Page 66: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/66.jpg)
ENTREGA CONTINUAENTREGA CONTINUAEl archivo .gitlab-ci.yml
Un nuevo tag equivale a una nueva imagen docker
image: docker:latest services: - docker:dind stages: - build before_script: - export IMAGE_TAG="$CI_BUILD_REF_NAME" - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_RE build-docker-image: stage: build script:
- docker build --pull -f docker/Dockerfile -t "$CI REGISTRY I
![Page 67: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/67.jpg)
LA APLICACIÓN EN RANCHERLA APLICACIÓN EN RANCHERUsaremos rancher-cli con el siguiente docker-
compose.yml
Con�guraremos el load balancer a partir del labelseteado
rancher-cli utiliza variables de ambiente que lo con�guran
version: '2' services: web: image: registry.gitlab.com/chrodriguez/demo-lb:0.0.1 labels: application: demo-lb
$ rancher up
![Page 68: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/68.jpg)
EL POTENCIAL DE RANCHEREL POTENCIAL DE RANCHER
![Page 69: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/69.jpg)
LAS PREGUNTAS…LAS PREGUNTAS…¿Y los logs?¿Y el monitoreo?¿Y las bases de datos?¿Y los backups?
Todas tienen respuesta
![Page 70: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/70.jpg)
LOGSLOGSPueden manipularse con:
syslogFluentdGraylogLogstashKibana
![Page 71: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/71.jpg)
MONITOREOMONITOREOHoy están de moda:
PrometheusIn�ux DBBosunGrafana
![Page 72: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/72.jpg)
LAS BASES DE DATOS Y BACKUPSLAS BASES DE DATOS Y BACKUPSLas bases de datos pueden dockerizarse o noLos backups deben hacerse sólo de los volúmenes
En mi caso, es una excelente alternativaBackupeando la base de datos de rancher,podemos recuperar nuestra infra completa
rsnapshot
![Page 73: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/73.jpg)
¿PREGUNTAS?¿PREGUNTAS?
![Page 74: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/74.jpg)
ALGUNAS PERLITASALGUNAS PERLITASCorrer una aplicación X11:
Compilar sin compilador:
Bases de datos para desarrollo
$ xhost + $ docker run -it --rm -e HOME=$HOME -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:$HOME --user `id -u` jarfil/gimp-git
$ docker run --rm -v "$PWD":/usr/src/myapp \ -w /usr/src/myapp gcc:4.9 gcc -o app *c -Wall
docker run --name=mysql-5.6 -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3307:3306 \ --restart=always -v mysql-5.6:/var/lib/mysql \ mysql:5.6
![Page 75: D E D E S A R R O L L O A P R O D U C C I Ó N U S A N D O ...portal.sistemas.unq.edu.ar/TICAR2018/TICAR2018-De_desarrollo_a... · U N E J E M P L O D E U S O D E D O C KE R El siguiente](https://reader030.fdocumento.com/reader030/viewer/2022040215/5ed3c61185d90c53341ac91a/html5/thumbnails/75.jpg)
¡GRACIAS!¡GRACIAS!