Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mcdwayne
Last active November 27, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcdwayne/579139c1e7eda6de08c2ad0a63d88791 to your computer and use it in GitHub Desktop.
Save mcdwayne/579139c1e7eda6de08c2ad0a63d88791 to your computer and use it in GitHub Desktop.
Pantheon-WordPress-Nested-Docroot-Setup-Script - just change out the DEMOSITENAME-CHANGE-ME variable and set the install credentials.
#!/bin/bash
# name the site
# DEMOSITENAME-CHANGE-ME
# make a site on Pantheon
terminus site:create -- DEMOSITENAME-CHANGE-ME DEMOSITENAME-CHANGE-ME WordPress
# install WP
terminus wp DEMOSITENAME-CHANGE-ME.dev -- core install --url=dev.DEMOSITENAME-CHANGE-ME.pantheonsite.io --title=TITLE --admin_user=USER --admin_password=Password(not password though) --admin_email=EMAIL
# let's add WP-CFM and set theme to the best theme ever 2016!
terminus wp DEMOSITENAME-CHANGE-ME.dev -- plugin install wp-cfm --activate
terminus wp DEMOSITENAME-CHANGE-ME.dev -- theme activate twentysixteen
# Now, let's go ahead and set Pantheon to Git connection mode
terminus connection:set DEMOSITENAME-CHANGE-ME.dev git
# and let's store the git URL in a variable for later
GITURL=$(terminus connection:info DEMOSITENAME-CHANGE-ME.dev --field=git_url)
# let's clone down the repo where I like to put it
cd $HOME/Documents
git clone ${GITURL} DEMOSITENAME-CHANGE-ME
cd DEMOSITENAME-CHANGE-ME
# Let's edit the pantheon.yml to let is have a web docroot
echo "web_docroot: true" >> pantheon.yml
# and the other instructions from https://pantheon.io/docs/nested-docroot/
mkdir web
git mv -k $(find . -type f -maxdepth 1 | grep -v pantheon.yml) wp-includes wp-content wp-admin ./*.php web
# having done all that, let's add, commit and pus the dang thing
git add .
git commit -m 'converted to use docroot'
git push origin master
# and just for kicks, let's open the site in Firefox, but let's give the whole thing 15 seconds to sync
sleep 15s
open -a /Applications/Firefox.app https://dev-DEMOSITENAME-CHANGE-ME.pantheonsite.io/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment