Since a lot of Drupal developers commented in favor of DDEV as the recommended Drupal local development environment, we started adapting to use DDEV. The thing is, nobody really remembers what “DDEV” stands for, it might be “Docker development” or it might have been “Drud development” and it is really familiar for the people in tech business.
If you'd like to create a DDEV environment for Drupal 10 and PostGIS, like we do, you should follow these steps:
- Install DDEV
- Create your development environment
- Go to your development directory and type the commands below:
mkdir my-project cd my-project ddev config --project-type=drupal10 --docroot=web --create-docroot --database=postgres:16 --dbimage-extra-packages=postgresql-postgis,postgis ddev start ddev composer create drupal/recommended-project ddev composer require drush/drush ddev drush site:install --account-name=admin --account-pass=admin -y ddev drush uli ddev launch
- Enable PostGIS
- After starting your project, you can enable the PostGIS extension on your db container. You need to login to that container with:
ddev ssh -s db
- If you login to db container as user postgres, please type:
- Now you're inside the PostgreSQL interactive terminal. Please type the following commands:
\c db create extension postgis;
Now it is done. You can test it by installing geofield module and configure a field to use PostGIS.
Have a mappy day.