Your Site Code on Pantheon

Learn how to work with your site's code on the Pantheon Dashboard.


The Code tool within the Pantheon Dashboard on any environment allows you to interact with your site's code and review the commit log.

Pantheon Git Repository

Your site's code repository includes your entire codebase, including core Drupal or WordPress, and any contributed modules, plugins, themes, installation profiles, libraries, etc. It does not include the files/ directory (e.g. sites/default/files or wp-content/uploads) and should not contain any other static assets that you do not want tracked in version control.

Drupal Code Structure

Drupal site code repositories are clones of one of our Drupal upstreams: Drops-7, or Drops-8, and consist of the following files and directories:

├── includes
├── index.php
├── misc
├── modules
├── profiles
├── scripts
├── sites
    └── all
       ├── modules
       └── themes
    └── default
       └── settings.php
└── themes

Note

The sites/default/files directory is represented in your code repository as a symbolic link to the Pantheon environment's files/ directory.

WordPress Code Structure

WordPress site code repositories are clones of one our WordPress upstream, and consist of the following files and directories:

├── index.php
├── wp-activate.php
├── wp-config.php
├── wp-comments-post.php
├── wp-blog-header.php
├── wp-admin
├── wp-cron.php
├── wp-load.php
├── wp-links-opml.php
├── wp-includes
├── xmlrpc.php
├── wp-trackback.php
├── wp-signup.php
├── wp-settings.php
├── wp-mail.php
├── wp-login.php
├── wp-content
    ├── index.php
    ├── mu-plugins
    ├── themes
    ├── plugins

Note

The wp-content/uploads directory is represented in your code repository as a symbolic link to the Pantheon environment's files/ directory.

Managing Permissions

Permissions should be managed in the Dev environment via SFTP exclusively, as Git only pays attention to the executable bit.

You can set the site's connection mode to git or SFTP and access connection information from within the Dev environment's Code tool. This is also where all changes to the site's codebase (located in the /code directory) are committed. Code Workflow Dev SFTP Commit

You can also view the diff output for each individual file:

Diff output

Upstream Updates

The Dev environment provides one-click updates for your site's upstream. Updates will appear in the Code tool once they are committed to the upstream repository.

Upstream
A code repository that serves as a common package for your web application.

Repository
Centralized location of code intended for distribution.

Development

Get started by learning more about the Pantheon workflow and environment configuration. Then, dive in to developing directly with SFTP mode and explore more ways of utilizing built-in admin tools.

.gitignore

Pantheon provides a default .gitignore file in the base of each site's code repository and in sites/default/files. You can use this file to exclude directories from version control and backups.

Performance

There are a lot of tools at your disposal when it comes to fine tuning dynamic sites. Resolve issues by debugging slow performance and utilizing the PHP slow log.

Learn how to use bots and indexing in a way that does not negatively impact performance. You can also incorporate external Solr services with IndexDepot.

See Also