diff --git a/.circleci/config.yml b/.circleci/config.yml
index 5c13141d..0a9d052c 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -107,6 +107,10 @@ jobs:
name: run PHP build step
command: ./.ci/build/php
+ - run:
+ name: install theme composer dependencies
+ command: cd web/wp-content/themes/sage && composer install
+
- save_cache:
key: vendor-{{ checksum "composer.lock" }}
paths:
@@ -118,6 +122,41 @@ jobs:
- web
- vendor
+ build_yarn:
+ <<: *defaults
+ docker:
+ - image: circleci/node:10.16.2
+
+ steps:
+ - checkout
+
+ - restore_cache:
+ keys:
+ - yarn-packages-{{ checksum "web/wp-content/themes/sage/yarn.lock" }}
+ - yarn-packages- # used if checksum fails
+
+ - run:
+ name: install theme yarn dependencies
+ command: cd web/wp-content/themes/sage && yarn install
+
+ - run:
+ name: build theme assets
+ # If non-hashed versions of site assets are needed for 3rd parties, also run `yarn build:nohash`
+ command: cd web/wp-content/themes/sage && yarn build
+
+ - save_cache:
+ name: cache Yarn files
+ key: yarn-packages-{{ checksum "web/wp-content/themes/sage/yarn.lock" }}
+ paths:
+ - $HOME/.cache/yarn
+
+ - persist_to_workspace:
+ # Must be relative path from working_directory
+ root: .
+ # Must be relative path from root
+ paths:
+ - web/wp-content/themes/sage/dist
+
deploy_to_pantheon:
<<: *defaults
steps:
@@ -230,24 +269,26 @@ workflows:
build_deploy_and_test:
jobs:
- configure_env_vars
- - static_tests
+ # - static_tests
+ - build_yarn
- build_php
- deploy_to_pantheon:
requires:
- - static_tests
+ # - static_tests
+ - build_yarn
- build_php
- - visual_regression_test:
- requires:
- - configure_env_vars
- - deploy_to_pantheon
- filters:
- branches:
- ignore:
- - master
- - behat_test:
- requires:
- - deploy_to_pantheon
- - visual_regression_test
+ # - visual_regression_test:
+ # requires:
+ # - configure_env_vars
+ # - deploy_to_pantheon
+ # filters:
+ # branches:
+ # ignore:
+ # - master
+ # - behat_test:
+ # requires:
+ # - deploy_to_pantheon
+ # - visual_regression_test
scheduled_update_check:
triggers:
diff --git a/.tool-versions b/.tool-versions
new file mode 100644
index 00000000..d5c42e29
--- /dev/null
+++ b/.tool-versions
@@ -0,0 +1 @@
+nodejs 10.21.0
diff --git a/README.template.md b/README.template.md
new file mode 100644
index 00000000..2fa9a955
--- /dev/null
+++ b/README.template.md
@@ -0,0 +1,141 @@
+## Outline
+
+- [Pantheon Environments](#pantheon-environments)
+- [Local Development](#local-development)
+ - [Prerequisites](#prerequisites)
+ - [Installation](#installation)
+ - [Boot WordPress Application](#boot-word-press-application)
+ - [Boot Theme (Webpack) Server](#boot-theme-webpack-server)
+ - [Pull Files and Database from Pantheon](#pull-files-and-database-from-pantheon)
+- [Deploying](#deploying)
+ - [Deployment Using Terminus](#deployment-using-terminus)
+ - [Test Environment](#test-environment)
+ - [Live Environment](#live-environment)
+- [Troubleshooting](/docs/troubleshooting.md)
+
+## Pantheon Environments
+
+- **Live** - http://live-fix-me.pantheonsite.io/
+- **Test** - http://test-fix-me.pantheonsite.io/
+- **Dev** - http://dev-fix-me.pantheonsite.io/
+
+## Local Development
+
+In order to more easily recreate the production environment locally, [Lando](https://lando.dev/) is used for local development. We also use Pantheon’s CLI, Terminus, to sync files and databases.
+
+- **PHP Server** - http://fix-me.lndo.site/
+- **Webpack Server** - https://localhost:3000
+
+### Prerequisites
+
+Install all the required local dependencies:
+
+- [Git Version Control](https://git-scm.com/downloads)
+- [Docker](https://www.docker.com/products/docker-desktop)
+- Lando v3.0.6 ([Windows](https://docs.devwithlando.io/installation/windows.html), [macOS](https://docs.devwithlando.io/installation/macos.html))
+- [Terminus](https://pantheon.io/docs/terminus/install/) 2.3.0, Pantheon’s CLI tool
+- [Composer](https://getcomposer.org/doc/00-intro.md)
+- [Node](https://nodejs.org/en/) 10.21.0
+ Note: The sage theme dependencies do not support version of Node greater than 10. We recommend [asdf](https://github.com/asdf-vm/asdf) for managing multiple versions of Node
+- Yarn
+ ([Windows](https://yarnpkg.com/en/docs/install#windows-stable), [macOS](https://yarnpkg.com/en/docs/install#mac-stable))
+
+You'll also need write access to this repo and be a member of the [Pantheon Project](https://dashboard.pantheon.io/sites/FIXME#dev/code).
+
+### Installation
+
+1. Clone the Repo
+ `$ git clone https://github.com/Threespot/fix-me.git`
+1. Install Application Composer Dependencies
+ `$ composer install`
+1. Install Theme Composer Dependencies
+ - Navigate to the sage theme directory
+ `$ cd web/wp-content/themes/sage`
+ - Install Componser deps
+ `$ composer install`
+1. Install Theme Node Dependencies
+ - Navigate to the sage theme directory
+ `$ cd web/wp-content/themes/sage`
+ - Install Node deps
+ `$ yarn install` from the theme directory
+
+### Boot WordPress Application
+
+With all the dependencies installed, from the root project directory run:
+
+```
+lando start
+```
+
+If this is the first time running this command, Lando will build the necessary Docker containers.
+
+To stop the server run:
+
+```
+lando stop
+```
+
+Other Lando CLI command can be read here in the [Lando docs](https://docs.lando.dev/basics/usage.html)
+
+### Boot Theme (Webpack) Server
+
+Making CSS or JS updates requires running Webpack to recompile and inject the CSS and JS.
+
+1. Navigate to the theme folder
+ `$ cd /web/wp-content/themes/sage`
+
+1. Install npm dependencies using Yarn
+ `$ yarn install`
+
+1. Start Webpack
+ `$ yarn start`
+
+1. You should now be able to view the site locally at https://localhost:3000
+1. To stop the server, press Control + C
+
+### Pull Files and Database from Pantheon
+
+Lando is used to pull uploads and data from Pantheon. [See docs here](https://docs.lando.dev/config/pantheon.html#importing-your-database-and-files).
+
+```
+lando pull --database=test --files=test --code=none
+```
+
+## Deploying
+
+Code committed to the remote `master` branch is automatically deployed to the `dev` environement on Pantheon. After a local branch is pushed, [CircleCI](https://circleci.com/gh/Threespot/fix-me) will build and deploy the files to Pantheon’s [dev environment](https://dashboard.pantheon.io/sites/5118c78c-b29d-467c-b178-2728fe3f293c#dev/code). You can tell CircleCI to not run by adding `[skip ci]` to the commit message.
+
+Code that exists on `dev` can be promoted to the `test` enviroment, and `test` can be promoted to the `live` environment. Details about the application lifecycle can be read [here](https://pantheon.io/agencies/development-workflow/dev-test-live-workflow).
+Feature branches with a corresponding pull request will create a multi-dev enviroment used for testing indiviual features. Docs are available [here](https://pantheon.io/docs/multidev)
+
+### Deployment Using Terminus
+
+#### Test Environment
+
+Code will be promoted from `dev` to `test`
+
+```shell
+lando composer run-script deploy:test
+```
+
+**NOTE:** this composer script will also purge Pantheon's cache.
+
+or
+
+```shell
+lando terminus env:deploy fix-me.test
+```
+
+#### Live Environment
+
+Code will be promoted from `test` to `live`
+
+```shell
+lando composer run-script deploy:live
+```
+
+or
+
+```shell
+lando terminus env:deploy fix-me.live
+```
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 0559b6af..969d561a 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
{
- "name": "pantheon-systems/example-wordpress-composer",
- "description": "",
+ "name": "threespot/example-wordpress-composer",
+ "description": "Terminus build tools template for a Pantheon Composer WordPress application",
"type": "project",
"keywords": [],
"repositories": [
@@ -94,6 +94,8 @@
"unit-test": [
"./vendor/bin/phpunit tests/unit/*"
],
- "lint": "find web/wp-content -name '*.php' -exec php -l {} \\;"
+ "lint": "find web/wp-content -name '*.php' -exec php -l {} \\;",
+ "deploy:test": "terminus env:deploy fix-me.test && terminus env:clear-cache fix-me.test",
+ "deploy:live": "terminus env:deploy fix-me.live"
}
}
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
new file mode 100644
index 00000000..e8c9b332
--- /dev/null
+++ b/docs/troubleshooting.md
@@ -0,0 +1,39 @@
+# Troubleshooting
+
+## Outline
+
+- [Pulling Files and Database from Pantheon Test Environment](pulling-files-and-database-from-pantheon-test-environment)
+- [ENOENT error when running lando start on macOS Big Sur](enoent-error-after-running-lando-start-on-macos-big-sur)
+
+## Pulling Files and Database from Pantheon Test Environments
+
+Running this command:
+
+```
+lando pull --database=test --files=test --code=none
+```
+
+causes this error:
+
+```
+Notice: Undefined index: X-Pantheon-Styx-Hostname in /var/www/html/vendor/pantheon-systems/terminus/src/Models/Environment.php on line 851
+ [error] Pantheon headers missing, which is not quite right.
+```
+
+The `test` enviroment has not been created. Dev needs promoted first before the files or database can be pulled from it.
+
+## ENOENT error when running lando start on macOS Big Sur
+
+When running this command on macOS Big Sur to start your application:
+
+```
+lando start
+```
+
+You receive this error:
+
+```
+Error =⇒ ENOENT: no such file or directory, scandir /Users//.ssh
+```
+
+This error appears where there isn't a `.ssh` folder inside of your root directory. To resolve the issue you can [generate a SSH key](https://pantheon.io/docs/ssh-keys#generate-ssh-key) which will create the missing `.ssh` folder in your root directory and a new ssh key.
\ No newline at end of file