The document discusses using Docker and Docker Compose to set up a development environment for migrating a Drupal 7 site to Drupal 8. It describes creating Dockerfiles for Drupal 7 and 8, a docker-compose file to define linked PHP and MySQL containers, and configuring volumes to allow the Drupal 8 container access to files from Drupal 7. This allowed running Drupal 7 and 8 side-by-side for migration testing and the ability to crawl the Drupal 7 site from Drupal 8.
2. Hello!
I am Chris Ozog
I am here because some people think that I love PHP and Drupal?!
You can find me at /krzysztofozog
3. Few words about me...
A Philosopher and A Developer… the worst thing is that I
have two master degree diplomas
More the developer than the philosopher:
❖ For more than decade I’m building Web Applications
❖ In 2004 I built my first App in PHP
❖ I’m addicted to clean code
❖ I’m Chief Technology Officer at Codesushi
❖ I love code review...
4. Agenda
❖ Short intro to docker and docker-compose
❖ Our migration process in general
❖ What we used docker for
❖ Our setup in details
❖ Summary
5. about:docker
❖ Container management software
❖ Container “is a lightweight, stand-alone, executable
package of a piece of software that includes everything
needed to run it”
❖ Benefits of Docker
➢ Easy to use
➢ Quite easy to learn * (if you get the concept, it’s not a VM)
➢ Prebuilt containers with services like MySQL, PHP, Apache etc.
6. about:docker-compose
❖ Started as Fig, then development had been taken over by
docker team
❖ Tool that helps with orchestrating multi-container
environments
❖ Makes using docker super easy
❖ Makes a great tool for sharing development environment
❖ It uses YAML file as configuration
7. Our migration process
We needed to migrate content from D7 to D8, we tried different
migration processes and end up with need of writing one.
❖ Need of having D7 and D8 instances side by side
❖ D8 instance needed to have file access to files directory of D7
❖ D8 also needed to crawl D7 instance - so it needed to be alive
❖ We also needed to run it couple times daily, because of
development process
8. What we used docker for
❖ Development and testing environment - that resembles
actual setup
❖ 2 separate Drupal PHP (with apache, php, composer and
drush) containers for PHP 5.6 and PHP 7
❖ 2 separate MySQL containers
❖ Volumes configured so D8 can access D7 file uploads
9. Docker setup in detail
❖ Dockerfile for D8
❖ Dockerfile for D7
❖ Docker-compose.yml
❖ Directory layout
❖ https://github.com/codesushi/kiev-drupal-docker
10. Drupal 7 Dockerfile
FROM php:5.6-apache
RUN a2enmod rewrite
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev
&& rm -rf /var/lib/apt/lists/*
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr
&& docker-php-ext-install gd mbstring pdo pdo_mysql zip opcache
WORKDIR /var/www/
RUN php -r "readfile('http://files.drush.org/drush.phar');" > drush
RUN chmod +x drush
RUN mv drush /usr/local/bin
11. Drupal 8 Dockerfile
FROM php:7-apache
RUN a2enmod rewrite
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev
&& rm -rf /var/lib/apt/lists/*
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr
&& docker-php-ext-install gd mbstring pdo pdo_mysql zip opcache
WORKDIR /var/www/
#Install drush and composer
RUN php -r "readfile('http://files.drush.org/drush.phar');" > drush
RUN chmod +x drush
RUN mv drush /usr/local/bin
COPY composer-install.sh /usr/local/bin
RUN chmod +x /usr/local/bin/composer-install.sh
RUN composer-install.sh
RUN apt-get update -y && apt-get install -y mysql-client
18. Summary
❖ Docker is fun - especially with docker-compose
❖ Two php versions is no problem
❖ Create complex setup with docker-compose with
ease
❖ Testing load balancer approach
❖ Drupal and docker get along well