From e250f4e8dc20c0c31cec2208b074a5becdc39f13 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Thu, 12 Sep 2024 15:23:12 -0400 Subject: [PATCH] Skip Sentry configuration in Lando environments ** Why are these changes being introduced: We integrate with Sentry provided a given ENV value is defined in secrets.json, but this can result in local environments sending exceptions to Sentry - which be quite noisy and undesired. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/pw-106 ** How does this address that need: This adds an additional check around the Sentry configuration block, making sure that the PANTHEON_ENVIRONMENT variable is not sent to "lando" when integrating with Sentry. ** Document any side effects to this change: None --- docs/howto/troubleshoot-build-failures.md | 29 +++++++++++++++++++++++ web/wp-config.php | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 docs/howto/troubleshoot-build-failures.md diff --git a/docs/howto/troubleshoot-build-failures.md b/docs/howto/troubleshoot-build-failures.md new file mode 100644 index 00000000..257e3c9a --- /dev/null +++ b/docs/howto/troubleshoot-build-failures.md @@ -0,0 +1,29 @@ +# How to troubleshoot a build failure on Pantheon + +This document describes some helpful steps to take when you run into a build +failure on Pantheon. These failures are seen most often when creating a brand +new instance. + +## Identifying a build failure + +A build failure on Pantheon might become evident when creating a multidev initially: + +```bash +% terminus multidev:create mitlib-wp-network.live wp66 + [error] The operation failed to complete. +``` + +It might also appear when trying to clone content between tiers: + +```bash + % terminus remote:wp mitlib-wp-network.wp66 -- search-replace libraries.mit.edu wp66-mitlib-wp-network.pantheonsite.io --url=libraries.mit.edu + [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first. +Warning: Permanently added 'REACTED' (RSA) to the list of known hosts. +Enter passphrase for key 'REDACTED': +Error: This does not seem to be a WordPress installation. +The used path is: /code/web/wp/ +Pass --path=`path/to/wordpress` or run `wp core download`. + [notice] Command: mitlib-wp-network.wp66 -- wp search-replace libraries.mit.edu wp66-mitlib-wp-network.pantheonsite.io [Exit: 1] + [error] +``` + diff --git a/web/wp-config.php b/web/wp-config.php index 3fd2ea5b..afd85d92 100644 --- a/web/wp-config.php +++ b/web/wp-config.php @@ -66,7 +66,7 @@ define( 'WPMS_SMTP_PASS', $secrets['WPMS_SMTP_PASS'] ); // Sentry configuration is optional. - if ( array_key_exists( 'SENTRY_DSN', $secrets ) ) { + if ( array_key_exists( 'SENTRY_DSN', $secrets ) && $_ENV['PANTHEON_ENVIRONMENT'] != 'lando' ) { define( 'WP_SENTRY_DSN', $secrets['SENTRY_DSN'] ); define( 'WP_SENTRY_ERROR_TYPES', E_ERROR & E_CORE_ERROR & E_COMPILE_ERROR ); define( 'WP_SENTRY_VERSION', 'v1' );