You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2024. It is now read-only.
[](http://dev-example-drops-8-composer.pantheonsite.io/)
8
6
9
-
## Overview
10
-
11
-
This project contains only the canonical resources used to build a Drupal site for use on Pantheon. There are two different ways that it can be used:
7
+
This repository is a start state for a Composer-based Drupal workflow with Pantheon. It is meant to be copied by the the [Terminus Build Tools Plugin](https://github.com/pantheon-systems/terminus-build-tools-plugin) which will set up for you a brand new
12
8
13
-
- Create a separate canonical repository on GitHub; maintain using a pull request workflow. **RECOMMENDED**
14
-
- Build the full Drupal site and then install it on Pantheon; maintain using `terminus composer` and on-server development.
9
+
* GitHub repo
10
+
* Free Pantheon sandbox site
11
+
* A CircleCI configuration to run tests and push from the source repo (GitHub) to Pantheon.
15
12
16
-
The setup instructions vary based on which of these options you select.
13
+
For more background information on this style of workflow, see the [Pantheon documentation](https://pantheon.io/docs/guides/github-pull-requests/).
17
14
18
-
## Pull Request Workflow
19
15
20
-
When using a pull request workflow, only the canonical resources (code, configuration, etc.) exists in the master repository, stored on GitHub. A build step is used to create the full Drupal site and automatically deploy it to Pantheon. This is the recommended way to use this project.
16
+
## Installation
21
17
22
-
### Setup
18
+
### Prerequisites
23
19
24
-
For setup instructions, please see [Using GitHub Pull Requests with Composer and Drupal 8](https://pantheon.io/docs/guides/github-pull-requests/).
20
+
Before running the `terminus build:project:create` command, make sure you have all of the prerequisites:
* An account with GitHub and an authentication token capable of creating new repos.
26
+
* An account with CircleCI and an authentication token.
27
27
28
-
The [Terminus Build Tools Plugin](https://github.com/pantheon-systems/terminus-build-tools-plugin) automatically configures Circle CI to build your site. The following environment variables are defined:
28
+
You may find it easier to export the GitHub and CircleCI tokens as variables on your command line where the Build Tools Plugin can detect them automatically:
29
29
30
-
- TERMINUS_TOKEN: The Terminus Machine token previously created.
31
-
- GITHUB_TOKEN: Used by CircleCI to post comments on pull requests.
32
-
- TERMINUS_SITE: The name of the Pantheon site that will be used to test your site.
33
-
- TEST_SITE_NAME: Used to set the name of the test site when installing Drupal.
34
-
- ADMIN_EMAIL: Used to configure the email address to use when installing Drupal.
35
-
- ADMIN_PASSWORD: Used to set the password for the uid 1 user during site installation.
36
-
- GIT_EMAIL: Used to configure the git user’s email address for commits we make.
30
+
```
31
+
export GITHUB_TOKEN=[REDACTED]
32
+
export CIRCLE_TOKEN=[REDACTED]
33
+
```
37
34
38
-
If you need to modify any of these values, you may do so in the [Circle CI Environment Variable](https://circleci.com/docs/1.0/environment-variables/) configuration page.
35
+
### One command setup:
39
36
40
-
### SSH Keys
37
+
Once you have all of the prerequisites in place, you can create your copy of this repo with one command:
41
38
42
-
A [public/private key pair](https://pantheon.io/docs/ssh-keys/) is created and added to Circle CI (the private key) and the Pantheon site (the public key). If you need to update your public key, you may do so with Terminus:
This project can also be used to do traditional "standalone" development on Pantheon using on-server development. In this mode, the canonical repository is immediately built out into a full Drupal site, and the results are committed to the Pantheon repository. Thereafter, no canoncial repository is used; all development will be done exclusively using the Pantheon database.
45
+
* The name of the source repo, `pantheon-systems/example-drops-8-composer`. If you are interest in other source repos like WordPress, see the [Terminus Build Tools Plugin](https://github.com/pantheon-systems/terminus-build-tools-plugin).
46
+
* The machine name to be used by both the soon-to-be-created Pantheon site and GitHub repo. Change `my-new-site` to something meaningful for you.
47
+
* The `--team` flag is optional and refers to a Pantheon organization. Pantheon organizations are often web development agencies or Universities. Setting this parameter causes the newly created site to go within the given organization. Run the Terminus command `terminus org:list` to see the organizations you are a member of. There might not be any.
50
48
51
-
When doing "standalone" development, this project can either be used as an upstream repository, or it can be set up manually. The instructions for doing either follows in the section below.
52
49
53
-
### As an Upstream
50
+
##Important files and directories
54
51
55
-
Create a custom upstream for this project following the instructions in the [Pantheon Custom Upstream documentation](https://pantheon.io/docs/custom-upstream/). When you do this, Pantheon will automatically run composer install to populate the web and vendor directories each time you create a site.
52
+
### `/web`
56
53
57
-
### Manual Setup
54
+
Pantheon will serve the site from the `/web` subdirectory due to the configuration in `pantheon.yml`, facilitating a Composer based workflow. Having your website in this subdirectory also allows for tests, scripts, and other files related to your project to be stored in your repo without polluting your web document root.
58
55
59
-
Enter the commands below to create a a new site on Pantheon and push a copy of this project up to it.
60
-
```
61
-
$ SITE="my-site"
62
-
$ terminus site:create $SITE "My Site" "Drupal 8" --org="My Team"
Replace my-site with the name that you gave your Pantheon site. Customize the parameters of the `site:create` and `site-install` lines to suit.
56
+
#### `/config`
57
+
58
+
One of the directories moved to the git root is `/config`. This directory holds Drupal's `.yml` configuration files. In more traditional repo structure these files would live at `/sites/default/config/`. Thanks to [this line in `settings.php`](https://github.com/pantheon-systems/example-drops-8-composer/blob/54c84275cafa66c86992e5232b5e1019954e98f3/web/sites/default/settings.php#L19), the config is moved entirely outside of the web root.
59
+
60
+
### `composer.json`
77
61
78
-
Type `terminus drush sitename.env -- uli` to get a user reset link to set a username and password for an admin.
62
+
If you are just browsing this repository on GitHub, you may notice that the files of Drupal core itself are not included in this repo. That is because Drupal core and contrib modules are installed via Composer and ignored in the `.gitignore` file. Specific contrib modules are added to the project via `composer.json`and `composer.lock` keeps track of the exact version of each modules (or other dependency). Modules, and themes are placed in the correct directories thanks to the `"installer-paths"` section of `composer.json`. `composer.json` also includes instructions for `drupal-scaffold` which takes care of placing some individual files in the correct places like `settings.pantheon.php`.
79
63
80
-
### Installing Drupal
64
+
##Behat tests
81
65
82
-
Note that this example repository sets the installation profile to 'standard' in settings.php, so that the installer will not need to modify the settings file. If you would like to install a different profile, modify settings.php appropriately before installing your site.
66
+
So that CircleCI will have some test to run, this repository includes a configuration of Behat tests. You can add your own `.feature` files within `/tests/features/`.
83
67
84
-
###Updating Your Site
68
+
## Updating your site
85
69
86
70
When using this repository to manage your Drupal site, you will no longer use the Pantheon dashboard to update your Drupal version. Instead, you will manage your updates using Composer. Updates can be applied either directly on Pantheon, by using Terminus, or on your local machine.
87
71
@@ -96,3 +80,11 @@ Other commands will work as well; for example, you may install new modules using
96
80
#### Update on your local machine
97
81
98
82
You may also place your site in Git mode, clone it locally, and then run composer commands from there. Commit and push your files back up to Pantheon as usual.
0 commit comments