Create a Custom Upstream
Connect a remote repository to your Pantheon account and use it as a starting point for new sites.
Pantheon Custom Upstreams are a self-serve feature available to anyone with access to the Workspace with an eligible plan. Workspace members will be able to create new sites from a set common codebase after an Workspace Administrator creates a Custom Upstream. The Custom Upstream must be created within each Workspace if you want to use a specific Custom Upstream for multiple Workspaces.
Be aware that support for Custom Upstreams is limited to verification that the externally hosted upstream repository is connected to the platform correctly. For details, see Get Support.
Create and Host the Repository Remotely
This remote repository serves as the central location for the development and maintenance of your Custom Upstream. Changes are tracked here and distributed downstream to sites within your Organization as one-click updates in the Site Dashboard.
Follow the steps for your preferred Git host below to create your repository.
Sign up for a GitHub account if you do not have one already.
Create an SSH Key if you don't already have one associated with your GitHub account and add your SSH Key to GitHub.
Click Start Project if this is your first time logging in to GitHub. Otherwise click New in the Repositories sidebar on the left.
Name the repository.
Select whether the repository will be private or if it can be publicly accessible from outside your organization.
Do not select the options to create a
README
,.gitignore
, or license file:Info:NoteAs of October 1st, 2020, all new repositories on GitHub are initialized with the default branch name
main
.As a company, Pantheon is trying to use more inclusive language in our repositories. While our team works to make Custom Upstreams less reliant on older naming conventions, new Custom Upstreams currently default to using the
master
branch name.Click Create Repository.
Copy the repository URI (SSH) found in the Quick setup section:
Clone the repository to your local from the command line (replace the URI):
git clone [email protected]:pantheon-systems/custom-upstream.git
Navigate to the repository's root directory:
cd custom-upstream
Sign up for a Bitbucket account if you do not have one already.
Log in to Bitbucket and navigate to Repositories.
Click Create a Repository.
Name the repository.
Select whether the repository will be private or if it can be publicly accessible from outside your organization.
Select No from the dropdown menu for Include a README?.
Select No from the dropdown menu for Include .gitignore?.
Set the Default branch name to master
Info:NoteAs of January 27th, 2021, all new repositories on Bitbucket are initialized with
main
as the default branch name.Pantheon intends to remove harmful language from our code and documentation. Please refer to our documentation on more inclusive language in our repositories for more information.
As we strive to make Custom Upstreams less reliant on older naming conventions, new Custom Upstreams currently default to using the
master
branch name.Please note that Git's default naming convention differs from GitHub's. If you do not initialize the repository on Bitbucket, Git will assign the default branch name as
master
when you clone the repository locally.Click Create Repository.
Copy the repository URL (HTTPS), found on the top right of the page:
Clone the repository to your local from the command line (replace the URL):
git clone https://[email protected]/pantheondocs/agency-custom-upstream.git
Navigate to the repository's root directory:
cd agency-custom-upstream
You can sign up for a GitLab.com account, or use a self-managed GitLab installation.
Navigate to your GitLab dashboard and click New project.
Provide a Project name, set the Visibility Level, make sure
Initialize repository with a README
is not checked, and then click Create project.Copy the repository URL (HTTPS) and then clone the site locally:
git clone https://gitlab.com/pantheondocs/agency-custom-upstream.git
cd
into the project directory:cd agency-custom-upstream
Other Git hosting providers (like Azure DevOps or a self-hosted Bitbucket server) can be used, but we cannot detail specific instructions for every provider. You must create a new project in that system.
As detailed below, Pantheon Support must add this Custom Upstream for you from a support ticket.
Pull in Core from Pantheon's Upstream
You must track Pantheon's corresponding upstream repository within the Custom Upstream to avoid incompatibilities.
Navigate to the Custom Upstream's root directory using the command line and add the appropriate Pantheon Upstream as a remote:
git remote add pantheon-wordpress https://github.com/pantheon-systems/WordPress.git
git remote add pantheon-wordpress https://github.com/pantheon-upstreams/wordpress-composer-managed.git
git remote add pantheon-drupal https://github.com/pantheon-upstreams/drupal-11-composer-managed.git
Info:NoteThis repository is a "start state" upstream, and should only be used during the initial clone when creating your Custom Upstream. If you have already created your Custom Upstream, use the repository below to merge in any updates from Pantheon:
git remote add pantheon-updates https://github.com/pantheon-upstreams/drupal-composer-managed.git
git remote add pantheon-drops-7 https://github.com/pantheon-systems/drops-7.git
Run the appropriate command below now that the Custom Upstream repository is tracking the corresponding Pantheon core upstream.
git checkout -b master git fetch pantheon-wordpress git merge pantheon-wordpress/master git push origin master
git checkout -b master git fetch pantheon-wordpress main git merge pantheon-wordpress/main git push origin master
Pull and commit the core files:
git checkout -b master git fetch pantheon-drupal main git merge pantheon-drupal/main git push origin master
- The latest version of Drupal on Pantheon includes Integrated Composer to manage dependencies. This adds a separate
composer.json
file in theupstream-configuration
directory.
- The latest version of Drupal on Pantheon includes Integrated Composer to manage dependencies. This adds a separate
Change to the
composer.json
file in theupstream-configuration
directory and usecomposer require
to add packages to the Upstream, then set theconfig version
to a number that makes sense for you:cd upstream-configuration composer require drupal/pkg-name --no-update
- Note that the optional
--no-update
flag in this command should only be used in Upstreams (as we do here) to instruct Composer not to check for updates now. See How to Add Dependencies to Your Upstream for more information about adding dependencies.
- Note that the optional
Commit and push the changes:
git commit -am "added composer dependencies" git push origin master
git checkout -b master git fetch pantheon-drops-7 git merge pantheon-drops-7/master git push origin master
Connect Repository to Pantheon
Go to the workspace where you want to add the upstream.
Select the Upstreams tab.
Click the Add New Upstream button. You must be an Organization Administrator to add a new upstream.
Enter the following information about the Custom Upstream:
Name
Upstream Repository URL:
Authenticate (private repositories only): If you provided the URL to a private repository, a new field will appear:
For privately hosted repositories, create a dedicated user with repository access. If your repository is publicly accessible, you can skip this step.
Click Generate new token.
Confirm your password if prompted.
Enter a token description, such as "pantheon read my Custom Upstream"
Select "repo" as the scope:
Click Generate token and copy the new token to your clipboard.
Return to the workspace where you are creating the Custom Upstream.
Paste your new GitHub access token.
Framework: Drupal 7, Drupal (Latest), or WordPress
Description: (Optional) Less than 200 characters, plain text and markdown supported
Click Create.
Go to the workspace where you want to add the upstream.
Select the Upstreams tab.
Click the Add New Upstream button. You must be an administrator of the organization to add a new upstream.
Enter the following information about the Custom Upstream:
Name
Upstream Repository URL:
Authenticate (private repositories only): If you provided the URL to a private repository, a new field will appear:
For privately hosted repositories, create a dedicated user with repository access. If your repository is publicly accessible, you can skip this step.
Go to Bitbucket to generate an app password.
Click Create app password.
Enter a label and select the
"Repositories:Read"
permission:Click Create and copy the new password.
Return to the workspace where you are creating the Custom Upstream.
Paste your new Bitbucket app password. The username field should already be populated based on the repository URL.
Framework: Drupal 7, Drupal (Latest), or WordPress
Description: (Optional) Less than 200 characters, plain text and markdown supported
Click Create.
A Custom Upstream from a GitLab repository must be set up for you by Pantheon Support.
Navigate to the repository, click Settings, and then select Repository.
Click Expand next to Deploy Tokens and fill out the fields:
- Name: Used to identify the token in GitLab.
- Expires at: We recommend leaving this blank. If the token expires, you will need to create a new one and contact Pantheon Support again to update it.
- Username: We suggest setting a custom username to provide to Pantheon Support.
- Select the read_repository scope for the token.
Click Create deploy token and save the token immediately to provide to Pantheon Support. GitLab will not show it again.
Contact support to add the Custom Upstream to your org. You must provide:
- A name for the Custom Upstream,
- The
https
clone URL (ending in.git
), - The Username and Access Token for the deploy token.
Custom Upstreams from other repository hosts must be created for you by Pantheon Support.
Common steps needed for most Git Providers are provided below.
Prepare a new user specifically for Pantheon access.
- This new account will need to be accessible via API for Pantheon, it must also have access to the repository created in the earlier step.
Contact support to add the Custom Upstream to your org. You must provide:
A name for the Custom Upstream
The CMS within (WordPress, Drupal)
The
https
clone URL (ending in.git
)The username and Access Token for the new user
The name of the branch to be used by Pantheon (usually
master
)
Initial Connection Mode
The default connection mode for new sites created from a Custom Upstream is Git for WordPress and Drupal. The latest version of Drupal defaults to SFTP connection mode.
Configure this setting after connecting your Custom Upstream to Pantheon if new sites need to use an initial connection mode other than the default:
Navigate to the Organizations tab within the Pantheon Dashboard and select your organization.
Select the Upstreams tab.
Click Settings next to the existing upstream requiring an update.
- Enter a username and a password or token if prompted to authenticate your repository (this only applies to privately hosted repositories). Access tokens must be alpha-numeric and cannot contain symbols.
Select if Git or SFTP mode should be enabled by default and then click Update. New sites created from this Custom Upstream will use this connection mode by default going forward.