Just Code or How I learned to write code and stop worrying about the environment

58
Just Code How I learned to write code and stop worrying about the environment

description

Cómo crear un entorno de desarrollo que pueda ser llevado a producción

Transcript of Just Code or How I learned to write code and stop worrying about the environment

Page 1: Just Code or How I learned to write code and stop worrying about the environment

Just CodeHow I learned to write code and stop worrying

about the environment

Page 2: Just Code or How I learned to write code and stop worrying about the environment

¡Hola !

Enrique SánchezTester & Automation EngineerPhD Student

Page 3: Just Code or How I learned to write code and stop worrying about the environment

• Technical Team Leader y Responsable Técnico del Área de Testing en

!!!• Más de 3 años de experiencia en testing en empresas como !!

!• Evangelista BDD y Agile

¿Quién soy?

Page 4: Just Code or How I learned to write code and stop worrying about the environment

¿Por qué esta charla?

Page 5: Just Code or How I learned to write code and stop worrying about the environment

¿Cuántas veces hemos intentado probar un “juguete” nuevo y hemos dejado el ordenador lleno de basura?

¿Cuántas veces tenemos que luchar contra configs porque tenemos una versión de SO “especial”?

Page 6: Just Code or How I learned to write code and stop worrying about the environment

¿Por qué si intentamos subir a producción/integrado/el ordenador de al lado un código que en nuestro local funciona pero que mágicamente deja de funcionar?

Page 7: Just Code or How I learned to write code and stop worrying about the environment

¿¿¡¡Por qué no puedo sólo programar!!??

Page 8: Just Code or How I learned to write code and stop worrying about the environment

Pongamos un Caso PrácticoEl extraordinario caso de Joan y Enric

Page 9: Just Code or How I learned to write code and stop worrying about the environment

Joan y Enric son dos colegas que tienen una idea…

Page 10: Just Code or How I learned to write code and stop worrying about the environment

Crear un programa con las tecnologías más

hipsters del momento y vendérselo a

Page 11: Just Code or How I learned to write code and stop worrying about the environment
Page 12: Just Code or How I learned to write code and stop worrying about the environment

Enseguida empiezan a pensar y les salen unas cuantas tecnologías que pueden usar:

Page 13: Just Code or How I learned to write code and stop worrying about the environment

Tras arduas discusiones deciden que usarán un SO concreto para desarrollar

!

!

Y llevarán su aplicación a Amazon Web Services

Page 14: Just Code or How I learned to write code and stop worrying about the environment

¿Problemas?

Page 15: Just Code or How I learned to write code and stop worrying about the environment

Hacer pruebas ahí es muy caro

Tienen que estar conectados por ssh constantemente

Es un engorro tener que pusiera constantemente a un repo para hacer pruebas en remoto. ¿Qué pasa si se rompe algo?

Page 16: Just Code or How I learned to write code and stop worrying about the environment

Virtualización

Page 17: Just Code or How I learned to write code and stop worrying about the environment

Enric investiga por Internet y descubre algo llamado

Page 18: Just Code or How I learned to write code and stop worrying about the environment

¿Qué es Vagrant?

Page 19: Just Code or How I learned to write code and stop worrying about the environment

Vagrant es un gestor de máquinas virtuales

Permite provisionar las máquinas mediante un archivo de configuración llamado Vagrantfile

Page 20: Just Code or How I learned to write code and stop worrying about the environment

Puede ser provisionado usando: Bash,Puppet,Chef,Docker…

Page 21: Just Code or How I learned to write code and stop worrying about the environment

Permite tener versionado la forma en la que se provisiona una máquina (virtual o física)

Pueden hacer pruebas en local sin miedo a romper nada

Page 22: Just Code or How I learned to write code and stop worrying about the environment

Además descubre una cosa llamada

Page 23: Just Code or How I learned to write code and stop worrying about the environment

¿Qué es Packer?

Page 24: Just Code or How I learned to write code and stop worrying about the environment

Packer is a tool for creating identical machine images for multiple platforms from a single source

configuration.

Page 25: Just Code or How I learned to write code and stop worrying about the environment

Packer permite crear una máquina virtual precompilada

Puedes tener la misma versión para producción (Amazon) y para local (Vagrant)

Page 26: Just Code or How I learned to write code and stop worrying about the environment

Packer +Vagrant + Puppet

Demo I

Page 27: Just Code or How I learned to write code and stop worrying about the environment
Page 28: Just Code or How I learned to write code and stop worrying about the environment

Joan y Enric están muy felices y contentos, tienen un entorno para jugar y hacer experimentos

Joan se encargará del Front y Enric del Back

Page 29: Just Code or How I learned to write code and stop worrying about the environment

Joan decide usar                  y

!

Enric piensa que NodeJS es muy bonito pero que prefiere y que mejor usa

Page 30: Just Code or How I learned to write code and stop worrying about the environment

Joan y Enric se paran a pensar y dibujan un esbozo de cómo sería la arquitectura

Page 31: Just Code or How I learned to write code and stop worrying about the environment

Fron

t End

Back

End

Hype

Queu

eDB

Page 32: Just Code or How I learned to write code and stop worrying about the environment

JHipster

http://jhipster.github.io/

Page 33: Just Code or How I learned to write code and stop worrying about the environment

¿Cómo metemos esto en una VM?

Page 34: Just Code or How I learned to write code and stop worrying about the environment

¿Puppet, Chef, Bash? Están bien para pequeñas cosas pero levantar un servicio es un “poco” más complejo de lo que parece

Además, ¿qué pasa si queremos que las BBDD estén en otra máquina?

Page 35: Just Code or How I learned to write code and stop worrying about the environment
Page 36: Just Code or How I learned to write code and stop worrying about the environment

Docker is an open platform for developers and sysadmins to build, ship, and run distributed

applications.

Page 37: Just Code or How I learned to write code and stop worrying about the environment

Extiende LXC (contenedores que corren en paralelo sobre la misma máquina anfitriona)

No emula una máquina virtual completa ni corre un sistema operativo íntegro dentro de ella, a costa de quedar “atado” al sistema operativo anfitrión, que se expone a las aplicaciones

Page 38: Just Code or How I learned to write code and stop worrying about the environment
Page 39: Just Code or How I learned to write code and stop worrying about the environment

¿Cómo gestionan el software?

Page 40: Just Code or How I learned to write code and stop worrying about the environment
Page 41: Just Code or How I learned to write code and stop worrying about the environment

flow

Page 42: Just Code or How I learned to write code and stop worrying about the environment

Vagrant + Puppet + Docker + stack

Demo II

Page 43: Just Code or How I learned to write code and stop worrying about the environment
Page 44: Just Code or How I learned to write code and stop worrying about the environment

Pero el código aumenta y hackear en paralelo a ver qué se consigue deja de ser una opción si quieren conseguir algo más estable.

Page 45: Just Code or How I learned to write code and stop worrying about the environment

Pero el código aumenta y hackear en paralelo a ver qué se consigue deja de ser una opción si quieren conseguir algo más estable.

Integración

Continua

Page 46: Just Code or How I learned to write code and stop worrying about the environment

¿Qué es IC?

Page 47: Just Code or How I learned to write code and stop worrying about the environment

Continuous Integration is a software development practice where members of a

team integrate their work frequently (…)

Each integration is verified by an automated build (including test) to detect integration errors

as quickly as possible

Page 48: Just Code or How I learned to write code and stop worrying about the environment
Page 49: Just Code or How I learned to write code and stop worrying about the environment

Un job para Máster …

otro que pruebe Release …

otro para Develop/Rama …

Page 50: Just Code or How I learned to write code and stop worrying about the environment

otro para desplegar el código en los entornos

Page 51: Just Code or How I learned to write code and stop worrying about the environment

Una vez que el software funciona hay que desplegarlo en Amazon…

Page 52: Just Code or How I learned to write code and stop worrying about the environment

Una vez que el software funciona hay que desplegarlo en Amazon…

Artefactos, versiones del front…

Page 53: Just Code or How I learned to write code and stop worrying about the environment
Page 54: Just Code or How I learned to write code and stop worrying about the environment
Page 55: Just Code or How I learned to write code and stop worrying about the environment

Rock’n’roll

Demo III

Page 56: Just Code or How I learned to write code and stop worrying about the environment
Page 57: Just Code or How I learned to write code and stop worrying about the environment

Preguntas?Gracias!

Page 58: Just Code or How I learned to write code and stop worrying about the environment

Enrique Sánchez | [email protected] | @EnriqueSanchezB