Skip to content

Drupal 9+ Development Workflow via Pantheon

Install Terminus

Terminus is the cli to interact with Pantheon.

Terminus, Pantheon and Lando

terminus auth:login --machine-token=your_token
terminus auth:login --email=[email protected]

terminus site:list

terminus remote:drush your-site-name.dev -- cr
terminus remote:drush your-site-name.dev -- cim
terminus remote:drush your-site-name.dev -- cim \
  --partial --source=../local-dev-scripts/partial-config/ -y
terminus remote:drush your-site-name.dev -- updb
terminus remote:drush your-site-name.dev -- cr

terminus remote:drush your-site-name.test -- cr
terminus remote:drush your-site-name.test -- cim
terminus remote:drush your-site-name.test -- cim \
  --partial --source=../local-dev-scripts/partial-config/ -y
terminus remote:drush your-site-name.test -- updb
terminus remote:drush your-site-name.test -- cr

## Multidev creation
# Create
terminus multidev:create -- your-site-name.dev newbranch
# Switch
lando switch
# Delete
terminus multidev:delete your-site-name.newbranch --delete-branch

# Toggle between SFTP/git modes
terminus connection:set your-site-name.dev sftp
terminus connection:set your-site-name.dev git

# Backup
terminus backup:create your-site-name.dev --element all --keep-for 180
terminus backup:create your-site-name.test --element all --keep-for 180

# Pull everything from Pantheon dev
lando pull --code dev --database dev --files dev
lando composer install
lando drush cr

# Pull only code and files from Pantheon dev
lando pull --code dev --database none --files dev
lando composer install
lando drush updb
lando drush cr

Develop at Pantheon Directly (SFTP Mode)

Work on Dev Site Directly

  1. Go to dev env
  2. Select SFTP mode (on-site development must be in SFTP mode) terminus connection:set your-site-name.dev sftp
  3. Visit dev site as admin user
  4. Do configuration changes on the dev site (For example create a new vocabulary or content type)
  5. Go to terminal and run terminus remote:drush your-site-name.dev -- cex to export your config as code
  6. Go to Pantheon dev env site and select 'Code' from the left menu
  7. Commit your changes directly on the page.

Deploy to test

  1. Go to test env and select 'Deploys' from the left menu
  2. Write deploy message and select all checkboxes and deploy
  3. Go to terminal and run terminus remote:drush your-site-name.test -- cim, terminus remote:drush your-site-name.test -- updb and terminus remote:drush your-site-name.test -- cr
terminus remote:drush your-site-name.test -- cim -y
terminus remote:drush your-site-name.test -- updb -y
terminus remote:drush your-site-name.test -- cr

Pull database and files from test to dev

  1. Back up both dev ve test environments before proceeding. Run terminus backup:create your-site-name.dev --element all --keep-for 180 and terminus backup:create your-site-name.test --element all --keep-for 180
  2. Go to dev env and select 'Database / Files' from the left menu
  3. From this environment = Test, select all checkboxes and click Clone the Database & the Files from Test into the Development Environment button
  4. Go to terminal and run terminus remote:drush your-site-name.dev -- cim, terminus remote:drush your-site-name.dev -- updb and terminus remote:drush your-site-name.dev -- cr
terminus remote:drush your-site-name.dev -- cim -y
terminus remote:drush your-site-name.dev -- updb -y
terminus remote:drush your-site-name.dev -- cr

Develop at Local/Multidev (git Mode)

terminus auth:login --machine-token=your_token
terminus auth:login --email=[email protected]
terminus connection:set your-site-name.dev git
lando start

# full_dev.sh muadili
lando switch # select dev
# or
lando pull --code dev --database dev --files dev

# create topic branch
# branch name is limited to 11 characters
terminus multidev:create -- your-site-name.dev newbranch

# lock the url of new branch either via pantheon dashboard
# see image below
# or via the command below
# wait for worklows on pantheon dashboard to finish
terminus lock:enable your-site-name.newbranch bikalite bikalite

lando switch # select the new branch on the terminal
lando composer install
lando drush cim -y
lando drush updb -y
lando drush cr

# https://your-site-name.lndo.site/

# do the work
lando drush cex
git add .
git commit -m "Add your message here"
git push

# wait for workflow finish on pantheon dashboard see picture
terminus remote:drush your-site-name.testx -- cr
terminus remote:drush your-site-name.testx -- cim -y
terminus remote:drush your-site-name.testx -- updb -y
terminus remote:drush your-site-name.testx -- cr

# merge to dev from branch/multidev if you want on pantheon dashboard
# ask burak to merge your branch to dev
# wait for worklows

terminus remote:drush your-site-name.dev -- cim -y
terminus remote:drush your-site-name.dev -- updb -y
terminus remote:drush your-site-name.dev -- cr

# control changes on dev website

terminus multidev:delete your-site-name.testx --delete-branch

Security (Lock Environment) Screenshot

lock

panteon dashboard

merge

Backup

# Switch to git mode
terminus connection:set your-site-name.dev git

# Backup
terminus backup:create your-site-name.dev --element all --keep-for 180
terminus backup:create your-site-name.test --element all --keep-for 180

Watch Workflows

terminus workflow:watch your-site-name

Deploy code from dev to test

terminus env:deploy \
  --note "Enable views.view.urun_duzenleme" \
  --updatedb -- your-site-name.test
terminus env:deploy \
  --note "Update drupal/core (9.3.9) to (9.3.12) and drupal/paragraphs (1.13.0) to (1.14.0)" \
  --updatedb -- your-site-name.test

# After each deploy do not forget to apply regular procedures
terminus remote:drush your-site-name.test -- cim -y
terminus remote:drush your-site-name.test -- updb -y
terminus remote:drush your-site-name.test -- cr

Clone Content From Test to Dev

# It is better to backup both environments prior to clone content
terminus backup:create your-site-name.dev --element all --keep-for 180
terminus backup:create your-site-name.test --element all --keep-for 180

# Clone content
terminus env:clone-content --cc --updatedb -- your-site-name.test dev

# Do the tricks
terminus remote:drush your-site-name.dev -- cim -y
terminus remote:drush your-site-name.dev -- updb -y
terminus remote:drush your-site-name.dev -- cr