2017 © Pedro Peláez
 

project d8-quickstart

Quick start template for Drupal 8 projects.

image

teamdeeson/d8-quickstart

Quick start template for Drupal 8 projects.

  • Monday, June 18, 2018
  • by johnennew
  • Repository
  • 12 Watchers
  • 9 Stars
  • 77 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 5 Open issues
  • 38 Versions
  • 3 % Grown

The README.md

Drupal 8

The preferred way to manage Drupal 8 sites is to use composer, and the Drupal Composer project helps integrate Drupal core with composer., (*1)

This repository provides a quick start wrapper around Drupal Composer and includes common configuration and recommended modules for Deeson Drupal 8 projects., (*2)

Quick-start projects use composer for dependency management, including Drupal core, contrib and 3rd party libraries. The contents of docroot/ should be considered expendable during development and can be recompiled from the contents of the repository., (*3)

We use Docker and Docker compose for managing local development and this repository comes with some default configuration for working with Docker. You are of course free to use alternatives, but additional configuration may be required., (*4)

For drush to work with Docker, you'll need to add the following line to your /etc/hosts file: 127.0.0.1 docker.local, (*5)

Creating a new Drupal site

You do not need to clone this repo, our quick start is checked out using composer., (*6)

First you need to install composer., (*7)

Then you can create a new project using composer, keep the project name short and without punctuation (e.g. myproject), (*8)

composer create-project teamdeeson/d8-quickstart <project-name> --stability dev --no-interaction

You should now create a new git repository, and commit all files not excluded by the .gitignore file., (*9)

git init
git add .
git commit -m "Created the project."

Required configuration

You should check through all of the services and settings files and make any required amendments. The following amendments need to be made at a minimum:, (*10)

.env: Add your project name in here, use the same one as used with composer (e.g. myproject), (*11)

src/settings/environment.inc: Configure your domain names, (*12)

src/settings/01-core.settings.inc: Configure a hash salt., (*13)

src/settings/02-shield.settings.inc: Configure basic-auth access details to protect your dev sites., (*14)

Build and install

At Deeson we use Makefiles to orchestrate any additional tasks such as building dependencies and running tests., (*15)

This ensures we have a universal mechanism for task running across all of our projects., (*16)

The project can be built using the included Makefile., (*17)

make

will build the project based on the assumed environment. This will create the docroot/ folder and build your website., (*18)

You can specify the environment explicitly with the ENVIRONMENT variable which will add or remove dev dependencies:, (*19)

make build ENVIRONMENT=dev
make build ENVIRONMENT=prod

You can also safely remove your docroot at any point if you need to:, (*20)

make clean

Once you have run the build for the first time, you can setup and run your Docker environment using the following command., (*21)

make start

You should now have several running docker containers, including nginx, php, mariadb. Run the following command to check this., (*22)

$ docker container ls
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS              PORTS                                      NAMES
01b7db232917        wodby/drupal-nginx:8-1.13-2.4.2   "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes        80/tcp                                     d8-quickstart_nginx
b463d169feeb        deeson/fe-node                    "bash -c 'yarn insta…"   3 minutes ago       Up 3 minutes                                                   d8-quickstart_fe-node
f487f9c5ae93        wodby/drupal-php:7.1-2.4.3        "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes        9000/tcp                                   d8-quickstart_php
fd56e451e51d        wodby/mariadb:10.1-2.3.3          "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes        3306/tcp                                   d8-quickstart_mariadb
53d6dcb35ee1        mailhog/mailhog                   "MailHog"                3 minutes ago       Up 3 minutes        1025/tcp, 8025/tcp                         d8-quickstart_mailhog
fb0ebe6aae0e        wodby/redis:3.2-2.1.0             "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes        6379/tcp                                   d8-quickstart_redis
834f7edc1c46        wodby/drupal-solr:8-6.4-2.0.0     "docker-entrypoint-s…"   3 minutes ago       Up 3 minutes        8983/tcp                                   d8-quickstart_solr
c18f97249a71        deeson/fe-php                     "docker-php-entrypoi…"   3 minutes ago       Up 3 minutes                                                   d8-quickstart_fe-php
2ffcf9dcf72d        traefik:1.6.6-alpine              "/entrypoint.sh --do…"   23 hours ago        Up 20 hours         0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   traefik

The output should contain a line like this:, (*23)

2ffcf9dcf72d        traefik:1.6.6-alpine            "/entrypoint.sh --do…"   21 hours ago        Up 18 hours         0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   traefik

This is the docker-proxy container. It must be running for you to view the site in browser. See dependencies section for setup instructions., (*24)

cd docker-proxy
make start

You should now be able to access a vanilla Drupal site at https://d8-quickstart.localhost in Google Chrome. You will need to add a security exemption as Chrome will complain about the SSL certificate being unsigned., (*25)

If you want to use other browsers you have to add an entry to your /etc/hosts file:, (*26)

127.0.0.1 d8-quickstart.localhost

You can now run the Drupal installation, either through the interface or from the command line using:, (*27)

make install

will install the site and associated configuration. You will be prompted to optionally perform a site install. If you proceed this will erase your existing site database., (*28)

You can stop the docker environment at any time using the command below:, (*29)

make stop

Your site files and database will be stored outside of docker in the .persist hidden directory., (*30)

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., (*31)

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., (*32)

For further details, see the Drupal Composer project documentation:, (*33)

https://github.com/drupal-composer/drupal-project#composer-template-for-drupal-projects, (*34)

Composer project usage guide:, (*35)

https://getcomposer.org/doc/01-basic-usage.md, (*36)

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., (*37)

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., (*38)

PHPUnit tests should be defined within you custom modules, in the tests/ sub-directory., (*39)

Behat tests should be defined in the behat-tests directory in the project root., (*40)

make test

will run all of the Project's automated tests., (*41)

Project structure

behat-tests/

This contains all of the Behat tests for your project., (*42)

config/

This contains Drupal's CMI configuration files., (*43)

docroot/

This directory contains compiled content and should not normally be committed to your repository., (*44)

drush/

This contains your drush site aliases file(s)., (*45)

src/

This contains all of your project source code. As follows:, (*46)

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, (*47)

src/modules/

This is where you place your custom modules., (*48)

Anything within src/modules/ will be made available in docroot/modules/custom/, (*49)

src/services/

You can define your services YAML files here., (*50)

src/settings/

This contains the Drupal site settings, extracted from settings.php as per: http://handbook.deeson.co.uk/development/drupal8/#settings-file-configuration, (*51)

This has been moved from either sites/default/settings/ or sites/conf/ mentioned in the blog post., (*52)

settings.php will be made available in docroot/sites/default/. All other files will be included in-place by settings.php., (*53)

src/themes/

This is where you place your custom theme(s)., (*54)

Anything within src/themes/ will be made available in docroot/themes/custom/, (*55)

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)., (*56)

scripts/

This is for any compilation or deployment scripts you may want to add., (*57)

These need to be included in your settings file in the usual way:, (*58)

$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., (*59)

web/

This and docroot/ are symlinked to the same location for wider compatibility and should also be excluded from your repository., (*60)

Helpful Docker commands

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:, (*61)

docker-compose exec <container-name> <command>

For example to start a mysql client on the database container (mariadb) run:, (*62)

docker-compose exec mariadb mysql

You can also use the more standard docker commands., (*63)

To list the active Docker instances run the following in the project root directory:, (*64)

docker-compose ps

To get a bash terminal inside the PHP container you can use the following:, (*65)

docker-compose exec php

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):, (*66)

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, (*67)

Dependencies

Our Docker proxy should be installed and running. See here for installation notes: https://bitbucket.org/deesongroup6346/d4d-traefik-proxy, (*68)

Known issues

ERROR: Network proxy declared as external, but could not be found. Please create the network manually using 'docker network create proxy' and try again., (*69)

The Docker proxy needs to be running. See dependencies above., (*70)

Managing Configuration

The D8 Quickstart uses Config Split to separate local development configuration from the default configuration., (*71)

Exporting configuration

The default configuration will be exported to ./config/default by drush @docker cex., (*72)

The local development configuration will be exported to ./config/local automatically when drush @docker cex is ran., (*73)

You can control what is considered local configuration in the Drupal 8 admin area., (*74)

Importing configuration

You can import the site configuration using drush @docker cim, (*75)

The default configuration will always be imported., (*76)

If the environment is the local development environment then the local configuration is also imported., (*77)

Using Drush with Acquia

You may need to add the following to your ~/.ssh/config when working with Drush and Acquia remote hosts:, (*78)

Host *.acquia-sites.com
   LogLevel QUIET

The Versions

18/06 2018

dev-master

9999999-dev

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

05/04 2018

dev-feature/support-multiple-environments

dev-feature/support-multiple-environments

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/03 2018

dev-feature/deeson-admin-theme

dev-feature/deeson-admin-theme

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

14/03 2018

dev-site-wont-run-internal-error

dev-site-wont-run-internal-error

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

26/01 2018

dev-feature/drush-wrapper-bash

dev-feature/drush-wrapper-bash

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

24/11 2017

dev-drush-wrapper-update

dev-drush-wrapper-update

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

23/11 2017

dev-feature/fe-starter-integrate

dev-feature/fe-starter-integrate

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

23/11 2017

dev-feature/drush-aliases

dev-feature/drush-aliases

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

17/11 2017

dev-feature/build-in-container

dev-feature/build-in-container

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

16/11 2017

dev-feature/require-componentised-frontend

dev-feature/require-componentised-frontend

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

16/11 2017

dev-feature/drush-wrapper

dev-feature/drush-wrapper

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

09/11 2017

dev-feature/readme-update

dev-feature/readme-update

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

09/11 2017

dev-feature/update-hostnames

dev-feature/update-hostnames

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

09/11 2017

dev-update-hostnames

dev-update-hostnames

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

10/10 2017

dev-feature/remove-docker-sync

dev-feature/remove-docker-sync

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

05/09 2017

dev-feature/acquia-environment-fix

dev-feature/acquia-environment-fix

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

05/09 2017

dev-feature/docker-tweaks

dev-feature/docker-tweaks

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

29/08 2017

dev-feature/update-container-versions

dev-feature/update-container-versions

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

29/08 2017

dev-feauture/34-update-container-versions

dev-feauture/34-update-container-versions

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

29/08 2017

dev-feature/ssl-support

dev-feature/ssl-support

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

04/07 2017

dev-feature/sort-php-packages

dev-feature/sort-php-packages

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/06 2017

dev-task/uninstall-excess-modules

dev-task/uninstall-excess-modules

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/06 2017

dev-feature/behat-pipelines

dev-feature/behat-pipelines

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

07/06 2017

dev-feature/docker-make

dev-feature/docker-make

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

07/06 2017

dev-feature/docker-drush

dev-feature/docker-drush

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/06 2017

dev-feature/automated-unittest-in-pipelines

dev-feature/automated-unittest-in-pipelines

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/06 2017

dev-extract-codestandard-tests-into-script

dev-extract-codestandard-tests-into-script

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/06 2017

dev-feature/test-automation-pipelines

dev-feature/test-automation-pipelines

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/06 2017

dev-optimize-autoloader-during-prod-build

dev-optimize-autoloader-during-prod-build

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

01/06 2017

dev-make-phpunit.xml-match-drupal

dev-make-phpunit.xml-match-drupal

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

11/05 2017

dev-feature/docker

dev-feature/docker

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

25/04 2017

dev-feature/docroot

dev-feature/docroot

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

05/03 2017

dev-feature/configure-environment

dev-feature/configure-environment

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

20/02 2017

dev-feature/phpunit-tests

dev-feature/phpunit-tests

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/01 2017

dev-feature/ensure-make-install-works

dev-feature/ensure-make-install-works

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/01 2017

dev-feature/implement-automated-testing

dev-feature/implement-automated-testing

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/01 2017

dev-bugfix/drupal-requires-default-settings-during-installation

dev-bugfix/drupal-requires-default-settings-during-installation

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

27/01 2017

dev-bugfix/assume-local-env-if-undefined

dev-bugfix/assume-local-env-if-undefined

Quick start template for Drupal 8 projects.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires