Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker...

27
Docker Containers José-Tomás Salvador Tendero Sales Engineer Manager [email protected] @jt_salvador

Transcript of Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker...

Page 1: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Docker Containers

José-Tomás Salvador Tendero

Sales Engineer Manager

[email protected]

@jt_salvador

Page 2: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

3 | © InterSystems Corporation. All rights reserved. |

Quizá os suene…

Desarrollo

….un día cualquiera de proyecto

Podríamos volver a empezar?

Page 3: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

5 | © InterSystems Corporation. All rights reserved. |

Quizá os suene…

Despliegue

….quién no lo ha comentado en mitad de una instalación ¡He seguido el Manual al pie de la

letra!

Page 4: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

7 | © InterSystems Corporation. All rights reserved. |

Quizá os suene…

Soporte

…ese ingeniero de soporte que oye por enésima vez

¡No he tocado nada!

Page 5: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

9 | © InterSystems Corporation. All rights reserved. |

Quizá os suene…

Soporte

… o cuando somos los usuarios y en Soporte no pueden reproducir el problema…

Page 6: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

11 | © InterSystems Corporation. All rights reserved. |

Quizá os suene…

Upgrade

… y ya con el sistema funcionando un tiempo, llega el momento del upgrade…

En el fondo es lo menos preocupante…

…siempre hay expertos disponibles!

Page 7: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Docker Containers

Page 8: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

13 | © InterSystems Corporation. All rights reserved. |

Docker

Web App

InterSystems

IRIS

Apache

Linux

Image

Page 9: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

14 | © InterSystems Corporation. All rights reserved. |

Comparación con VMs

Page 10: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

15 | © InterSystems Corporation. All rights reserved. |

Conceptos básicos

Imagen: Paquete software Estandarizado, Portable y

Ejecutable

Contenedor: Instancia de una imagen, con

aislamiento y control en el uso de recursos durante su

ejecución dentro del sistema host.

Page 11: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

16 | © InterSystems Corporation. All rights reserved. |

Creación y Ejecución de Imágenes (docker build – docker run)

Imágenes Docker

Múltiples capas de solo-lectura

Construidas manualmente o vía Dockerfile

Construye tu propia imagen

Basada en la imagen creada por InterSystems

Añadir código de la App

Añadir Licencia

Resolver dependencias

Configurar

Pull Push

Docker ClientDocker Engine

holds Images

Docker Hub & Docker Store

Dockerfile

Create Build

Docker Layer

Docker Layer

Docker Layer

ImageRun

Do

cker

Co

nta

iner

s

Page 12: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

17 | © InterSystems Corporation. All rights reserved. |

DockerfileFROM intersystems/iris:stableLABEL maintainer "[email protected]"ENV TMP_INSTALL_DIR = "/tmp/install" ENV InstallScript = "install.scr" ENV InstallFile = "Util/Build.cls"ENV AppDir = "."ENV AppName = "widgetsdirect"ENV PasswordFile = "password.isc"

RUN mkdir $TMP_INSTALL_DIRWORKDIR $TMP_INSTALL_DIRCOPY $AppDir $TMP_INSTALL_DIR/$AppDir

COPY license.key $ISC_PACKAGE_INSTALLDIR/mgr

RUN (chmod -R a+rx $TMP_INSTALL_DIR `$TMP_INSTALL_DIR/install.sh $TMP_INSTALL_DIR $InstallScript $InstallFile $AppDir $AppName $PasswordFile)EXPOSE 57772 1972 22 443 80ENTRYPOINT ["/isc-main"]

El Dockerfile definirá el entorno dentro del

contenedor. El acceso a recursos como los

interfaces de red y discos duros es virtualizado

dentro del entorno, que está aislado del resto de tu

sistema. Por esa razón hemos de mapear puertos al

exterior y explicitar qué ficheros queremos

“copiar en” ese entorno.

La aplicación definida por el Dockerfile se

comportará exactamente igual

independientemente de dónde se ejecute.

Page 13: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

18 | © InterSystems Corporation. All rights reserved. |

¿Cómo funciona?• Un contenedor asigna

• Porcentaje de CPU

• Memoria

• Almacenamiento

• Ancho de Banda

• Características

• El kernel del SO gestiona los contenedores

• Ejecución de Servicios (+ligero) frente a un SO completo

• Mejor utilización de recursos (menos inactividad,…)

• Arranque rápido < 1sec

• Fácil de empaquetar, compartir y enviar

• Fácil despliegue en nube pública o privada

• AWS, GCP, Azure, OpenStack, OpenShift, Cloudera, etc.

Page 14: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

19 | © InterSystems Corporation. All rights reserved. |

Docker & Storage

① Versionado del Contenedor

• Container + myStdApp + “AppEvolution”

$ docker commit

② Shared Container Volume

Or Data-Only Container

$ docker run –v /myDB …

$ docker run --volume-from Container1…

③ Host Volume

$ docker run –v /myAppDB:/db

… -v /:/myLinuxHostRoot

Tres formas de almacenar datos persistentes

OS-MyApp-v1

MyApp-v2

v2

Container 1 Container 2 - Managed by Docker Daemon

- Separate from Container /

- No data layers or snapshots (R&W)

- Volume persists with Containers

Data-Only

Container

VO

LUM

ES

Linux host

/boot /etc /usr

/dev /opt

MyApp

Container

/db

/myAppDB

Page 15: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Casos de Uso

Page 16: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

21 | © InterSystems Corporation. All rights reserved. |

Caso de Uso

Simplificación de la Configuración

• Lo primero por lo que aboga Docker es por la simplificación de la configuración

Gestión del pipeline de desarrollo

• La simplificación de la configuración tiene un gran impacto en la gestión del pipeline de desarrollo

Productividad del desarrollador

Aislamiento de Aplicación

Consolidación del Servidor

Capacidad de Depuración

Multi-tenancy

Page 17: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

22 | © InterSystems Corporation. All rights reserved. |

Continous Integration & Continous Delivery con Contenedores

1

Developer

pushes

commits

Source

Code

Repository

Continuous

Integration

Service

Image or

Artefact

Build

Run

Tests

Push to

Registry

Deploy

to

Production

Developers are notified

2 3 4 5 6 7

Page 18: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Demo 1

Primeros pasos

Page 19: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

24 | © InterSystems Corporation. All rights reserved. |

Demo 1 Primeros Pasos

Page 20: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

InterSystems y Docker

Page 21: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

26 | © InterSystems Corporation. All rights reserved. |

Gestion PID 1 y durabilidad de la configuración

Contenedor desconectable

Gestión de interrupciones

Redirección de logs

Potente parametrización

Antes del arranque

Tras la parada

Licencia

Nombre de instancia

Rutina

Namespace

etc.

On Startup --key

--log

Before IRIS

--before

--instance

--routine

After IRIS --after

On Exit --exit

Dockerfile

FROM intersystems/iris:stableLABEL maintainer "[email protected]"…..….

RUN (chmod -R a+rx $TMP_INSTALL_DIR ……………….)EXPOSE 57772 1972 22 443 80

ENTRYPOINT ["/isc-main"]

isc-main

Page 22: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

27 | © InterSystems Corporation. All rights reserved. |

Durabilidad de la Configuración de Sistema

cache.cpf

cconsole.log

%SYS database

User credentials

Security Settings

etc.

WIJ

JRNs

etc.

Durable %SYS Consola – Docker CLI

userLx $> docker run --detach --name my-app-container \

–env ISC_DATA_DIRECTORY=/IRIS/cconfig \

-v /fast-reliable-FS:/IRIS \

-v /myAppDB:/DB \

-p 5772:57772 \

--hostname myhost my-iris-app:v1

Linux Host

/boot /etc /usr /myAppDB

/dev /opt /fast-reliable-FS/cconfig

/DB /IRIS/cconfig

my-iris-app:v1

%SYS

Gestion PID 1 y durabilidad de la configuración

Page 23: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Demo 2

Preservando la configuración de la instancia de InterSystems IRIS

Page 24: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

29 | © InterSystems Corporation. All rights reserved. |

Demo 2 Preservando la configuración (“durable” %SYS)

Page 25: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Demo 3

Nuestra Aplicación en la nube

Page 26: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

31 | © InterSystems Corporation. All rights reserved. |

Demo 3 Nuestra aplicación en la nube

Page 27: Docker Containers - InterSystems · 2018. 6. 26. · (docker build –docker run) Imágenes Docker Múltiples capas de solo-lectura Construidas manualmente o vía Dockerfile Construye

Gracias.