Skip to content

Installation

Un.titled edited this page Apr 5, 2024 · 2 revisions

Requirements

  • DDev - This provides the local development environment
  • Node.js (min version 12.x)

Installation

  1. From the Pantheon dashboard, Under Un.titled Organization create a new site
  2. Once complete, visit the dashboard, hit Visit development site and install Drupal
    • Choose Use existing configuration on the profile selection screen
    • Set username to dp_admin, and email to [email protected], ensure a secure password is used
    • Make sure the credentials are saved to TClients
  3. Once installed, in the Pantheon dashboard set the site to run in Git mode
  4. Create a backup in the Pantheon dashboard (you can leave this running whilst you continue the next steps)
  5. Clone the repo to your local machine
  6. Change project name in .ddev/config.yaml & Run ddev start
  7. Once the container is running, run ddev composer install
  8. Edit ./.ddev/config.yaml L15 to contain your Terminus machine code, e.g:
web_environment: ['TERMINUS_MACHINE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx']
  1. Edit ./.ddev/providers/pantheon.yaml, updating the project name on L42, e.g.
project: <pantheon_site_name>.dev
  1. Run ddev restart
  2. Ensure your changes to ./.ddev/config.yaml aren't tracked in the repo, i.e.
git update-index --assume-unchanged .ddev/config.yaml
  1. Once complete, run ddev pull pantheon (Note: if you haven't run this elsewhere in your current session, you'll be prompted to run ddev auth ssh, this is a once per session task)
  2. Run ddev drush cr
  3. Update ./webpack.mix.js L10 to contain your local development url, e.g.
const hostname = '<site_name>.ddev.site'
  1. Add, commit & push all changes to the repo 🍻

Drush & composer

  • Using drush & composer commands via ddev is just a case of running ddev composer x or ddev drush y

Theming & local development

  • Replace the contents of ./web/sites/development.services.yml with:
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
  • Add the following lines to the top of ./web/sites/default/settings.ddev.php
$settings['container_yamls'][] =  DRUPAL_ROOT  .  '/sites/development.services.yml';
$config['system.performance']['css']['preprocess'] =  FALSE;
$config['system.performance']['js']['preprocess'] =  FALSE;
$settings['cache']['bins']['page'] =  'cache.backend.memory';
$settings['cache']['bins']['render'] =  'cache.backend.memory';
$settings['cache']['bins']['dynamic_page_cache'] =  'cache.backend.memory';
  • Run ddev drush cr to clear caches and allow the changes above to take effect

Theme build tools

  • Run npm i from the site root directory
  • Run npm start to begin local development
  • Run npm run-script production before adding/commiting/pushing to the repo