This section provides information on how to create and configure a site, and initialize your environments with Terminus, which allows you to call WP-CLI remotely without using a local installation.
Be sure that you:
- Are familiar with your operating system's command line.
- Are using a Unix-based system (Linux or Mac OS X). Windows commands may vary slightly.
- Have already created a Pantheon account. Pantheon accounts are always free for development.
Terminus provides advanced interaction with the platform and allows you to run WP-CLI commands remotely. Terminus allows you to automate parts of your workflow by combining multiple operations. Refer to the Terminus Guide for more information.
Install Terminus within the
mkdir $HOME/terminus cd $HOME/terminus curl -O https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar && php installer.phar install
Use the Machine token to authenticate Terminus:
terminus auth:login --machine-token=‹machine-token›
Verify your session after the installation is complete:
The installation and authentication were successful if you can see your Pantheon sites.
The next sections use the example variables
"Terminus Demo Site" as the site name and label. Make sure you replace each instance, as well as other variables like the site URL and user/password combinations, with your own values.
Create a new WordPress site on Pantheon:
terminus site:create tessa-site-wp "Terminus Demo Site" WordPress
--orgoption to the command above and pass the Workspace name, label, or ID if you want to associate this site with an Workspace.
site:org:addcommand to associate an existing site with an Workspace.
Open your new Site Dashboard in a browser:
terminus dashboard:view tessa-site-wp
Keep this window open to see the changes you are making in Terminus appear almost immediately in your Site Dashboard.
Retrieve the platform domain for the Dev environment:
terminus env:info tessa-site-wp.dev --field=domain
You'll need this information to fill out the
--urloption in the next step.
Use the WP-CLI
core installcommand to install WordPress on the Dev environment:
terminus wp tessa-site-wp.dev -- core install --url=https://dev-tessa-site-wp.pantheonsite.io --title="Terminus Demo Site" --admin_user=admin --admin_password=changemelater --admin_email=[email protected]
As a reminder, WP-CLI is the command line utility for WordPress itself. Terminus is simply passing through the WP-CLI commands to the site on Pantheon. Run the command below to get a full list of WP-CLI commands:
terminus wp tessa-site-wp.dev -- help
--signifies the end of the Terminus options, anything after
--is passed straight to WP-CLI.
Create the Test environment:
terminus env:deploy tessa-site-wp.test --updatedb --note="Initialize the Test environment"
Create the Live environment:
terminus env:deploy tessa-site-wp.live --updatedb --note="Initialize the Live environment"
Export your site name as a variable to avoid the need to copy/paste the remainder of your commands:
This sets an environment variable named
$TERMINUS_SITEwith the value
tessa-site-wp. Anytime you use the variable name it's replaced in the executed command with the variable value.
Echo your variable to test that it works correctly:
You can now copy and paste the remainder of these commands without replacing the site name now that the commands use the
Run the command below to get the connection information for the Dev environment:
terminus connection:info $TERMINUS_SITE.dev
Terminus provides the power to manage most aspects of your Pantheon sites. Tools such as WP-CLI (and Drush for Drupal) give you the power to manage the inner workings of your WordPress-powered site. Now you're ready to take the Sandbox site you've setup and explore on your own to see what else is possible.