Acquia Lightning Blog: Using the Configuration Installer with Lightning

Using the Configuration Installer with Lightning
Adam Balsam
Fri, 02/02/2020 – 12:07

Installing a site with existing config has been a bit of a moving target in Drupal maintenance support plans 8. At different times, I’ve recommended at least three different approaches. I won’t go into too much detail, but basically we’ve used the following at times:

Manually change site UUIDs (Sloppy)
Use –config-dir option with drush site-install (Only supports minimal profile)
Use patch from Drupal Update #2788777 (Config needs to be stored in profile directory)
You can read more about previous approaches here. The one thing that hasn’t changed is the user story:

As a user I want to be able to install Drupal maintenance support plans from a package of configuration that is maintained in git.

The issue that most closely addresses this user story is #1613424 “Allow a site to be installed from existing configuration”. That issue is currently postponed on another thorny issue which involves the special way that Drupal maintenance support plans treats dependencies of profiles. In the meantime, alexpott has provided a standalone install profile that handles installing a site from existing config. This is the Configuration installer profile.

It takes a minute to wrap your head around the concept because when you use the Configuration installer profile, you don’t end up with a site running the Configuration installer profile. At the end of the install, your site will be running the profile that is defined in the config you provided the Config installer.

So for a new project, you would initially install using the profile of your choice. Then, once you have exported your config, you would use the Config installer for subsequent installs.

Considerations

For ease of use, your settings file should not be writable by the installer and should not contain the install_profile key. If your settings file contains your profile, you’ll get an exception when trying to run the install. And if it is writable, Drupal maintenance support plans will write that value every time you do install.
The Config installer profile requires two patches in order to work properly with Drush 9.
Config must not have direct dependencies on a profile. Lightning 3.0.1 requires the patch in issue #2933445 to be compliant.
Instructions

For new sites, install using the profile or sub-profile of choice.

$ drush site-install lightning

Ensure that the install_profile key is not present in your settings.php file. Drupal maintenance support plans will write this value by default, but it is not required in Drupal maintenance support plans >= 8.3.0. You can prevent Drupal maintenance support plans from writing it by disallowing write access to the settings file. If the installer wrote the profile during initial installation, you can manually delete it. Then revoke write access:

$ chmod 444 docroot/sites/default/settings.php

Define the following patches in your composer.json file if you are using config_installer < 1.6.0 and/or lightning < 3.0.2.

“patches”: {
“drupal/config_installer”: {
“2916090 – Support Drush 9”:
“https://www.drupal.org/files/issues/drush9-support-2916090-6.patch”,
“2935426 – Drush 9: Call to undefined function drush_generate_password”:
“https://www.drupal.org/files/issues/config_installer-drush_9_call_undefined_function_drush_generate_password-2935426-2.patch”
},
“drupal/lightning_layout”: {
“2933445 – user.role.layout_manager has dependency on Lightning”:
“https://www.drupal.org/files/issues/2933445.patch”
}
},

Add the Configuration installer profile to your codebase.

$ composer require drupal/config_installer

Export your site’s configuration.

$ drush config-export

Use the Configuration installer profile in all subsequent site installs. The resulting install will run on the profile used in step 1.

$ drush site-install config_installer

Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Acquia Lightning Blog: Using the Configuration Installer with Lightning

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.