Debug faster: a ddev and docker4drupal comparison



I've started experimenting with DDEV for local development environments. It provides simple commands to quickly get you up and running compared to docker4drupal.

However docker4drupal has the upper-hand when you want to restore databases into your dev environment. Its easier and faster compared to drush sqlc or DDEV commands.

To enable this feature on docker4drupal, uncomment these lines in the mariadb container.

Next create a folder called mariadb-init and drop your db in there then start up your container. It will pickup any files with *.sql or *.sql.gz

If your container is already running you'll need to restart it. I find that its easier to destroy it and start again.

docker compose stop mariadb &&
docker compose rm -f mariadb &&
docker compose up -d


Tip: Ive made this easier by adding an alias called dbdb to run the above.

Now if I need to debug an issue using a snapshot of production data, I can load it into the mariadb-init folder and run dbdb to start debugging.

You can store multiple snapshots in mariadb-init. Just create a subfolder and put the old dbs in there and leave the one you to resote in the root directory of mariadb-init.

Happy debugging!!

Comments

Popular posts from this blog

Insights for Software Development Workflows from the Pacific Islands

Government of Tonga’s first mobile app nears completion

Bot Busters: Defending Your Site Against Bots