Requirements, tips and tricks for importing your Drupal site to Pantheon


Table of contents

Introduction

DIT provides support for Drupal sites via a contract with Pantheon, to request a site the link is here.

Below is some useful information to know before migrating a site to the DIT Pantheon Drupal service.

Top

Requirements

Drupal version 9

Existing sites being migrated to Pantheon must be already upgraded to Drupal 9 before the migration, as the new base site made on Pantheon will be D9.  For help with upgrading a Drupal 8 site to Drupal 9, we have the following KB article. Also ensure that syslog is disabled before beginning the migration by uninstalling the module via the web interface or drush, ex: drush pm-uninstall syslog

Top

Integrated composer

Drupal on Pantheon is based on a Composer workflow, for some information and instructions on starting out with Composer, see Drupal on Panteon.

Top

Tips and tricks

Installer-paths for custom types (ie. bower-asset, npm-asset, ckeditor-plugin)

Note to install modules/plugins from custom package repositories such as bower-asset from packagist.org,
and ckeditor-plugin, a helper module called oomphic/composer-installers-extender needs to be configured and installed.

composer require -W --ignore-platform-reqs oomphinc/composer-installers-extender

Add appropriate installer-types within the extra hash in your composer.json file

"extra": {.....other configs
 
    "installer-types": [
        "bower-asset",
        "npm-asset",
        "ckeditor-plugin"
    ]
}

Top

Commit changes

You will now be able to add custom installer-paths for types such as ckeditor-plugin.

Reference: https://packagist.org/packages/oomphinc/composer-installers-extender

Top

Third-party library installation

See installer-paths for custom types first.
As composer based install is preferred using other package systems is to be considered.
If library is available via default composer repository, use that if not see if available in https://asset-packagist.org/
It is possible it is available as a bower or npm asset.
Example of blazy library. (Undeclared dependency of modal_page)
Edit repositories leaf of composer.json adding

{
    "type": "composer",
}

Then edit the extra: installer-paths leaf of composer to know where to install bower-asset and npm-asset types

"web/libraries/{$name}": [
    "type:drupal-library",
    "type:bower-asset",
    "type:npm-asset",
    "vendor:npm-asset",
    "vendor:bower-asset"
],

Then require the desired library with composer require command

composer -W --ignore-platform-reqs require bower-asset/blazy

It is best practice to use the lastest version as they have the most up to date security and performance fixes, but sometimes it is necessary to temperarily use a previous one to work around functional issues.

If Dropzone complains about missing files, it may be that an older version of the dropzone library is needed, that has a 'dist' folder, try this version:

composer --ignore-platform-reqs -W require bower-asset/dropzone:5.5.0

For libraries that may not be available via a package system. (Double check, and triple check before doing this.)
(For slick, info taken from https://www.drupal.org/project/slick/issues/2907371#comment-13250709 as installed version for facilities site is using the library built by Ken Wheeler)
Edit the repositories leaf of composer.json adding something similar to

{
    "type": "package",
    "package": {
        "name": "mypackage/mymodule",
        "version": "v1.8.1",
        "type": "drupal-library",
        "dist": {
          "type": "zip"
        }
    }
},
composer -W --ignore-platform-reqs require mypackage/mymodule

This is just an example if library can not be found in some package repository like asset-packagist.org, however see below on how to install slick "properly".

Key point is that type is set to drupal-library so composer knows to install to web/libraries/{$name}
Installing via composer will allow an two line update to the package repository in composer to upgrade the library version.

NOTE: Some libraries may get installed by properly defined composer metadata, however if type=library the library may end up in /vendor
to which Status Report may complain about the path, in those cases edit installerPath for the vendor/product/extension so the library ends up where Status Report wont complain.
Please see slick library example below.

Top

Installing slick library with composer

See installer-paths for custom types first.

slick library by Ken Wheeler can be installed with

composer -W --ignore-platform-reqs require bower-asset/slick-carousel

however Status report will complain, that slick is not found in /libraries/slick/slick, that is because the above installs to /libraries/slick-carousel/slick,
therefore edit the installer path in composer.json like below before installing slick

    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/slick": [
                "bower-asset/slick-carousel"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset",
                "vendor:npm-asset",
                "vendor:bower-asset"
            ],
...

It is important to insert the installer path for slick above web/libraries/{$name} so that the configuration to install to web/libraries/slick will be applied first.
Then can install

composer -W --ignore-platform-reqs require bower-asset/slick-carousel

Top

CKEditor plugin installation

See installer-paths for custom types first.
Drupal.org recommends setting up package repositories similar to slick library above for each CKEditor plugin that is needed.
Plugins can be searched/found at https://ckeditor.com/cke4/addons/plugins/all

The composer search function can also be used to search for some ckeditor plugins, this would follow best practices for composer install.

Composer.json can then be edited to include the example below in the repository section:

{
    "type": "package",
    "package": {
        "name": "ckeditor-plugin/fakeobjects",
        "version": "4.16.1",
        "type": "ckeditor-plugin",
        "dist": {
            "type": "zip"
        }
    }
}

Extras paths should be the following or else Status Report will complain they are not installed.

"extra": {
  "installer-paths": {
            "web/libraries/{$name}": [
                "type:drupal-library",
                "type:ckeditor-plugin"
            ],
  }
}

CKEditor Plugin Exceptions

Colorbox is one CK Editor plugin that potentially can not be found on https://ckeditor.com/cke4/addons/plugins/all

and had to installed with after setting up the bower-asset repository in composer.json

composer -W --ignore-platform-reqs require bower-asset/colorbox

Top

Troubleshooting

"Status Report complains that library that is installed is not found."
Make sure that you have followed directions to installer-paths for custom types first.
Default behavior for drupal-library types is to install to web/libraries/${name},
does ${name} match where Status Report expects to find? Follow slick library installation example to install to expected path.  Bower-asset libraries have their paths determined by the custome installer-path set for custom types.

Top

Known undeclared dependencies

modal_page requires blazy libary (see above)

entity_usage (require-dev) is a dependancy of UMD Terp

Top

Known issues

drupal/paragraphs_library was renamed to drupal/paragraphs-paragraphs_library sometime after 8.x-1.10

Top

Popular libraries available via bower-asset/npm-asset/packagist.org

Top

Terminus rsync

To sync large amounts of site files, the Terminus rysnc plugin is available if one has access to the server the site files are stored on. Info on Terminus is available here.

Top