From ff4516ae336aabacb5cb58e7845def0590160dc6 Mon Sep 17 00:00:00 2001 From: Richard Davies Date: Thu, 27 Oct 2022 15:01:18 -0700 Subject: [PATCH] Create sandbox environment --- sandbox.md | 40 ++++++++++++++++++++++++++++++++++ web/sites/default/settings.php | 7 ++++++ 2 files changed, 47 insertions(+) create mode 100644 sandbox.md diff --git a/sandbox.md b/sandbox.md new file mode 100644 index 000000000..865cee2c5 --- /dev/null +++ b/sandbox.md @@ -0,0 +1,40 @@ +# Sandbox Environment + +## Description + +The `sandbox` branch creates a long-living multidev that provides a permanently available sandbox environment that mirrors production where editors can safely practice and use the CMS without fear of messing up the live site. + +This environment can be used for guided training classes, self learning, or experimentation, etc. + +## Environment Updates + +### Code Syncing + +This environment should be a replica of the live site so it needs to be updated as part of the deployment process in order to stay in sync with the live site. + +Run these commands to keep this branch up to date: + +``` +git checkout sandbox +git rebase origin/master +git push -f +``` + +If the master branch is already ahead of the Live site, you'll need to find the commit ID belonging to the Live site deployment. This can be found in the Code section of the Pantheon dashboard. (Ignore the first "CircleCI deployment" commit—it's the second commit ID you want.) Use this rebase command instead of the above one: `git rebase ` + +### Content Syncing + +The content also needs to be periodically updated by cloning the database from Live by following these steps. (Please note that this will destroy any existing "test content" previously created on the site.) + +1. Run `lando terminus env:clone-content employees.live sandbox --db-only` +2. Run `lando terminus drush employees.sandbox deploy` +3. Create and publish an informational `Sandbox Site` alert with the following text: + +```This sandbox site is a copy of employees.portland.gov and is intended to provide a safe environment for editor training classes, self learning, or experimentation, etc. Changes made here will not affect the live site and cannot be imported into the live site.``` + +## Sandbox Branch Code Changes + +This branch should only have a few code changes from the `master` branch: +1. `sandbox.md` (This file) +2. `web/modules/custom/portland_openid_connect/src/Routing/RouteSubscriber.php` (Enabling Office 365 login for this site) +3. `web/sites/default/settings.php` (Add sandbox domain and environment indicator settings) \ No newline at end of file diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php index 8f7fa5261..70a7bd1da 100644 --- a/web/sites/default/settings.php +++ b/web/sites/default/settings.php @@ -56,6 +56,13 @@ $config['environment_indicator.indicator']['fg_color'] = '#ffffff'; $config['environment_indicator.indicator']['name'] = 'Test'; } + elseif ($_ENV['PANTHEON_ENVIRONMENT'] === 'sandbox') { + /** Replace www.example.com with your registered domain name */ + $primary_domain = 'sandbox.employees.portland.gov'; + $config['environment_indicator.indicator']['bg_color'] = '#ffb81c'; + $config['environment_indicator.indicator']['fg_color'] = '#ffffff'; + $config['environment_indicator.indicator']['name'] = 'Sandbox'; + } elseif ($_ENV['PANTHEON_ENVIRONMENT'] === 'lando') { /** Replace www.example.com with your registered domain name */ $primary_domain = 'employees.lndo.site';