SlideShare a Scribd company logo
DRUPAL 8 + ELASTICSEARCH +
DOCKER
Roald R. Umandal, Vielsoft Ltd Co.
Drupal Camp Manila 2016
What we need?
• Docker
• Docker ubuntu image
• Docker elasticsearch image
• Apache, MySQL, PHP 5, Drush
• Drupal 8
What is Docker?
Docker
• Docker allows you to package an
application with all of its dependencies into
a standardized unit of software
development
Docker
• Docker container wrap up a piece of
software in a complete filesystem that
contains everything it needs to run: code,
runtime, system tools, system libraries –
anything you can install on a server
Why Docker
• Lightweight
• Portable
• Isolation
• Consistent Environments
What is Elasticsearch?
Elasticsearch
• Elasticsearch is distributed RESTful
search engine built for the cloud.
Elasticsearch
• Elasticsearch is a search server based on
Lucene. It provides distributed,
multitenant-capable full-text search engine
with an HTTP web interface and Schema-
Free JSON documents.
Elasticsearch
• Elasticsearch is developed in Java and is
released as open source under the terms
of the Apache License
Features
• Distributed and Highly Available Search
Engine
– Each index is fully sharded with a
configurable number of shards
– Each shard can have one or more replicas
– Read/Search operations performed on any of
the replica shards.
Features
• Multi Tenant with Multi Types
– Support for more than one index.
– Support for more than one type per index.
– Index level configuration (number of shards,
index storage).
Features
• Various set of APIs
– HTTP RESTful API
– Native Java API
– All APIs perform automatic node operation
rerouting
Features
• Document Oriented
– No need for upfront schema definition.
– Schema can be defined per type for
customization of indexing process.
Features
• Reliable, Asynchronous Write Behind for
long term persistency.
• (Near) Real Time Search.
• Built on top of lucene
– Each shard is fully functional Lucene index
– All the power of Lucene easily exposed
through simple configuration / plugins.
Features
• Per operation consistency
– Singe document level operations are atomic,
consistent, isolated and durable.
• Open Source under the Apache License,
version 2 (“ALv2”)
Let’s get started
Demo
Setup
 Drupal 8
 docker pull roaldumandal/drupal8
 docker run -d -P --name [container name][docker image]
 docker exec -it [container name | container id] [command]
 Start mysql - /etc/init.d/mysql start
 Start apache - /etc/init.d/apache2 start
 Elasticsearch
 docker pull roaldumandal/elasticsearch
 docker run -d -P --name [container name][docker image]
 docker exec -it [container name | container id] [command]
 Start elasticsearch - /etc/init.d/elasticsearch start
Let’s build first our elasticsearch
server
Elasticsearch
• docker pull roaldumandal/elasticsearch
Elasticsearch
• docker run -d -P elasticsearch
roaldumandal/elasticsearch
Elasticsearch
• Login to docker container
– docker exec -it elasticsearch bash
Elasticsearch
• Start elasticsearch -
/etc/init.d/elasticsearch start
• Type in your terminal exit
Now where ready to setup our Drupal 8 web
server!
Drupal 8
• docker pull roaldumandal/drupal8
Drupal 8
• Create docker your docker container
• docker run -d -P --name [container name]
[docker image]
• The -d flag keeps the container running in
background after the docker run command
completes
• The -p flag publishes exposed ports from the
container to your localhost; this lets you access
them from your computer
Drupal 8
• docker exec -it [container name | container id]
[command]
• After running the command it login you as root
Drupal 8
• Start mysql - /etc/init.d/mysql start
• Start apache - /etc/init.d/apache2 start
• Type in on your terminal exit
Drupal 8
• Check newly created container
• docker ps -a (This command will list all available
container)
Drupal 8
• Accessing your docker web app in your
computer
• Getting your docker default ip run this
command
– docker-machine ip default (This will list your
default ip).
• Example:
– http://192.168.99.100:32773
– 32773 is the docker generated port
Drupal 8
• Voila! you already have Drupal 8 running
in your local
Configuring Elasticsearch
• Enable elasticsearch connector
Configuring Elasticsearch
• Add cluster name
• Set server URL (Elasticsearch server)
Configuring Elasticsearch
• Creating elasticsearch index
Configuring Elasticsearch
• You should be able to see now your
cluster and index
Configuring Search API
• Add search server
• Fill up the fields set the elasticsearch
server name
• Set the backend type to Elasticsearch
Configuring Search API
• Add search index
• Fill up the fields
• Set data source to Content:
– None except those selected
– Bundles: Article
• Server
– Elasticsearch Server
• Goto views tab then index the data
Create views search page
• Views module supports elasticsearch
connector module we can build search
page using views and set the views
settings to index elasticsearch
• Create new view
• Name it elasticsearch then save and edit
Create views search page
• Views Elasticsearch page settings
– Format: Unformatted list
– Show: Fields
– Fields:
• Content datasource: Title
• Content datasource: Image
• Content datasource: Body
• Filter criteria:
– Search Fulltext
Elasticsearch Views
Questions?
Thank You
Need more help?
• https://www.docker.com/what-docker
• http://www.lucenetutorial.com/basic-concepts.html
• https://docs.docker.com/engine/reference/commandline/cli/
• https://www.quora.com/What-is-the-difference-between-Docker-and-
Vagrant-When-should-you-use-each-one
• http://stackoverflow.com/questions/16647069/should-i-use-vagrant-
or-docker-for-creating-an-isolated-environment
• https://medium.com/dev-tricks/apache-and-php-on-docker-
44faef716150#.g64yqogkg
• https://docs.docker.com/engine/installation/mac/
• https://www.elastic.co/guide/en/elasticsearch/reference/current/gloss
ary.html
• http://joelabrahamsson.com/elasticsearch-101/
• https://www.quora.com/What-are-the-disadvantages-of-using-
Elasticsearch-as-a-primary-database
Disclaimer
All images used in this presentation are
borrowed from the internet. Therefore, all
rights reserved to the original owner.

More Related Content

Drupal 8 + Elasticsearch + Docker

  • 1. DRUPAL 8 + ELASTICSEARCH + DOCKER Roald R. Umandal, Vielsoft Ltd Co. Drupal Camp Manila 2016
  • 2. What we need? • Docker • Docker ubuntu image • Docker elasticsearch image • Apache, MySQL, PHP 5, Drush • Drupal 8
  • 4. Docker • Docker allows you to package an application with all of its dependencies into a standardized unit of software development
  • 5. Docker • Docker container wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server
  • 6. Why Docker • Lightweight • Portable • Isolation • Consistent Environments
  • 8. Elasticsearch • Elasticsearch is distributed RESTful search engine built for the cloud.
  • 9. Elasticsearch • Elasticsearch is a search server based on Lucene. It provides distributed, multitenant-capable full-text search engine with an HTTP web interface and Schema- Free JSON documents.
  • 10. Elasticsearch • Elasticsearch is developed in Java and is released as open source under the terms of the Apache License
  • 11. Features • Distributed and Highly Available Search Engine – Each index is fully sharded with a configurable number of shards – Each shard can have one or more replicas – Read/Search operations performed on any of the replica shards.
  • 12. Features • Multi Tenant with Multi Types – Support for more than one index. – Support for more than one type per index. – Index level configuration (number of shards, index storage).
  • 13. Features • Various set of APIs – HTTP RESTful API – Native Java API – All APIs perform automatic node operation rerouting
  • 14. Features • Document Oriented – No need for upfront schema definition. – Schema can be defined per type for customization of indexing process.
  • 15. Features • Reliable, Asynchronous Write Behind for long term persistency. • (Near) Real Time Search. • Built on top of lucene – Each shard is fully functional Lucene index – All the power of Lucene easily exposed through simple configuration / plugins.
  • 16. Features • Per operation consistency – Singe document level operations are atomic, consistent, isolated and durable. • Open Source under the Apache License, version 2 (“ALv2”)
  • 18. Demo
  • 19. Setup  Drupal 8  docker pull roaldumandal/drupal8  docker run -d -P --name [container name][docker image]  docker exec -it [container name | container id] [command]  Start mysql - /etc/init.d/mysql start  Start apache - /etc/init.d/apache2 start  Elasticsearch  docker pull roaldumandal/elasticsearch  docker run -d -P --name [container name][docker image]  docker exec -it [container name | container id] [command]  Start elasticsearch - /etc/init.d/elasticsearch start
  • 20. Let’s build first our elasticsearch server
  • 21. Elasticsearch • docker pull roaldumandal/elasticsearch
  • 22. Elasticsearch • docker run -d -P elasticsearch roaldumandal/elasticsearch
  • 23. Elasticsearch • Login to docker container – docker exec -it elasticsearch bash
  • 24. Elasticsearch • Start elasticsearch - /etc/init.d/elasticsearch start • Type in your terminal exit
  • 25. Now where ready to setup our Drupal 8 web server!
  • 26. Drupal 8 • docker pull roaldumandal/drupal8
  • 27. Drupal 8 • Create docker your docker container • docker run -d -P --name [container name] [docker image] • The -d flag keeps the container running in background after the docker run command completes • The -p flag publishes exposed ports from the container to your localhost; this lets you access them from your computer
  • 28. Drupal 8 • docker exec -it [container name | container id] [command] • After running the command it login you as root
  • 29. Drupal 8 • Start mysql - /etc/init.d/mysql start • Start apache - /etc/init.d/apache2 start • Type in on your terminal exit
  • 30. Drupal 8 • Check newly created container • docker ps -a (This command will list all available container)
  • 31. Drupal 8 • Accessing your docker web app in your computer • Getting your docker default ip run this command – docker-machine ip default (This will list your default ip). • Example: – http://192.168.99.100:32773 – 32773 is the docker generated port
  • 32. Drupal 8 • Voila! you already have Drupal 8 running in your local
  • 33. Configuring Elasticsearch • Enable elasticsearch connector
  • 34. Configuring Elasticsearch • Add cluster name • Set server URL (Elasticsearch server)
  • 36. Configuring Elasticsearch • You should be able to see now your cluster and index
  • 37. Configuring Search API • Add search server • Fill up the fields set the elasticsearch server name • Set the backend type to Elasticsearch
  • 38. Configuring Search API • Add search index • Fill up the fields • Set data source to Content: – None except those selected – Bundles: Article • Server – Elasticsearch Server • Goto views tab then index the data
  • 39. Create views search page • Views module supports elasticsearch connector module we can build search page using views and set the views settings to index elasticsearch • Create new view • Name it elasticsearch then save and edit
  • 40. Create views search page • Views Elasticsearch page settings – Format: Unformatted list – Show: Fields – Fields: • Content datasource: Title • Content datasource: Image • Content datasource: Body • Filter criteria: – Search Fulltext
  • 44. Need more help? • https://www.docker.com/what-docker • http://www.lucenetutorial.com/basic-concepts.html • https://docs.docker.com/engine/reference/commandline/cli/ • https://www.quora.com/What-is-the-difference-between-Docker-and- Vagrant-When-should-you-use-each-one • http://stackoverflow.com/questions/16647069/should-i-use-vagrant- or-docker-for-creating-an-isolated-environment • https://medium.com/dev-tricks/apache-and-php-on-docker- 44faef716150#.g64yqogkg • https://docs.docker.com/engine/installation/mac/ • https://www.elastic.co/guide/en/elasticsearch/reference/current/gloss ary.html • http://joelabrahamsson.com/elasticsearch-101/ • https://www.quora.com/What-are-the-disadvantages-of-using- Elasticsearch-as-a-primary-database
  • 45. Disclaimer All images used in this presentation are borrowed from the internet. Therefore, all rights reserved to the original owner.