pantheon-systems / terminus-build-tools-plugin

Manage multidev environments for a Pantheon site using a GitHub PR workflow.
83 stars 68 forks source link

Create Pattern for adding local environment to build tools site #384

Open aweingarten opened 3 years ago

aweingarten commented 3 years ago

Once I have created a project with build tools its really hard to set up a local environment. If I try lando init

I see

Whoooops! Looks like you've already got a git repo here!
Either delete this repo or try to lando init in a folder without .git in it
eddiegeis commented 3 years ago

The Example WordPress Composer repo readme has a section for Working locally with Lando. I have copied the steps on the readme below with some additional notes on what I needed to do to get this to work with WordPress. I assume Drupal would be similar.

  1. Install Lando, if not already installed.
  2. Clone your project repository from GitHub (or GitLab or BitBucket) locally.
  3. Manually create a .lando.yml file with your preferred configuration, based on the WordPress recipe.
    • To get this to work with the build tools, I used the following .lando.yml using the pantheon recipe instead.
      name: [pantheon-site-name]
      recipe: pantheon
      config:
      framework: wordpress
      site: [pantheon-site-name]
      id: [pantheon-site-id]
      composer_version: '1.10.20'
  4. Run lando start to start Lando.
    • Save the local site URL. It should be similar to https://<PROJECT_NAME>.lndo.site.
  5. Run lando composer install --no-ansi --no-interaction --optimize-autoloader --no-progress to download dependencies
    • I received an error when running this command that is centered around the commands located at /scripts/composer/cleanup-composer . To get the lando site working, I manually completed the steps in those commands.
      1. Copy contents of web/wp/wp-content/mu-plugins/ to web/wp-content/mu-plugins/
      2. Delete file web/wp/wp-config.php
      3. Delete folder web/wp/wp-content
  6. Run lando pull --code=none to download the media files and database from Pantheon.
  7. Visit the local site URL saved from above.