Create a new Drupal 8 site on Pantheon with a Composer-Based Workflow

Thia is an old article, borrowed from an email sent in the Pantheon power-users email group.

For the most up to date info, see https://pantheon.io/docs/guides/drupal-8-composer-no-ci/


 

  • make a variable for your new site machine name to allow all of the following instructions to be copy/paste.
    export TERMINUS_SITE=steve-d8-manual-composer
     
  • Create a new site with Terminus and put it in git mode
    terminus site:create $TERMINUS_SITE "My Composer-Managed D8 site" "empty"
    terminus connection:set $TERMINUS_SITE.dev git
     
  • We're using the "empty" upstream here because we specifically don't want the dashboard prompting us to merge in the git-based core updates. We're using Composer to update core.
     
  • Make a local copy of example-drops-8-composer
    composer create-project pantheon-systems/example-drops-8-composer:dev-master $TERMINUS_SITE
     
  • Initialize a git repo in the local copy of example-drops-8-composer if you didn't keep the existing git history when running composer create-project
    cd $TERMINUS_SITE && git init
     
  • Add the Pantheon site as a remote and fetch
    git remote add origin $(terminus connection:info $TERMINUS_SITE.dev --field=git_url)
     
  • Remove any git directories within dependencies so that they are not added as submodules
    composer prepare-for-pantheon
     
  • Add, commit, push
    git add .
    git commit -m 'Initial commit'
    git push --set-upstream origin master --force
     
  • Put the site back in SFTP mode so that the settings.php file is writable during installation.
    terminus connection:set $TERMINUS_SITE.dev sftp
     
  • Install Drupal
    terminus drush $TERMINUS_SITE.dev -- site-install -y
     
  • Commit the settings.php change
  • terminus env:commit $TERMINUS_SITE.dev --message="Installing Drupal"


 

  • Log in to your site and appreciate the splendor of Drupal core
    terminus drush $TERMINUS_SITE.dev -- user-login
     
  • Export your config to yml files
    terminus drush $TERMINUS_SITE.dev -- config-export -y
     
  • Commit those too
    terminus env:commit $TERMINUS_SITE.dev --message="Config from standard profile of Drupal"
     
  • Pull down your code changes
    git pull
     
  • Go forth with your Composer-managed site!

There is also "terminus build:project:create" which is meant for setting up the GitHub -> CircleCI -> Pantheon workflow.

Internal References

External References

Article Type

General