Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2024 DrupalJam Utrecht - Drupal and DDEV workshop

2024 DrupalJam Utrecht - Drupal and DDEV workshop

There are quite a few options for the local development, from installing the server and the database locally to some of the virtualised solutions, mostly based on Docker. Three of them stands out, Docksal, Lando and DDEV. My research showed that although all are quite similar in the approach, DDEV has very agile pace of development, covers many use cases, offers a lot of integrations and had the flexibility to be customised and automated for your most efficient workflow. You'll see what else DDEV can do for you beside just spinning local website.

Mladen Đurić

June 12, 2024
Tweet

More Decks by Mladen Đurić

Other Decks in Programming

Transcript

  1. @MacMladen Drupal and DDEV advanced workshop v.1 2024-06-12 DRUPAL AND

    DDEV ADVANCED WORKSHOP Mladen Đurić @MacMladen 1
  2. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 $

    whoami 2 A very boring, incompetent guy MLADEN ĐURIĆ a.k.a MacMladen
  3. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 I’ve

    been in IT since the age of mainframes, 8th year of UNIX epoch. 3
  4. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 6

    As soon as I started learning to code I was so fascinated and wanted to share what I learned. I was hardly into high school when I organised fi rst computer club and gave fi rst BASIC course. It was around 1982. In 2016 I started a Professional Web Development School ]{oder.
  5. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 DDEV

    7 Why would I need it when I have the Docker?
  6. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 The

    tool to manage the container stack DDEV is an open source tool for launching local web development environments in minutes. It supports PHP, Node.js, and Python (experimental). These environments can be extended, version controlled, and shared, so you can take advantage of a Docker work fl ow without Docker experience or bespoke con fi guration. Projects can be changed, powered down, or removed as easily as they’re started. 8
  7. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 INTRODUCE

    YOURSELF! Do you do the local development? Do you use some tool? (Lando, Docksal, pure Docker, non…) Mac, Windows, Linux? Your experience level? (Basic, regular, advanced) 9
  8. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 TIMETABLE:

    1. About workshop ~2 min 2. What is the DDEV ~2 min 3. Docker ~2 min 4. Installation ~2 min 5. Basic commands ~4 min 6. CMS’s ~4 min 7. Con fi guration ~2 min 8. Addons ~1 min 9. Customisation ~1 min 10. The Conclusion ~1 min 11. The Resources ~1 min 12. Q & A 10++ min 10
  9. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 DDEV

    IS A HUGE ECOSYSTEM Not everything could be covered What we will cover What will be skipped Follow up 12
  10. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 WHY

    Isolation: enables us to easily manage Docker containers stack which isolates each project in memory and disk, and enables full customisation to match actual production environment. Easy sharing of the environment with code management system (or infrastructure in code) Regularly updated with a lot of out-of-the-box extensions that just work™ 14
  11. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 ALTERNATIVES

    There are many choices but they all share the same principles: Docksal: FFW team developed solution based on Bash scripts. Lando: Developed by Amaze team to support their infrastructure. Docker4Drupal: Created by Woodby, used for their infrastructure. Docker compose: Docker own solution. DrupalEasy A comparison from 2018: DDEV, Docksal, and Lando 15
  12. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 CONTAINERISATION

    ALTERNATIVES Install one of the supported Docker providers: OrbStack: Recommended, easiest to install, most performant, commercial, not open- source. Lima: Free, open-source. Docker Desktop: Familiar, popular, not open-source, may require license, may be unstable. Rancher Desktop: Free, open-source, simple installation, slower startup. Colima: Free, open-source, no longer recommended. 18
  13. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 LINUX

    The least overhead, almost native performance inside container (virtual machine) Linux users are usually very fl uent with command line so tooling, options and basic rules and the way of thinking comes naturally Although many things just work™ some care must be taken (users, permissions, groups, daemon control) 19
  14. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 MAC

    Being based on FreeBSD, Mac is very similar but still not the same (Mac is UNIX, not Linux) Having different kernel, Mac needs virtualisation to be able to run Linux kernel so inside it can run Linux containers. Also, fi le system is different so we need “smart” mapping (mutagen) which slows down containers Terminal works almost the same On linux it is a system inside a system, on Mac those are inside an another system Mac runs on ARM 64, Apple Silicon Chip while PCs are mostly on Intel/AMD (x86_64) 20
  15. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 WINDOWS

    Windows is something completely different, running own kernel, different fi le system, everything on different paradigm Having different kernel, Windows needs virtualisation to be able to run Linux kernel so inside it can run Linux containers. Windows uses own WSL2 which runs Ubuntu (Linux) but that has mapping quirks with users and permissions Terminal is totally different (PowerShell) so it is new for average Windows user On linux it is a system inside a system, on Windows those are inside an another system 21
  16. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 DDEV

    INSTALLATION Docker provider DDEV itself Create project 23
  17. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 SYSTEM

    COMMANDS ddev help ddev version ddev conf i g ddev describe ddev get ddev list ddev poweroff 25
  18. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 FREQUENT

    COMMANDS ddev start ddev restart ddev stop ddev delete -O ddev clean -- all ddev hostname 26
  19. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 OPERATIONAL

    COMMANDS ddev auth ddev ssh ddev composer ddev exec ddev export - db ddev import - db ddev snapshot 27
  20. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 COMMANDS

    I RARELY USE ddev import - f i les ddev logs ddev mutagen ddev self - upgrade ddev service ddev share 28
  21. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 STARTING

    DRUPAL PROJECT mkdir my - drupal - site & & cd my - drupal - site ddev conf i g - - project - type=drupal - - php - version=8.3 - - docroot=web ddev start ddev composer create drupal/recommended - project:^10 ddev conf i g - - update ddev composer require drush/drush ddev drush site:install - - account - name=admin -- account - pass=admin - y # use the one - time link (CTRL/CMD + Click) from the command below to login. ddev drush uli ddev launch 30
  22. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 STARTING

    WORDPRESS PROJECT # DDEV has built - in support for WP-CLI, the command - line interface for WordPress. mkdir my - wp - site & & cd my - wp - site # Create a new DDEV project inside the newly - created folder # (Primary URL automatically set to `https: / / <folder>.ddev.site`) ddev conf i g -- project - type=wordpress ddev start # Download WordPress ddev wp core download # Launch in browser to f i nish installation ddev launch 31
  23. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 SUPPORTED

    SYSTEMS Backdrop CakePHP Craft CMS Django 4 (Experimental) Drupal ExpressionEngine Grav Ibexa DXP Kirby CMS Laravel Magento Moodle Pimcore Python/Flask (Experimental) Shopware Silverstripe Statamic Symfony TYPO3 WordPress 32
  24. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 .ddev/conf

    i g.yml name: begaero type: drupal10 docroot: web php_version: "8.2" webserver_type: nginx - fpm xdebug_enabled: false additional_hostnames: [] additional_fqdns: [] database: type: mariadb version: "10.4" use_dns_when_possible: true composer_version: "2" web_environment: [] nodejs_version: "18" corepack_enable: false 34
  25. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 PROJECT

    TYPE, PHP AND WEB SERVER # name: <projectname> # Name of the project, automatically provides # http://projectname.ddev.site and https://projectname.ddev.site # type: <projecttype> # backdrop, craftcms, django4, drupal, drupal6, drupal7, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress # See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more # information on the different project types # "drupal" covers recent Drupal 8+ # docroot: <relative_path> # Relative path to the directory containing index.php. # php_version: "8.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" # You can explicitly specify the webimage but this # is not recommended, as the images are often closely tied to DDEV's' behavior, # so this can break upgrades. # webimage: <docker_image> # nginx/php docker image. 35
  26. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 DATABASE

    AND DEBUG # database: # type: <dbtype> # mysql, mariadb, postgres # version: <version> # database version, like "10.11" or "8.0" # MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0 # PostgreSQL versions can be 9-16. # router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80) # router_https_port: <port> # Port for https (defaults to global configuration, usually 443) # xdebug_enabled: false # Set to true to enable Xdebug and "ddev start" or "ddev restart" 36
  27. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 ADDING

    OFFICIAL AND OTHER ADDING ddev get -- list ┌──────────────────────────────────────┬────────────────────────────────────────────────────┐ │ ADD-ON │ DESCRIPTION │ ├──────────────────────────────────────┼────────────────────────────────────────────────────┤ │ ddev/ddev - adminer │ Adminer service for DDEV* │ ├──────────────────────────────────────┼────────────────────────────────────────────────────┤ │ ddev/ddev - beanstalkd │ Beanstalkd for DDEV* │ ├──────────────────────────────────────┼────────────────────────────────────────────────────┤ │ .. . │ ... │ 20 repositories found. Add - ons marked with '*' are off i cially maintained DDEV add - ons. # Getting phpMyAdmin ddev get ddev/ddev - phpmyadmin 38
  28. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 43

    Chapter 13 (secret bonus) TROUBLESHOOTING
  29. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 USEFUL

    TIPS Clean unused projects and images, they eat disk for treat! Check occasionally Docker logs Mind the context for the commands! Pulling the fi les from provider requires restarting the project 44
  30. @MacMladen ]{ Drupal and DDEV advanced workshop v.1 2024-06-12 THE

    RIGHT TOOL FOR THE JOB Do not reinvent or struggle, just use it and do your work Other tools are quite fi ne and very similar, however, my opinion and the result of my research is that DDEV has wide support, capabilities and many developers using it and contributing DDEV offers all the most important tools already baked in, supports wide variety of options and customisation Supports wide choice of platforms and unsupported can be added easily 46