Skip to content

DrupalNL/drupal-in-a-day-website

Repository files navigation

Drupal in a Day

This project contains the Drupal in a Day website. It was based on Composer template for Drupal projects. Also read the documentation of the template for more information.

Install

First you need to install composer.

Note: The instructions below refer to the global composer installation. You might need to replace composer with php composer.phar (or similar) for your setup.

After that you can install the project from the root of the application:

composer install

With composer require ... you can download new modules to the application.

cd some-dir
composer require drupal/devel:8.*

When adding new modules, make sure a specific version is specified. We don't want composer to download a different version unintentionally when building/updating the site.

Install clean new site

The Config Installer module was added to be able to install a clean site from configuration. More information on the module can be found in this blog. Using drush you can easily set up a fresh installation for test/development:

  • Make sure all composer packages are installed.
  • Copy web/sites/default/default.settings.local.php to web/sites/default/settings.local.php.
  • Add database credentials and other custom config in your settings.local.php.
  • Run the drush site install from the web directory: ```drush si config_installer --account-name=[username-user-1] --account-pass=[your-password]````

Module / core updates

  • Change modules/core version numbers in composer.json
  • Update code: composer update -n
  • Run DB updates: drush updb
  • Export config: drush cex
  • Commit changes: git commit -m 'Describe your awesome changes here.'
  • Push changes: git push

Configuration

The config split module is used to optimize the configuration import and export. We want to keep development configuration out of the production environment (Field UI / Devel etc) and add special handling for some configuration (Webform / Group menu's).

Read this awesome article for more info on the workflow.

Workflow

  • Export config: drush cex
  • Commit changes: git commit -m 'Describe your awesome changes here.'
  • Merge changes: git pull --rebase
  • Update dependencies: composer install
  • Run DB updates: drush updb
  • Import configuration: drush cim
  • Push changes: git push

Production

Make sure the excluded config is not removed on the production environment with the following workflow:

  • Export excluded config: drush -y config-split-export excluded
  • Import configuration: drush cim

Patches

To add a patch to drupal module foobar insert the patches section in the extra section of composer.json:

"extra": {
    "patches": {
        "drupal/foobar": {
            "Patch description": "URL to patch"
        }
    }
}