Week 3 - Configuration Drupal 8 - Fresh Install

Week 3 - Configuration Drupal 8 - Fresh Install

There are a few things that are required to be done in order to follow the best practices within a Drupal 8 site in regards to setting up added security and configuration directories. Below are two items that I performed that allowed me to have a status report with no errors.

Screenshot-2019-08-19-13.24.41

  1. Secure the Trusted Host Settings - https://www.drupal.org/docs/8/install/trusted-host-settings

Example of trusted host configuration setting:

$settings['trusted_host_patterns'] = array(
'^sitename.com.dd$',
);

  1. Configuration Directories – settings.php file must define the $config_directories variable as an array containing the names of directories in which configuration files can be found. It must contain a sync key. I’ve used the following resources to get this setup:
    a. https://evolvingweb.ca/blog/using-configuration-management-and-git-drupal-8
    b. https://www.drupal.org/docs/8/configuration-management/changing-the-storage-location-of-the-sync-directory

I have decided to create a secondary repository for my project. This repository is called ‘sitenameConfigBackup’ in which I plan to use it as a dumping ground for configuration files and backups of the database. In reading the articles above I’ve found that this does have to be a separate location as the configuration files and backups should not exist anywhere in the root folder of the website where the Drupal files exists. (Unless you know how to securely lock it down then its best to move the file away from access by the webserver) For me it would be easier to train future me's in having things separate then training someone how to write apache configuration settings to prevent directories from being served by the web server when files exist inside the sites root directory.

Example of Configuration Setting

$config_directories[CONFIG_SYNC_DIRECTORY] = '../private-files/config/site/';

Another task was to figure out how to install community modules and how to update the Drupal core. I was a drush guy in Drupal 7 so I had to pillage this handy table for having a cheat sheet of composer commands [1] that reflected my previous experience. I hope at some point I'll not have to come back to this table:

Task Drush Composer
Installing a contrib project (latest version) drush pm-download PROJECT composer require drupal/PROJECT
Installing a contrib project (specific version) drush pm-download PROJECT-8.x-1.0-beta3 composer require drupal/PROJECT:1.0.0-beta3
Installing a javascript library (e.g. dropzone) drush pm-download dropzone composer require bower-asset/dropzone
Updating all contrib projects and Drupal core drush pm-update composer update
Updating a single contrib project drush pm-update PROJECT composer update drupal/PROJECT
Updating Drupal core drush pm-update drupal composer update drupal/core

Reference Links:

  1. https://github.com/acquia/lightning-project/blob/master/README.md