A new DDEV version sees the light of day. The new DDEV 1.19 has several improvements to offer.
Networks and more ...
A lot has been changed under the hood in Docker network management. Each ddev project now creates its own Docker network. Previously, all ddev projects were in one global ddev network. Separating them makes a lot of sense, as it leads to fewer conflicts.
The docker-compose YAML files should now be created without links: entries. If any are still present.
According to the changelog, nothing needs to be adjusted in an existing project. In my tests, I indeed had no problems and was able to start all existing projects on my computer without any issues.
Docker Desktop, which requires a paid license, is now no longer strictly necessary on MacOS and Windows. On Windows, Docker can now be installed directly under wsl2.
The Colima tool now has experimental support.
Remote instances of Docker can now be used too.
This allows projects to be moved to another server.
Support for Ranger Desktop is experimental as well.
New features
get command
The get command can install services in a project. There is no longer any need to manually copy recipes from the ddev-contrib repository.
Both official and unofficial services are available.
You can get a list of all services like this:
$> ddev get --list ┌────────────────────────┬────────────────────────────────────────────────┐ │ ADD-ON │ DESCRIPTION │ ├────────────────────────┼────────────────────────────────────────────────┤ │ drud/ddev-beanstalkd │ beanstalkd for ddev* │ ├────────────────────────┼────────────────────────────────────────────────┤ │ drud/ddev-memcached │ Install memcached as an extra service in ddev* │ ├────────────────────────┼────────────────────────────────────────────────┤ │ drud/ddev-redis │ redis service for ddev* │ ├────────────────────────┼────────────────────────────────────────────────┤ │ drud/ddev-drupal9-solr │ Drupal 9 Apache Solr installation for DDEV* │ └────────────────────────┴────────────────────────────────────────────────┘ Add-ons marked with '*' are official, maintained DDEV add-ons.
A service can then be installed using the add-on name:
$> ddev get drud/ddev-memcached
To register your own repo in the list, you can give your public GitHub repository the topic ddev-get. The ddev get command then loads the appropriate list of repositories in the background using a built-in GitHub client.
Services from repositories that do not belong to the ddev organization are unofficial services and should be checked manually beforehand.
Service command
Services present in the project's .ddev directory as docker-compose.<service>.yaml can now be disabled and enabled.
Simply pass the service name as an argument.
Example:
ddev service disable varnish
In this case, the file .ddev/docker-compose.varnish.yaml is moved to the .ddev/.disabled-services directory.
The files under .disabled-services can also be included in version control.
A disabled service can then be enabled again as follows:
ddev service enable varnish
Database changes (Postgres support)
The config command has been adjusted.
The options --mysql-version and --mariadb-version have been replaced by the new, more universal --database option.
You can specify the database and version directly here.
Examples:
ddev config --database=mysql:8.0 ddev config --database=mariadb:10.3 ddev config --database=postgres:13 ddev config --database=postgres:14
All commands that work with databases have been adjusted to handle Postgres. This means nothing stands in the way of snapshots and SQL dumps.
Snapshots are compressed
When a database snapshot is created using ddev snapshot, it is now compressed with gzip.
Disk usage is reduced dramatically. According to the changelog, this can be by a factor of 20.
Old, uncompressed snapshots can still be used.
NodeJS configuration
These days, even PHP projects can hardly get by without NodeJS, as many development tools (especially in frontend development) run on NodeJS.
DDEV has always had Node preinstalled. Until now, though, changing the version was only possible via a Dockerfile. That changes with the new release.
The config command now comes with the --nodejs-version option.
NodeJS versions 12, 14, 16 and 17 are supported. Version 16 is the default.
Also new is the ddev nvm command for working directly with the preinstalled Node Version Manager.
For example, this lets you quickly downgrade NodeJS to version 6.
ddev nvm install 6 # Sollte die Version 6 anzeigen ddev nvm run node --version
PHP, Drush and MySQL commands optimized.
A small but nice change. Some commands have been optimized so that there are fewer conflicts when "quoting" arguments.
This also applies to the "exec" command, which can be used generically.
Composer root, switch around ...
Projects that do not have their composer.json in the root directory but in a subdirectory will love the new ddev config --composer-root=<relativer-pfad> option.
Afterwards, ddev composer works in the subdirectory.
To reset this, there is the ddev config --composer-root-default option.
Debug output
Some output has been suppressed.
You can enable it again using the DDEV_DEBUG environment variable.
export DDEV_DEBUG=true
This message from the changelog falls into a similar category.
ddev no longer pesters about overridden commands (when project has a drush command that overrides the global drush command, for example)
Troubleshooting
Problems crop up every now and then when developing with Docker. There can be various reasons for this. Often, updated operating systems or new Docker versions are the cause. If an NFS mount or something similar is involved too, strange error messages can occur that sometimes turn into elaborate troubleshooting sessions.
This is exactly where the two new commands ddev debug dockercheck and ddev debug test come in.
The debug dockercheck command does a rough check of whether Docker works.
It looks like this:
$> ddev debug dockercheck Docker platform: balmung Using docker context: default (unix:///var/run/docker.sock) docker-compose: v2.2.2 Using DOCKER_HOST=unix:///var/run/docker.sock Docker version: 20.10.12 Able to run simple container that mounts a volume. Able to use internet inside container.
The debug test command runs more extensive tests using a test script.
The test script is a simple shell script included with ddev.
If you want to take a look at the script, you can find it here: https://github.com/drud/ddev/blob/master/cmd/ddev/cmd/scripts/test_ddev.sh
Conclusion
The new ddev 1.19 release is really enjoyable. I helped with testing myself and can only say that Magento 2 development works brilliantly with it.
So far, I have also been able to start all my projects without any problems.
The new service command definitely has a lot of potential. There will probably soon be a search for services too, once the community gets going.
- https://github.com/drud/ddev/releases/tag/v1.19.0
Updates
- 12.03.2022: "Composer Root" information. Thanks to Josef Glatz for the tip.