SlideShare a Scribd company logo
1 of 53
Download to read offline
Visuel à insérer ici
WEB SUMMER CAMP 2016
Rovinj
eZ Publish 5: from zero to automated deployment
(and no regressions!) in one afternoon
WHO AM I
The short version
• « the guy who has written a lot of answers
on the eZPublish forums »
• Working at Kaliop in London since 2014
• Principal consultant at eZSystems for 7 years
• Love coffee and bicycles ?
• @gggeek
• Little known fact: today it’s my birthday!
VOTRE SCHEMA
WHAT THIS WORKSHOP IS ABOUT
The short version, too
TALK IS CHEAP
Show me the code
https://github.com/kaliop-uk/websummercamp2016
HOUSE RULES
Marek and Jakub are the Lethal Enforcers Minions Gentle Assistants
• Interrupting is welcome at any time
• fall behind: the assistants are authorized
to stop me for all the time needed for you
to catch up with the rest
• fall asleep: the assistants are authorized to
kill you empty your pockets pinch your ear
WHO ARE YOU?
The short version, please
• Any experience with eZPublish ?
• Any experience with eZPublish Legacy?
• Did anybody attend the Docker workshop
from Marek on Wednesday ?
• Any Docker experience at all ?
• Who has been up all night partying?
VOTRE SCHEMA
SUMMARY
1. INTRO TO DOCKER
2. (MOAR) DOCKER!
3. MANAGING ENVIRONMENTS
4. MANAGING DB CHANGES
5. A DEPLOYMENT SCRIPT
6. TESTING THE SITE
If you have never heard of used
Docker
A. I am living under a rock
B. I am living on the moon
01
What is it, in one phrase
Definition according to Me™
"just like a VM, but lighter"
Virtual Machines vs. Containers
VM on the left
Getting started is easy
Getting off the hook on the other hand…
"just like a VM, but lighter"
all it takes to get started:
docker run -ti ubuntu:15.10 bash
Getting started is easy
what has just happened:
• the Docker daemon connected to a public repository to download an
image (https://hub.docker.com/)
• a container was started using that image
• the bash program was started in the container, and its I/O attached to
the shell in execution
Getting started is easy
• ideal for testing a command / script in a different environment
• makes it very easy to deploy (some types of) applications as self-
contained packages
• not created for multi-process applications, nor for Continuous
Integration scenarios
• but it is getting there quickly
Terminology
• container: a container is a runtime instance of a Docker image
• image: Docker images are the basis of containers (recursion?)
• an image is an ordered collection of root filesystem changes and the
corresponding execution parameters for use within a container runtime
• dockerfile: a Dockerfile is a text document that contains all the
commands you would normally execute manually in order to build a
Docker image
• volume: a data volume is a specially-designated directory within one or
more containers that bypasses the Union File System
• in other words: a volume is a directory on the host which gets mounted into the
container
Sample Dockerfile
Reference at: https://docs.docker.com/engine/reference/builder/
FROM UBUNTU:15.10
RUN apt-get update && apt-get install -y php5 php5-curl php5-gd
ADD src/ /var/www/html/
ADD scripts/start.sh /start.sh
EXPOSE 443 80
CMD ["/start.sh"]
Docker philosophy
Definition according to Me™, again
• one process per container
• containers should be immutable (or close to it)
Useful one-liners
• docker images lists all images present on the host computer
• docker ps lists all running containers
• docker ps -a lists all containers, including stopped ones
• docker rm <cont.> removes a container
• docker rmi <image> removes an image
Where the magic stops
• how to share application data with the container?
• how to access the apps in the container (map container ports to the
host)?
• how to start multiple containers together and connect them?
• how to access the log files from the application?
Then things get tricky
• mapping of user ids to properly handle filesystem permissions
• linking containers when there are circular dependencies (solved with
recent Docker versions)
• applying security updates to existing containers
• and more…
• for some more of the fine details, see f.e. this blog post:
http://blog.kaliop.com/en/blog/2015/05/27/docker-in-real-life-the-tricky-
parts/
Docker Compose to the rescue!
• a single file describes multiple containers
• a single command to start/stop them all together
• permits further automation (via eg. introduction of variables)
Sample docker-compose.yml
Reference docs: https://docs.docker.com/compose/compose-file/
version: '2'
services:
web:
build: images/web
hostname: web
ports:
- "80:80"
volumes:
- ./site/:/var/www/site
env_file:
- docker-compose.env
cli:
build: images/cli
hostname: cli
environment:
- SSH_AUTH_SOCK=/ssh-agent
cap_add:
- SYS_PTRACE
A Docker stack for eZPublish
A. I need a break
B. Bring it on!
02
Why use Docker for eZPublish website development?
Because you get to go to the Summer Camp, duh!
• easier to share with a distributed dev team than a whole VM
just a bunch of scripts, not multi-MB image
easy to fix/improve and redistribute
• easy to convert to the same version of the OS/Apps used in production
• forces separation of applications to separate environments
closer to a production environment (for non-trivial sites)
good to avoid surprises when deploying
Introducing the stack
• apache
• mysql
• memcached
• solr
• php cli
• varnish
• nginx
plus
• control panels for all of the above
• phpmyadmin
• maildev (an smtp server for development purposes)
• dockerui (a container monitoring the whole container stack [Inception!])
In 1000 words
Ascii art rocks!
How it works
All the things someone else has figured out for you
• configuration of the applications is mounted as volume, not copied into
the image
a simple service restart is sufficient to take changes into account
• application source code is kept on the host computer
no risk of losing changes when rebuilding containers
no need to have containers running GUI or IDEs
• all log files accessible from the host, in one place
• use ssh-agent to avoid developers storing their own private keys inside
the containers
How it works, II
All the things someone else has figured out for you
• allow developers to change some variables, while providing good
defaults
a configuration file is provided, which has all the variables that developers
can customize
a 2nd configuration file has to be created with local changes (empty is fine)
ex: id of the user account on the host computer, or github credentials
the config file with local changes is not committed to git
• not tied to a specific project
can be quickly converted for usage of Drupal instead of eZPublish
two of them can be run in parallel
How it works, III
All the things someone else has figured out for you
• the containers have to replicate as much as possible a production
environment
the base images used are Debian or Ubuntu (the platforms we generally
deploy on)
the applications are started using service start and service stop
commands
cronjob tasks definitions are kept as part of the sources of the stack
On Disk layout
• config configuration for services running in containers
• data data persisted by the apps in containers (eg: mysql db)
• images Dockerfiles and files used to build the images
• logs log files from services running in containers
• site the website installation folder
• src source code for tools which are part of the stack
On Disk layout and volume mounts
( incomplete example )
• config/…
• data/…
• images X
• logs/…
• site
• src X
Mysql container
/etc/mysql/conf.d/
/var/lib/mysql/
/var/log/mysql/
Web container
/etc/apache2/sites-available
/etc/php5/apache2/
/var/log/apache/
/var/www/site/
Cli container
/tmp/cron.d
/etc/php5/cli
/var/log/php/
/var/www/site/
Exercise time
At last!
Managing environments
A. Not my job
B. DevOps is the new black
03
Where to store per-environment configuration files
• Symfony: excellent native support
• eZPublish legacy: somewhat, hackish support (eg. in extensions?)
• Webserver config etc… : no standard solution
All-in-the-stack solution
• Store eZPublish legacy settings and app. settings in a specific dir
in the source code
• Use symlinks to deploy them
• But not manually!
• kaliop/ezpublish5universalinstaller
• Advantage: only one git repo to take care of
• Advantage: supports an ‘override’ logic
On-Disk layout
Exercise time
Again!
Managing database changes
A. I connect to the Admin Interface
B. A solved problem
04
Sharing the Database
Many possibilities:
A. All developers connect to the same db
B. The database is committed to git
C. Managing changes via scripts
D. Live DB replication (really ???)
E. More ?
Connecting to a shared database
• good for teams which are *not* geographically distributed
• works when developers do not blow up the database with junk
content: needs some developer discipline
• works only up to the 1st deployment to UAT env;
then 2 dbs have to be managed anyway
Committing the database to git
• good for when the development database does not contain a
huge number of contents and assets
• good for when the development database does not change too
frequently
• developers might be working on different versions
of the db: needs some developer discipline
• works only up to the 1st deployment to UAT env;
then 2 dbs have to be managed anyway
Managing database changes via script
• Safest option
• Good for when the development database does not change too
frequently
• Perfect after deployment to UAT/PROD
• kaliop/ezmigrationbundle
Exercise time
Again!
Automating deployment
A. FTP is all I need!
B. I put a Jenkins in my Jenkins
05
Automating deployments
• do I even have to explain why it is a good idea ?
• use the same deployment script during development as in
production
so that it gets well tested
• good for automated testing too
eZPublish deployment tasks
1. alter webserver config to disallow access
2. get the latest version of the source code
3. composer install
4. apply changes to database
5. clear Opcache cache (just in case)
6. custom scripts?
7. reindex content (optional)
8. clear shared caches
always: inner to outer
Memcached
Varnish
9. alter webserver config to allow access
eZPublish deployment tasks
extras:
1. run security checks (Symfony has a built-in script)
2. notify monitoring systems of deployment (eg: NewRelic)
Exercise time
Again!
You do write tests for CMS-
powered websites, don’t you?
A. HAHAHA!
B. Are you joking?
C.No, really?
06
Conventional wisdom on testing
Is it really the good choice for sites built on CMS ?
Going against the grain
How much non-project-specific code have you used on this project ?
UI
Unit
???
Going against the grain
Functional testing rocks the world?
• Use Behat if you *really* have customers / PMs / Analysts willing to read
the scenarios
• Functional tests can be written in PHPUnit too
• Functional testing is slow
Run it on a CI platform
On every commit is perfect, but before deployment is good enough
Use Selenium-as-a-service if you can afford it (even if you can’t)
Exercise time
Again!
THANK YOU
@gggeek
https://github.com/kaliop-uk
https://github.com/kaliop
http://www.kaliop.co.uk/info/ez.html

More Related Content

What's hot

Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12Derek Jacoby
 
6 reasons you should program in go
6 reasons you should program in go6 reasons you should program in go
6 reasons you should program in goMichael Banzon
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1Derek Jacoby
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?Weng Wei
 
Engage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesJesse Gallagher
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseScott Taylor
 
WordPress: Getting Under the Hood
WordPress: Getting Under the HoodWordPress: Getting Under the Hood
WordPress: Getting Under the HoodScott Taylor
 
Python to go
Python to goPython to go
Python to goWeng Wei
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterouscapotej
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor StoryMarko Heijnen
 
Jenkins &amp; scriptable build
Jenkins &amp; scriptable buildJenkins &amp; scriptable build
Jenkins &amp; scriptable buildBryan Liu
 
The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012Jan Jongboom
 
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
Devops and Immutable infrastructure  - Cloud Expo 2015 NYCDevops and Immutable infrastructure  - Cloud Expo 2015 NYC
Devops and Immutable infrastructure - Cloud Expo 2015 NYCJohn Willis
 
Porque Odeio Branches
Porque Odeio BranchesPorque Odeio Branches
Porque Odeio BranchesRafael Petry
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development EnvironmentsJosh Cummings
 
CI on large open source software : Plone & Plone 5 is here!
CI on large open source software : Plone & Plone 5 is here!CI on large open source software : Plone & Plone 5 is here!
CI on large open source software : Plone & Plone 5 is here!Ramon Navarro
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPressMarko Heijnen
 
Erlang - Dive Right In
Erlang - Dive Right InErlang - Dive Right In
Erlang - Dive Right Invorn
 

What's hot (19)

Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12
 
6 reasons you should program in go
6 reasons you should program in go6 reasons you should program in go
6 reasons you should program in go
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Engage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPages
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the Enterprise
 
WordPress: Getting Under the Hood
WordPress: Getting Under the HoodWordPress: Getting Under the Hood
WordPress: Getting Under the Hood
 
Python to go
Python to goPython to go
Python to go
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor Story
 
Jenkins &amp; scriptable build
Jenkins &amp; scriptable buildJenkins &amp; scriptable build
Jenkins &amp; scriptable build
 
The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012The Architect Way - JSCamp.asia 2012
The Architect Way - JSCamp.asia 2012
 
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
Devops and Immutable infrastructure  - Cloud Expo 2015 NYCDevops and Immutable infrastructure  - Cloud Expo 2015 NYC
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
 
Porque Odeio Branches
Porque Odeio BranchesPorque Odeio Branches
Porque Odeio Branches
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development Environments
 
CI on large open source software : Plone & Plone 5 is here!
CI on large open source software : Plone & Plone 5 is here!CI on large open source software : Plone & Plone 5 is here!
CI on large open source software : Plone & Plone 5 is here!
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
Erlang - Dive Right In
Erlang - Dive Right InErlang - Dive Right In
Erlang - Dive Right In
 

Similar to eZ Publish 5: from zero to automated deployment (and no regressions!) in one afternoon

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAlan Forbes
 
An introduction to configuring Domino for Docker
An introduction to configuring Domino for DockerAn introduction to configuring Domino for Docker
An introduction to configuring Domino for DockerGabriella Davis
 
Dockerize the World
Dockerize the WorldDockerize the World
Dockerize the Worlddamovsky
 
Dockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec KraloveDockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec Kralovedamovsky
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with DockerRavindu Fernando
 
Cassandra and Docker Lessons Learned
Cassandra and Docker Lessons LearnedCassandra and Docker Lessons Learned
Cassandra and Docker Lessons LearnedDataStax Academy
 
An Introduction To Docker
An Introduction To  DockerAn Introduction To  Docker
An Introduction To DockerGabriella Davis
 
Introduction to Containers - SQL Server and Docker
Introduction to Containers - SQL Server and DockerIntroduction to Containers - SQL Server and Docker
Introduction to Containers - SQL Server and DockerChris Taylor
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013dotCloud
 
Docker for everything
Docker for everythingDocker for everything
Docker for everythingTim Haak
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesabhishek chawla
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Dockerjonatanblue
 
Introduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainIntroduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainAjeet Singh Raina
 

Similar to eZ Publish 5: from zero to automated deployment (and no regressions!) in one afternoon (20)

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
An introduction to configuring Domino for Docker
An introduction to configuring Domino for DockerAn introduction to configuring Domino for Docker
An introduction to configuring Domino for Docker
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
Dockerize the World
Dockerize the WorldDockerize the World
Dockerize the World
 
Dockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec KraloveDockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec Kralove
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Cassandra and Docker Lessons Learned
Cassandra and Docker Lessons LearnedCassandra and Docker Lessons Learned
Cassandra and Docker Lessons Learned
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
An Introduction To Docker
An Introduction To  DockerAn Introduction To  Docker
An Introduction To Docker
 
Dockerize All The Things
Dockerize All The ThingsDockerize All The Things
Dockerize All The Things
 
Introduction to Containers - SQL Server and Docker
Introduction to Containers - SQL Server and DockerIntroduction to Containers - SQL Server and Docker
Introduction to Containers - SQL Server and Docker
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Docker for everything
Docker for everythingDocker for everything
Docker for everything
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Docker
 
Introduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainIntroduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker Captain
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 

More from Gaetano Giunta

php day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsphp day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsGaetano Giunta
 
phpday 2006 - SEA case study
phpday 2006 - SEA case studyphpday 2006 - SEA case study
phpday 2006 - SEA case studyGaetano Giunta
 
phpday 2006 - WS in PHP
phpday 2006 - WS in PHPphpday 2006 - WS in PHP
phpday 2006 - WS in PHPGaetano Giunta
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message BrokersGaetano Giunta
 
Rabbits, indians and... Symfony meets queueing brokers
Rabbits, indians and...  Symfony meets queueing brokersRabbits, indians and...  Symfony meets queueing brokers
Rabbits, indians and... Symfony meets queueing brokersGaetano Giunta
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studyGaetano Giunta
 
Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)Gaetano Giunta
 
EzPerformancelogger & Graphite
EzPerformancelogger & GraphiteEzPerformancelogger & Graphite
EzPerformancelogger & GraphiteGaetano Giunta
 
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Gaetano Giunta
 
eZPublish meets Simfony2 - phpDay2013
eZPublish meets Simfony2  - phpDay2013eZPublish meets Simfony2  - phpDay2013
eZPublish meets Simfony2 - phpDay2013Gaetano Giunta
 
Ez performance measurement
Ez performance measurementEz performance measurement
Ez performance measurementGaetano Giunta
 
Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of usGaetano Giunta
 
An eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestAn eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestGaetano Giunta
 

More from Gaetano Giunta (13)

php day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsphp day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez components
 
phpday 2006 - SEA case study
phpday 2006 - SEA case studyphpday 2006 - SEA case study
phpday 2006 - SEA case study
 
phpday 2006 - WS in PHP
phpday 2006 - WS in PHPphpday 2006 - WS in PHP
phpday 2006 - WS in PHP
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message Brokers
 
Rabbits, indians and... Symfony meets queueing brokers
Rabbits, indians and...  Symfony meets queueing brokersRabbits, indians and...  Symfony meets queueing brokers
Rabbits, indians and... Symfony meets queueing brokers
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case study
 
Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)
 
EzPerformancelogger & Graphite
EzPerformancelogger & GraphiteEzPerformancelogger & Graphite
EzPerformancelogger & Graphite
 
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
 
eZPublish meets Simfony2 - phpDay2013
eZPublish meets Simfony2  - phpDay2013eZPublish meets Simfony2  - phpDay2013
eZPublish meets Simfony2 - phpDay2013
 
Ez performance measurement
Ez performance measurementEz performance measurement
Ez performance measurement
 
Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of us
 
An eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestAn eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchest
 

Recently uploaded

一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样Fi
 
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsrahman018755
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformonhackersuli
 
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...mikehavy0
 
一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理F
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样AS
 
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样Fi
 
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...Neha Malhotra$I11
 
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证hfkmxufye
 
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样AS
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfe-Market Hub
 
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...ZurliaSoop
 
一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理AS
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理F
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书F
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理SS
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowIdeoholics
 
Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirtrahman018755
 

Recently uploaded (20)

一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
 
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
 
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...
Abortion Clinic in Germiston +27791653574 WhatsApp Abortion Clinic Services i...
 
一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
 
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
一比一原版(UWE毕业证书)西英格兰大学毕业证原件一模一样
 
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...
(VIP) ℂall Girls Lucknow < Hire Me Sneha 📞8630512678 > Home Delivery For Full...
 
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCLA毕业证)加州大学洛杉矶分校毕业证成绩单本科硕士学位证留信学历认证
 
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样
原版定制(LBS毕业证书)英国伦敦商学院毕业证原件一模一样
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdf
 
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
Jual obat aborsi Bekasi ( 085657271886 ) Cytote pil telat bulan penggugur kan...
 
一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理一比一原版英国格林多大学毕业证如何办理
一比一原版英国格林多大学毕业证如何办理
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理一比一原版帝国理工学院毕业证如何办理
一比一原版帝国理工学院毕业证如何办理
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
 
Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirt
 

eZ Publish 5: from zero to automated deployment (and no regressions!) in one afternoon

  • 1. Visuel à insérer ici WEB SUMMER CAMP 2016 Rovinj eZ Publish 5: from zero to automated deployment (and no regressions!) in one afternoon
  • 2. WHO AM I The short version • « the guy who has written a lot of answers on the eZPublish forums » • Working at Kaliop in London since 2014 • Principal consultant at eZSystems for 7 years • Love coffee and bicycles ? • @gggeek • Little known fact: today it’s my birthday! VOTRE SCHEMA
  • 3. WHAT THIS WORKSHOP IS ABOUT The short version, too
  • 4. TALK IS CHEAP Show me the code https://github.com/kaliop-uk/websummercamp2016
  • 5. HOUSE RULES Marek and Jakub are the Lethal Enforcers Minions Gentle Assistants • Interrupting is welcome at any time • fall behind: the assistants are authorized to stop me for all the time needed for you to catch up with the rest • fall asleep: the assistants are authorized to kill you empty your pockets pinch your ear
  • 6. WHO ARE YOU? The short version, please • Any experience with eZPublish ? • Any experience with eZPublish Legacy? • Did anybody attend the Docker workshop from Marek on Wednesday ? • Any Docker experience at all ? • Who has been up all night partying? VOTRE SCHEMA
  • 7. SUMMARY 1. INTRO TO DOCKER 2. (MOAR) DOCKER! 3. MANAGING ENVIRONMENTS 4. MANAGING DB CHANGES 5. A DEPLOYMENT SCRIPT 6. TESTING THE SITE
  • 8. If you have never heard of used Docker A. I am living under a rock B. I am living on the moon 01
  • 9. What is it, in one phrase Definition according to Me™ "just like a VM, but lighter"
  • 10. Virtual Machines vs. Containers VM on the left
  • 11. Getting started is easy Getting off the hook on the other hand… "just like a VM, but lighter" all it takes to get started: docker run -ti ubuntu:15.10 bash
  • 12. Getting started is easy what has just happened: • the Docker daemon connected to a public repository to download an image (https://hub.docker.com/) • a container was started using that image • the bash program was started in the container, and its I/O attached to the shell in execution
  • 13. Getting started is easy • ideal for testing a command / script in a different environment • makes it very easy to deploy (some types of) applications as self- contained packages • not created for multi-process applications, nor for Continuous Integration scenarios • but it is getting there quickly
  • 14. Terminology • container: a container is a runtime instance of a Docker image • image: Docker images are the basis of containers (recursion?) • an image is an ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime • dockerfile: a Dockerfile is a text document that contains all the commands you would normally execute manually in order to build a Docker image • volume: a data volume is a specially-designated directory within one or more containers that bypasses the Union File System • in other words: a volume is a directory on the host which gets mounted into the container
  • 15. Sample Dockerfile Reference at: https://docs.docker.com/engine/reference/builder/ FROM UBUNTU:15.10 RUN apt-get update && apt-get install -y php5 php5-curl php5-gd ADD src/ /var/www/html/ ADD scripts/start.sh /start.sh EXPOSE 443 80 CMD ["/start.sh"]
  • 16. Docker philosophy Definition according to Me™, again • one process per container • containers should be immutable (or close to it)
  • 17. Useful one-liners • docker images lists all images present on the host computer • docker ps lists all running containers • docker ps -a lists all containers, including stopped ones • docker rm <cont.> removes a container • docker rmi <image> removes an image
  • 18. Where the magic stops • how to share application data with the container? • how to access the apps in the container (map container ports to the host)? • how to start multiple containers together and connect them? • how to access the log files from the application?
  • 19. Then things get tricky • mapping of user ids to properly handle filesystem permissions • linking containers when there are circular dependencies (solved with recent Docker versions) • applying security updates to existing containers • and more… • for some more of the fine details, see f.e. this blog post: http://blog.kaliop.com/en/blog/2015/05/27/docker-in-real-life-the-tricky- parts/
  • 20. Docker Compose to the rescue! • a single file describes multiple containers • a single command to start/stop them all together • permits further automation (via eg. introduction of variables)
  • 21. Sample docker-compose.yml Reference docs: https://docs.docker.com/compose/compose-file/ version: '2' services: web: build: images/web hostname: web ports: - "80:80" volumes: - ./site/:/var/www/site env_file: - docker-compose.env cli: build: images/cli hostname: cli environment: - SSH_AUTH_SOCK=/ssh-agent cap_add: - SYS_PTRACE
  • 22. A Docker stack for eZPublish A. I need a break B. Bring it on! 02
  • 23. Why use Docker for eZPublish website development? Because you get to go to the Summer Camp, duh! • easier to share with a distributed dev team than a whole VM just a bunch of scripts, not multi-MB image easy to fix/improve and redistribute • easy to convert to the same version of the OS/Apps used in production • forces separation of applications to separate environments closer to a production environment (for non-trivial sites) good to avoid surprises when deploying
  • 24. Introducing the stack • apache • mysql • memcached • solr • php cli • varnish • nginx plus • control panels for all of the above • phpmyadmin • maildev (an smtp server for development purposes) • dockerui (a container monitoring the whole container stack [Inception!])
  • 25. In 1000 words Ascii art rocks!
  • 26. How it works All the things someone else has figured out for you • configuration of the applications is mounted as volume, not copied into the image a simple service restart is sufficient to take changes into account • application source code is kept on the host computer no risk of losing changes when rebuilding containers no need to have containers running GUI or IDEs • all log files accessible from the host, in one place • use ssh-agent to avoid developers storing their own private keys inside the containers
  • 27. How it works, II All the things someone else has figured out for you • allow developers to change some variables, while providing good defaults a configuration file is provided, which has all the variables that developers can customize a 2nd configuration file has to be created with local changes (empty is fine) ex: id of the user account on the host computer, or github credentials the config file with local changes is not committed to git • not tied to a specific project can be quickly converted for usage of Drupal instead of eZPublish two of them can be run in parallel
  • 28. How it works, III All the things someone else has figured out for you • the containers have to replicate as much as possible a production environment the base images used are Debian or Ubuntu (the platforms we generally deploy on) the applications are started using service start and service stop commands cronjob tasks definitions are kept as part of the sources of the stack
  • 29. On Disk layout • config configuration for services running in containers • data data persisted by the apps in containers (eg: mysql db) • images Dockerfiles and files used to build the images • logs log files from services running in containers • site the website installation folder • src source code for tools which are part of the stack
  • 30. On Disk layout and volume mounts ( incomplete example ) • config/… • data/… • images X • logs/… • site • src X Mysql container /etc/mysql/conf.d/ /var/lib/mysql/ /var/log/mysql/ Web container /etc/apache2/sites-available /etc/php5/apache2/ /var/log/apache/ /var/www/site/ Cli container /tmp/cron.d /etc/php5/cli /var/log/php/ /var/www/site/
  • 32. Managing environments A. Not my job B. DevOps is the new black 03
  • 33. Where to store per-environment configuration files • Symfony: excellent native support • eZPublish legacy: somewhat, hackish support (eg. in extensions?) • Webserver config etc… : no standard solution
  • 34. All-in-the-stack solution • Store eZPublish legacy settings and app. settings in a specific dir in the source code • Use symlinks to deploy them • But not manually! • kaliop/ezpublish5universalinstaller • Advantage: only one git repo to take care of • Advantage: supports an ‘override’ logic
  • 37. Managing database changes A. I connect to the Admin Interface B. A solved problem 04
  • 38. Sharing the Database Many possibilities: A. All developers connect to the same db B. The database is committed to git C. Managing changes via scripts D. Live DB replication (really ???) E. More ?
  • 39. Connecting to a shared database • good for teams which are *not* geographically distributed • works when developers do not blow up the database with junk content: needs some developer discipline • works only up to the 1st deployment to UAT env; then 2 dbs have to be managed anyway
  • 40. Committing the database to git • good for when the development database does not contain a huge number of contents and assets • good for when the development database does not change too frequently • developers might be working on different versions of the db: needs some developer discipline • works only up to the 1st deployment to UAT env; then 2 dbs have to be managed anyway
  • 41. Managing database changes via script • Safest option • Good for when the development database does not change too frequently • Perfect after deployment to UAT/PROD • kaliop/ezmigrationbundle
  • 43. Automating deployment A. FTP is all I need! B. I put a Jenkins in my Jenkins 05
  • 44. Automating deployments • do I even have to explain why it is a good idea ? • use the same deployment script during development as in production so that it gets well tested • good for automated testing too
  • 45. eZPublish deployment tasks 1. alter webserver config to disallow access 2. get the latest version of the source code 3. composer install 4. apply changes to database 5. clear Opcache cache (just in case) 6. custom scripts? 7. reindex content (optional) 8. clear shared caches always: inner to outer Memcached Varnish 9. alter webserver config to allow access
  • 46. eZPublish deployment tasks extras: 1. run security checks (Symfony has a built-in script) 2. notify monitoring systems of deployment (eg: NewRelic)
  • 48. You do write tests for CMS- powered websites, don’t you? A. HAHAHA! B. Are you joking? C.No, really? 06
  • 49. Conventional wisdom on testing Is it really the good choice for sites built on CMS ?
  • 50. Going against the grain How much non-project-specific code have you used on this project ? UI Unit ???
  • 51. Going against the grain Functional testing rocks the world? • Use Behat if you *really* have customers / PMs / Analysts willing to read the scenarios • Functional tests can be written in PHPUnit too • Functional testing is slow Run it on a CI platform On every commit is perfect, but before deployment is good enough Use Selenium-as-a-service if you can afford it (even if you can’t)