Skip to content

Imagine Lexington Project for the City of Lexington, Kentucky

License

Notifications You must be signed in to change notification settings

lfucg/imagine-lex

Repository files navigation

Example Drops 8 Composer

CircleCI Pantheon example-drops-8-composer Dev Site example-drops-8-composer

This repository is a start state for a Composer-based Drupal workflow with Pantheon. It is meant to be copied by the the Terminus Build Tools Plugin which will set up for you a brand new

  • GitHub repo
  • Free Pantheon sandbox site
  • A CircleCI configuration to run tests and push from the source repo (GitHub) to Pantheon.

For more background information on this style of workflow, see the Pantheon documentation.

Important files and directories

/web

Pantheon will serve the site from the /web subdirectory due to the configuration in pantheon.yml, facilitating a Composer based workflow. Having your website in this subdirectory also allows for tests, scripts, and other files related to your project to be stored in your repo without polluting your web document root.

/config

One of the directories moved to the git root is /config. This directory holds Drupal's .yml configuration files. In more traditional repo structure these files would live at /sites/default/config/. Thanks to this line in settings.php, the config is moved entirely outside of the web root.

Updating your site

When using this repository to manage your Drupal site, you will no longer use the Pantheon dashboard to update your Drupal version. Instead, you will manage your updates using Composer. Ensure your site is in Git mode, clone it locally, and then run composer commands from there. Commit and push your files back up to Pantheon as usual.

Local Development

Copying Codebase and setting up remotes to Pantheon and Github

We will keep the Github repo for Imagine Lexington and the Pantheon codebase in sync and therefore will need two remote urls for this project locally. Refer to the documentation on Pantheon to help with setting that up.

Development will go through Github for feature branches and pull requests, then code, can be sent up to Pantheon's dev environment after merged into Github.

Lando

Local development requires the use of Lando. Specifically, version v3.0.0-beta.47 was used for set up of this build. The specific version is the latest stable release of the software and can be found on Github.

local.settings.php

Create a local.settings.php in /sites/default/ (which is ignored by git).

It should include:

if (getenv('LANDO') === 'ON') {
  $lando_info = json_decode(getenv('LANDO_INFO'), TRUE);
  $settings['trusted_host_patterns'] = ['.*'];
  $settings['hash_salt'] = md5(getenv('LANDO_HOST_IP'));
  $databases['default']['default'] = [
    'driver' => 'mysql',
    'database' => $lando_info['database']['creds']['database'],
    'username' => $lando_info['database']['creds']['user'],
    'password' => $lando_info['database']['creds']['password'],
    'host' => $lando_info['database']['internal_connection']['host'],
    'port' => $lando_info['database']['internal_connection']['port'],
  ];
}

drush and lando issues

(JOSH) Drush was not executing correctly for me so I followed the steps from this comment on a thread in Github for Lando Issues.

Additionally I had to chmod to 755, the drush directory in that usr/local/bin location.

development.services.yml

If you want to turn twig debugging on and cache off be sure to make your development.services.yml look like this:

parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
    debug: true
    auto_reload: true
    cache: false
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory

(NOTE: This can slow local page maneuvering down quite a bit. So disble the debug and turn cache back on if you want to speed things up a little bit.)

Getting started

Lando will use the .lando.yml file to set up your local environment. A simple lando start and then a lando pull should connect you to the Pantheon build.

You may have to generate a machine token for Lando on Pantheon. To do so go to Pantheon Dashboard --> Account --> Machine Tokens to generate a token for the Lando Machine. Run terminus auth:login --machine-token=<token> to authenticate the local development machine. Then run lando pull.

Before importing any content

Visit www.mysite.com/imce and upload all images for heros and icons to [content_type_machine_name]/images/. Naming is very important.

Content Import order (number in parentheses designates number of total content after import)

  1. Taxonomy Terms (3 different vocabularies)
  2. Goals (21)
  3. Objectives (84)
  4. Policies (222)
  5. Pillars (237)
  6. Themes (242)
  7. Dev Types (250)
  8. Place Types (257)
  9. Criteria (347)
  10. General Page (354)