teamdeeson / d9-quickstart
Quick start template for Drupal 9 projects.
Installs: 69
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 2
Type:project
Requires
- composer/installers: ~1.9.0
- cweagans/composer-patches: ^1.6.5
- drupal/coffee: ^1.0
- drupal/components: ^2.0@beta
- drupal/config_filter: ^2.0@rc
- drupal/config_ignore: 2.x-dev
- drupal/config_split: ^1.5@rc
- drupal/core: ^9.0.0
- drupal/core-composer-scaffold: *
- drupal/entity: ^1.0
- drupal/field_group: 3.x-dev
- drupal/focal_point: ^1.4
- drupal/masquerade: ^2.0@beta
- drupal/media_entity_download: ^2.0
- drupal/metatag: ^1.13
- drupal/paragraphs: ^1.12
- drupal/pathauto: ^1.18
- drupal/redirect: ^1.16
- drupal/redis: ^1.4
- drupal/reroute_email: 2.x-dev
- drupal/save_edit: ^1.3
- drupal/scheduler: ^1.3
- drupal/warden: ^3.0
- drush/drush: ^10.3.1
Requires (Dev)
- drupal/core-dev: ^9
- drupal/stage_file_proxy: ^1.0
Conflicts
This package is auto-updated.
Last update: 2024-10-17 13:58:21 UTC
README
This project is a tool for quickly bootstrapping a Drupal 9 website using the standards and best practice of the Deeson web development agency.
This project works with MacOSX and Linux but it is not tested on other operating systems. It probably does not work on Windows.
Dependencies
Creating a new Drupal 9 site
Use the following command to create a new Drupal 9 project. Replace <project-name>
with your own name. Keep the project name short and without punctuation (e.g. myproject)
composer create-project teamdeeson/d9-quickstart <project-name> --stability dev --no-interaction
You should now switch to the project directory and create a new git repository, and commit all files not excluded by the .gitignore file.
cd <project-name>
git init
git add .
git commit -m "Created the project."
Required configuration
You should configure the project for your needs now. The following amendments need to be made at a minimum:
.env:
Change the PROJECT_NAME and PROJECT_BASE_URL for your project (the url must end in .localhost). Make up a new HASH_SALT string.
src/settings/environment.inc:
Configure your domain names here if you know what the remote ones are going to be.
src/settings/02-shield.settings.inc:
Configure basic-auth access details to protect your dev sites (Acquia only)
Build and install
The project can now be built for the first time using the included Makefile
make
This will create the docroot/
folder and build your website.
It should finish with a one time login URL which you can copy into the Chrome web browser to access your new Drupal site.
Starting and stopping the project.
Once you have run the build for the first time, you can stop the project any time with:
make stop
The project starts again using:
make start
Browser access
You can access localhost domains in Chrome without making any changes. If you want to use other browsers you have to add an entry to your /etc/hosts
file for this project (replace project url with your url):
127.0.0.1 project.localhost
Managing dependencies with composer
All of your dependencies should be managed through composer. This includes any off-the-shelf code such as Drupal core, contrib modules and themes, and any 3rd party libraries.
To add a module (e.g. redirect):
composer require drupal/redirect
To update a module (e.g. redirect):
composer update drupal/redirect
To update Drupal core:
composer update drupal/core --with-dependencies
You should commit your composer.lock file to the repository as this will guarantee that any subsequent builds will use the same exact version of all your dependencies.
For further details, see the Drupal Composer project documentation:
https://github.com/drupal-composer/drupal-project#composer-template-for-drupal-projects
Composer project usage guide:
https://getcomposer.org/doc/01-basic-usage.md
Xdebug
You need to run sudo ifconfig lo0 alias 10.254.254.254
before Xdebug connections will work. This is usually required each time you log-in to your development machine, but is safe to run periodically.
Running tests
This repository contains the starting point for running both Behat and PHPUnit test suites as well as Drupal coding standards checks with PHPCS.
PHPUnit tests should be defined within you custom modules, in the tests/ sub-directory.
Behat tests should be defined in the behat-tests directory in the project root.
make test
will run all of the Project's automated tests.
Project structure
docroot/
This directory contains compiled content and should not normally be committed to your repository.
drush/
This contains your drush site aliases file(s).
src/
This contains all of your project source code. As follows:
src/config/
This contains Drupal's CMI configuration files.
src/frontend/
For all your front end needs. This makes use of our front end setup, you can find out how here : https://github.com/teamdeeson/deeson-webpack-config
src/modules/
This is where you place your custom modules.
Anything within src/modules/
will be made available in docroot/modules/custom/
src/settings/
This contains the Drupal site settings, extracted from settings.php.
src/themes/
This is where you place your custom theme(s).
Anything within src/themes/
will be made available in docroot/themes/custom/
src/themes/deeson_frontend_framework
The default hook up between drupal and src/frontend. Your theme can either inherit from this or follow the instructions from https://github.com/teamdeeson/deeson-webpack-config to do it yourself (its not tricky).
These need to be included in your settings file in the usual way:
$settings['container_yamls'][] = dirname(DRUPAL_ROOT) . '/src/services/development.services.yml';
vendor/
This is the composer vendor directory, which contains project dependencies, tools and libraries. This should be excluded from your repository.
web/
This and docroot/
are symlinked to the same location for wider compatibility and should also be excluded from your repository.
Docker commands
You should now have several running docker containers, including nginx, php, mariadb. Run the following command to check this.
docker-compose ps
You can access the realtime logs from these with:
make logs
or the logs from a specific container with:
docker-compose logs php -f
If you want to delete the site and rerun the installation process you can use:
make clean && make install
You can use the docker-compose tool as a shortcut for common docker commands. To run a command within one of the containers you can use:
docker-compose exec <container-name> <command>
For example to start a mysql client on the database container (mariadb) run:
docker-compose exec mariadb mysql
To get a bash terminal inside the PHP container you can use the following:
docker-compose exec php /bin/bash
To import an exported site database into the database container (if you don't have pv installed you can do so with brew install pv
):
pv database_export_filename.sql | docker-compose exec -T mariadb mysql -udrupal -pdrupal drupal
Note that this method is up to 33% faster than the drush method pv database_export_filename.sql | drush @docker sql-cli
Known issues
Deeson Docker Proxy not running.
ERROR: Network proxy declared as external, but could not be found. Please create the network manually using 'docker network create proxy' and try again.
The Docker proxy needs to be running. See dependencies above.
Using Drush with Acquia
You may need to add the following to your ~/.ssh/config when working with Drush and Acquia remote hosts:
Host *.acquia-sites.com
LogLevel QUIET