Skip to content

Commit 28573af

Browse files
committed
docs: add docs for pantheon deployment workflow
1 parent 914f7d1 commit 28573af

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed
10.8 KB
Loading

docs/deployment.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,59 @@
1-
Deployment
2-
============================
1+
# Deployment
32

4-
**TBD**
3+
## Pantheon
4+
5+
This repo includes a [Github workflow for deployment to Pantheon](../.github/workflows/deploy.pantheon.yml).
6+
When enabled and configurated, this workflow will deploy to Pantheon when commits are added to the `main` branch. This workflow is disabled by default. See instructions below for configuration.
7+
8+
### Deployment workflow
9+
Pantheon maintains its own git remote containing the WordPress core files. To deploy, we:
10+
1. Build our theme artifacts
11+
1. Fetch the Pantheon remote repo
12+
1. Copy our theme artifacts into the appropriate locations in the Pantheon codebase
13+
1. Commit the changes to the Pantheon repo
14+
1. Push to the Pantheon remote
15+
16+
### Site setup
17+
18+
1. See these instructions to [add a site to your Pantheon account](https://docs.pantheon.io/guides/getstarted/addsite).
19+
1. Visit your Pantheon [site dashboard](https://docs.pantheon.io/guides/account-mgmt/workspace-sites-teams/sites#site-dashboard) and make sure your site's Development Mode is set to Git (it will likely be set to SFTP by default).
20+
![Pantheon Development Mode](_assets/pantheon-development-mode.png)
21+
1. Click the "Clone with Git" button, follow the instructions to clone the repo locally.
22+
1. In the cloned repo, open the `wp-config.php` file.
23+
1. At the top of the file, directly under the `<?php` line, add this line:
24+
- `require __DIR__ . '/vendor/autoload.php';`
25+
- This allows the Pantheon site to autoload our vendor dependencies.
26+
1. Commit the changes to this file.
27+
1. Push the commit to Pantheon's `master` branch.
28+
### Deployment configuration
29+
30+
Deployment to Pantheon requires setting the following variables and secrets in Github. See these instructions for creating [variables](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) and [secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository).
31+
32+
#### Variables
33+
34+
- `DEPLOY_TO_PANTHEON`: set the value to `true` in order to enable deployment
35+
#### Secrets
36+
37+
- `PANTHEON_ID_RSA` - The **private** ssh key that will be used to connect to Pantheon. See instructions for [generating an ssh key](https://docs.pantheon.io/ssh-keys#generate-an-ssh-key).
38+
- `PRODUCTION_REPO` - The address of the Pantheon remote repo. See instructions below for [obtaining the value](#obtaining-production_repo-value).
39+
- `PRODUCTION_USER_EMAIL` - The email address that will be used for deployment commit messages.
40+
- `PRODUCTION_USER_NAME` - The username that will be used for deployment commit messages.
41+
- `KNOWN_HOSTS` - Required in order to authenticate with Pantheon. See instructions below for [obtaining the value](#obtaining-known_hosts-value).
42+
43+
#### Obtaining `PRODUCTION_REPO` value
44+
45+
1. Visit your Pantheon [site dashboard](https://docs.pantheon.io/guides/account-mgmt/workspace-sites-teams/sites#site-dashboard).
46+
1. In the "Development Mode" section, click "Clone with git" and copy the value.
47+
![Pantheon Development Mode](_assets/pantheon-development-mode.png)
48+
1. Extract the server address from the copied value. It will have the format `ssh://*.git`. Use this as the value for `PRODUCTION_REPO`.
49+
50+
#### Obtaining `KNOWN_HOSTS` value
51+
1. First, follow the instructions for generating an ssh key and obtaining the `PRODUCTION_REPO` values. You will use both of these to SSH into the Pantheon remote server to obtain the `KNOWN_HOSTS` value.
52+
1. Ensure that the ssh key generated from step 1 is added to your local ssh agent by running:
53+
- `ssh-add ~/.ssh/id_rsa` (replace `id_rsa` with your key name)
54+
1. SSH into the Pantheon server. The server address is a modified version of the `PRODUCTION_REPO` value, removing `/~/repository.git` from the end. The ssh command will look like this:
55+
- `ssh ssh://<SERVER_ADDRESS>.drush.in:2222`, where `<SERVER_ADDRESS>` is a unique value for your site.
56+
1. After running the above command, you should be prompted to accept the server's fingerprint. Type `yes` and press enter.
57+
1. This will add an entry into your `~/.ssh/known_hosts` file. You will likely see a message that `shell request failed on channel 0`, this can be ignored.
58+
1. Open the file at `~/.ssh/known_hosts`.
59+
1. In the file, locate the line that contains a server address matching `PRODUCTION_REPO`. Copy this entire line and use it as the value for `KNOWN_HOSTS`.

0 commit comments

Comments
 (0)