Top Banner
Modern Continuous Delivery Liferay meets Docker Manuel de la Peña, Software Engineer
54

Modern Continuous Delivery with Docker and Liferay

Jan 15, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Modern Continuous Delivery with Docker and Liferay

Modern Continuous Delivery Liferay meets Docker

Manuel de la Peña, Software Engineer

Page 2: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

PRODUCTION SYSTEMSTHIS TALK IS NOT ABOUT…

http://cdn.wallpapersafari.com/41/27/KhsIdT.jpg

Page 3: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

THIS TALK IS ABOUT…

DEVELOPMENT PROCESSEShttp://www.itechscope.gr/img/banner-image-process.jpg

Page 4: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CONTINUOUS DELIVERY @ LIFERAY

▸Continuous Delivery

▸Challenges

▸Approach to our Development Process

Page 5: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CONTINUOUS DELIVERY

http://www.jsg.utexas.edu/lacp/files/PGC_Pipeline_Data.jpg

Page 6: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CONTINUOUSLY DELIVER VALUE TO CUSTOMERS

Page 7: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CONTINUOUS DELIVERY▸Helps in building the product with the most possible

quality

▸Repeat hard tasks (release, deploy) more times

▸Find bugs the soonest, when it’s still cheap

▸Reduce feedback loop from customers

Page 8: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CONTINUOUSLY DELIVER VALUE TO INTERNAL

CUSTOMERS

Page 9: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

INTERNAL CUSTOMERS▸Engineering teams:

▸Developers, Support engineers, Testers, Consultants, Designers, Product Managers

▸Other nontechnical teams:

▸Sales, Marketing, …

Page 10: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CD FOR OUR TEAM MEANS…▸Very briefly…

▸Automate Build + Dependency Management

▸Automate Testing (Pull Request Tester)

▸Automate internal deployments

Page 11: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

PULL-REQUEST TESTER▸JSP Compile, Semantic Versioning, Portlet

Spec TCK, Plugins compile…

▸JBoss 7, Tomcat 8, Weblogic 12, Wildfly 10…

▸Hypersonic, MySQL 5.6, MariaDB10, Oracle12, PostgreSQL 9.4, Sybase16, DB2 10.5…

Page 12: Modern Continuous Delivery with Docker and Liferay
Page 13: Modern Continuous Delivery with Docker and Liferay

http://www.vwand.com/images/usecases/delivery.jpg

Page 14: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CHALLENGES

http://www.greenbookblog.org/wp-content/uploads/2015/06/challenges.jpg

Page 15: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CHALLENGES▸Old-School IT procedures

▸Divergent environments

▸Bug reproducibility

Page 16: Modern Continuous Delivery with Docker and Liferay

1. OLD-SCHOOL IT PROCEDURES

Page 17: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

OLD-SCHOOL IT PROCEDURES▸New environments request

▸Physic Servers && Virtual Machines

▸Virtualization (Proxmox)

▸Operate the environment

Page 18: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

OLD-SCHOOL IT PROCEDURES▸Manual or semi-automated deployments:

▸Jenkins jobs

▸Customised Shell scripts

▸rsync

▸Specific application configuration

Page 19: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

OLD-SCHOOL IT PROCEDURES▸Documentation

▸Wikis

▸ Intranets

▸Google Docs

▸SysAdmin’s head?

Page 20: Modern Continuous Delivery with Docker and Liferay

2.DIVERGENT ENVIRONMENTS

Page 21: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DIVERGENT ENVIRONMENTS▸Manual configuration produces divergency

▸DEV servers are not a copy of PROD servers

▸O.S., CPUs, RAM, disk, libraries, configuration

▸Same problem with DEV laptops

Page 22: Modern Continuous Delivery with Docker and Liferay

PETS OR CATTLE?

Page 23: Modern Continuous Delivery with Docker and Liferay
Page 24: Modern Continuous Delivery with Docker and Liferay
Page 25: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON https://www.reconnix.com/blog/wp-content/uploads/2015/02/Cow.jpg

Page 26: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

3. BUGS REPRODUCIBILITY

Page 27: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

INCREASED COMPLEXITY

▸Different source code versions

▸Different O.S.

▸Different application servers

▸Different databases

Page 28: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DB2 10.1

MariaDB 10

MySQL 5.6

Oracle 12cR1

PostgreSQL 9.3

SQL Server 2012

Sybase ASE 16

JBoss EAP 6.4 X X X X X X X

Tomcat 8.0 X X X X X X X

Weblogic 12c X X X X X X X

Websphere 8.5 X X X X X X X

Wildfly 10.0 X X X X X X X

Page 29: Modern Continuous Delivery with Docker and Liferay
Page 30: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

💔❤▸Not changing context,

stay in the GIT workspace

▸Using an already-built environment, many times

▸Using automated procedures

▸Changing context: stash or WIP commit

▸Building in a specific commit, many times

▸Using manual procedures (DRY)

DEVELOPERS: LOVE IT OR LIST IT

Page 31: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

THE SYSTEM WE LOVE… ❤▸Modern and easy to use

▸Builds environments in an automated way, with everything (application plus dependencies)

▸Stores those environments for reusability

▸ Increases teams’ autonomy

▸ Increases collaboration with I.T.▸Does it sound as DEVOPS culture?

Page 32: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCONREPRODUCIBILITY

DIVERGENCYENVIRONMENT

BUG

ENVIRONMENT

REPRODUCIBILITY

Page 33: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

JENKINS + DOCKER CONTAINERS

Page 34: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

JENKINS▸Automation server

▸Jobs that trigger builds

▸Builds compound by steps

▸Plugins ecosystem

Page 35: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DOCKER CONTAINERS▸Docker Inc. is a company supporting

containers (Linux and Windows!)

▸Container = lighter virtualisation than VM

Page 36: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DOCKER CONTAINERS▸Standar De-Facto

▸Other container technologies: OpenVZ, LXC, Rocket, etc.

▸Image model based in Layers

▸CLI and REST API

▸BIG ecosystem around

Page 37: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

ROLES▸Docker Registry

▸Docker Engine

▸Docker Builder

▸WOMC! (Works On My Computer)

Page 38: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

ROLE: DOCKER PRIVATE REGISTRY▸Docker Hub: public IT infrastructure hub

▸Private Registry: on-premise

▸VM with massive storage for images

▸docker-compose

▸Containers: Apache + Registry

▸Security: OpenSSL

▸ https://docs.docker.com/registry/recipes/apache

Page 39: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

ROLE: DOCKER ENGINE▸Docker daemon > O.S. package

▸Application infrastructure and runtime dependencies standardised

▸Same runtime environment from Docker Engine to Docker Engine

▸Docker Engine = Docker Host

Page 40: Modern Continuous Delivery with Docker and Liferay
Page 41: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

ROLE: DOCKER ENGINE▸VM per team as team’s lab

▸VM provisioned Ansible role

▸Runs Liferay images from private registry

▸docker run or docker-compose

▸Liferay + Database

▸Containers and images clean-up

Page 42: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

WHY VMS?▸They are truly helpful for us

▸Moving a whole docker host between machines

▸Backup of a whole docker host, including its containers

▸Security: isolated teams (potential shutdowns, resources-draining by other teams)

Page 43: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

ROLE: DOCKER BUILDER▸Jenkins slaves

▸Fetches portal source code from master branch, reading last commit ——> HASH commit

▸Generates a Liferay Docker image every night

▸Uploads those images to the private docker registry

▸Deploys that MASTER to a controlled environment

Page 44: Modern Continuous Delivery with Docker and Liferay

http://www.vwand.com/images/usecases/delivery.jpg

Page 45: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

NAME CONVENTION FOR IMAGES

PRIVATE_REGISTRY/GIT_REPO :

GIT_BRANCH-HASHTIMESTAMP

Page 46: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

NAME CONVENTION FOR IMAGES (2)

LOCALHOST:5000/LIFERAY-PORTAL :

20161115123000MASTER-ABCDEF1234567890

Page 47: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

NAME CONVENTION FOR IMAGES (3)

PRIVATE_REGISTRY/GIT_USER/GIT_REPO :

GIT_BRANCH-HASH

Page 48: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

NAME CONVENTION FOR IMAGES (4)

LOCALHOST:5000/MDELAPENYA/LIFERAY-PORTAL :

FEATURE-1-ABCDEF1234567890

Page 49: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DOCKER ENGINE

CT.1 CT.2 CT.N

docker-engine-team3

DOCKER ENGINE

CT.1 CT.2 CT.N

docker-engine-team1 DOCKER ENGINE

CT.1 CT.2 CT.N

docker-engine-team2

CT.1 CT.2 CT.N

DOCKER ENGINE

PRIVATE REGISTRY

docker-engine-core

Virtual Machine

Container

Physical Machine

docker-builder-i

push

run

run

pull

run

Page 50: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

CT.1 CT.2 CT.N

DOCKER ENGINE

PRIVATE REGISTRY

docker-engine-core

pull & push

DOCKER ENGINE

CT.1 CT.2 CT.N

docker-engine-team-i

run

run

run

DOCKER ENGINE

CT.1 CT.2 CT.N

local-machine-j

run

Virtual Machine

Container

Physical Machine

Page 51: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

DIRECT BENEFITS▸Less dependency on IT

▸More autonomous teams

▸Both Developers and nontechnical Users can build environments more quickly (demos and showcases!!)

▸With training, Developers can reproduce new environments starting from already created ones

Page 52: Modern Continuous Delivery with Docker and Liferay

@mdelapenya #LRDEVCON

SUMMARISING…▸Define your CD pipeline: min(Build + Test + Deploy)

▸Build Docker image within the pipeline

▸Publish images for teams

▸More autonomous teams

▸Increase of development speed

Page 53: Modern Continuous Delivery with Docker and Liferay

THANK YOU! QUESTIONS?

LIKED IT?, PLEASE VOTE!

Page 54: Modern Continuous Delivery with Docker and Liferay

My Docker images

https://hub.docker.com/r/mdelapenya/liferay-portal https://github.com/mdelapenya/docker-liferay-portal