Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!

343 views

Published on

From Chris Ozog for DrupalCamp Kyiv 2017

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!

  1. 1. Migration from Drupal 7 to Drupal 8 Chris Ozog ...how Docker can save our lives!
  2. 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. 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. 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. 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. 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. 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. 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. 9. Docker setup in detail ❖ Dockerfile for D8 ❖ Dockerfile for D7 ❖ Docker-compose.yml ❖ Directory layout ❖ https://github.com/codesushi/kiev-drupal-docker
  10. 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. 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
  12. 12. docker-compose.yml version: '2' services: db8: image: mysql environment: MYSQL_USER: drupal MYSQL_PASSWORD: drupal MYSQL_DATABASE: drupal8 MYSQL_ROOT_PASSWORD: drupal volumes: - ./data8:/var/lib/mysql db7: image: mysql environment: MYSQL_USER: drupal MYSQL_PASSWORD: drupal MYSQL_DATABASE: drupal7 MYSQL_ROOT_PASSWORD: drupal volumes: - ./data7:/var/lib/mysql
  13. 13. docker-compose.yml drupal8: build: dockerfile: Dockerfile-d8 context: . volumes: - ./d7:/var/www/d7 - ./d8:/var/www/d8 - ./apache-conf/d8.conf:/etc/apache2/sites-enabled/000-default.conf - ./docker/php7/local.ini:/usr/local/etc/php/conf.d/local.ini ports: - 8250:80 links: - db8
  14. 14. docker-compose.yml drupal7: build: dockerfile: Dockerfile-d7 context: . volumes: - ./d7:/var/www/d7 - ./apache-conf/d7.conf:/etc/apache2/sites-enabled/000-default.conf - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini ports: - 8251:80 links: - db7
  15. 15. Couple of screens: D8 install
  16. 16. Couple of screens: D7 install
  17. 17. Couple of screens: D8 Calls D7
  18. 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
  19. 19. Thanks! Any questions? Find me at /krzysztofozog & chris@codesushi.co

×