From dd002dd6e13408fc0dc447c3a72d00c501032c1f Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Nov 2024 13:43:02 -0700 Subject: [PATCH 01/15] Add local config with Lando suggestions --- .../addons/object-cache/howto/wordpress.md | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 82a68b46d9..01d07359c7 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -295,7 +295,55 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d - If you are using WordPress Multisite, subsites do not get their own configuration or graphs. Navigate to `/wp-admin/network/settings.php?page=objectcache` to view network-wide configuration and graphs. This is the only screen throughout the network that displays this information. -### Additional Considerations +## Local configuration with Lando +Lando's [Pantheon recipe](https://docs.lando.dev/plugins/pantheon/) includes Redis in its Docker configuration. However, to get Object Cache Pro to work correctly with Lando locally, you'll need to make a few changes to your Object Cache Pro and Lando configuration. + +1. First, in your `.lando.yml` file add the following: + + ```yaml + services: + : + type: redis:6.0 + ``` + + - This ensures that the Redis version in your Lando environment matches the 6.x environment on Pantheon. + +1. Next, in your `wp-config.php` (or `config/application.php` for Bedrock-based WordPress Composer sites), find the `WP_REDIS_CONFIG` settings. Lando does not support `igbinary` serialization or `zstd` compression, so you will need to modify these settings for Lando locally. The simplest solution is to store the configuration values to a variable and then modify the variable for Lando environments. For example: + + ```php + $ocp_settings = [ + 'token' isset( getenv( 'OCP_LICENSE' ) ) ? getenv( 'OCP_LICENSE' ) : '', + 'host' => getenv('CACHE_HOST') ?: '127.0.0.1', + 'port' => getenv('CACHE_PORT') ?: 6379, + 'database' => getenv('CACHE_DB') ?: 0, + 'password' => getenv('CACHE_PASSWORD') ?: null, + // ...the rest of your settings... + 'serializer' => 'igbinary', + 'compression' => 'zstd', + // ... + ]; + + if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) { + $ocp_settings['serializer'] = 'php'; + $ocp_settings['compression'] = 'none'; + } + + define( 'WP_REDIS_CONFIG', $ocp_settings ); + ``` + + + If you don't want to bother with changing the configuration for local environments, you can simply disable Object Cache Pro for Lando and leave the existing configuration: + + ```php + if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) { + define( 'WP_REDIS_DISABLED', true ); + } + ``` + + +Make sure to commit your code back to your environment when you have made the appropriate changes. + +## Additional Considerations - When moving from Dev to Test, and from Test to live with OCP for the first time, note that you _must_ activate the plugin and then flush the cache via `terminus wp . -- cache flush`. - If you already have WP-Redis or other Redis plugins installed, these should be disabled before merging code. - To summarize, the full order of steps are: From 58ff68267cdb211d4ba956fb477c7b76655f5fac Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Nov 2024 14:16:25 -0700 Subject: [PATCH 02/15] use one-liner to store license directly to auth.json but provide a manual step for doing it the old way --- .../addons/object-cache/howto/wordpress.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 01d07359c7..52b8eb6f77 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -117,21 +117,19 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d ``` 1. Commit and push this file to your site. -1. Obtain a license token to use in the following authentication steps. - - ```bash - terminus remote:wp "." -- eval "echo getenv('OCP_LICENSE');" - ``` - -1. Create the authentication token and add your license token to Composer. You can do this automatically with the following command or create it manually with the steps below. - +1. Obtain the license token and apply it directly to the Composer `auth.json` to be able to authenticate against Object Cache Pro's Composer repository. + ```bash{promptUser: user} - composer config --auth http-basic.objectcache.pro token + composer config --auth http-basic.objectcache.pro token $(terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');") ``` - + + This will pull the Object Cache Pro license token directly into the `auth.json` file. + **Manually:** 1. Create an `auth.json` file in your directory. + + 1. Run `terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');")` to output the token to your terminal, then copy it into the `password` field in the next step. 1. Add the following code to the `auth.json` file. From 619392d89ece3764b361ee27552ef3d4a5dcd83a Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Nov 2024 14:17:03 -0700 Subject: [PATCH 03/15] suggest secrets for storing OCP license --- .../addons/object-cache/howto/wordpress.md | 94 +++++++++++++------ 1 file changed, 64 insertions(+), 30 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 52b8eb6f77..3354425e5d 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -192,42 +192,76 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d ```bash{promptUser: user} git add composer.* && git commit -m "Require Object Cache Pro" ``` - -1. Add the license token your `config/application.php` file. Note that in the future, the license key will be provided by the platform. Currently, you are responsible for adding it to your repository. - + +1. Add the license token your `config/application.php` file. Note that in the future, the license key will be provided by the platform. Currently, you are responsible for adding it to your repository. However, you can take advantage of [Pantheon Secrets](/guides/secrets) to store the token as a secret. + 1. Open your `config/application.php` file to add configuration values to Object Cache Pro for your site. -1. Locate the `Config::apply()` line at the bottom of the file and add the following code above the line: +1. Locate the `Config::apply()` line at the bottom of the file and add the following code above that line. - ```php + + + + + + You will need to have the Terminus Secrets Manager Plugin installed to perform any steps relating to Pantheon Secrets. For more information about how to install the Secrets Manager Plugin [refer to our documentation](/guides/secrets#installation). For more information about how Secrets work, refer to our [guide](/guides/secrets). + - /** - * Object Cache Pro config - */ - Config::define( 'WP_REDIS_CONFIG', [ - 'token' => '', - ] ); + 1. Before updating the `WP_REDIS_CONFIG` constant, store the license token as a secret: + + ```bash{promptUser: user} + terminus secret:site:set ocp_token $(terminus wp . -- eval "echo getenv('OCP_LICENSE');") --scope=user,web + ``` + + This grabs the Object Cache Pro license key from Pantheon and stores it directly as a Pantheon Site Secret. You can verify that the secret has been stored by running `terminus secret:site:list ` + + 1. Use the `pantheon_get_secret` function in your `config/application.php` file: + + ```php + /** + * Object Cache Pro config + */ + Config::define( 'WP_REDIS_CONFIG', [ + 'token' => pantheon_get_secret( 'ocp_token' ), + ] ); + ``` + + - ``` - You can put this directly under the `WP_DEBUG` rules so it looks like this: - ```php + + + - Use the `OCP_LICENSE` fetched earlier from `terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');")` and copy this into your `config/application.php` file: + + ```php + /** + * Object Cache Pro config + */ + Config::define( 'WP_REDIS_CONFIG', [ + 'token' => '', + ] ); + ``` + + You can put this directly under the `WP_DEBUG` rules so it looks like this: - /** - * Debugging Settings - */ - Config::define('WP_DEBUG_DISPLAY', false); - Config::define('WP_DEBUG_LOG', false); - Config::define('SCRIPT_DEBUG', false); - ini_set('display_errors', '0'); - - /** - * Object Cache Pro config - */ - Config::define( 'WP_REDIS_CONFIG', [ - 'token' => '', - ] ); - - ``` + ```php + /** + * Debugging Settings + */ + Config::define('WP_DEBUG_DISPLAY', false); + Config::define('WP_DEBUG_LOG', false); + Config::define('SCRIPT_DEBUG', false); + ini_set('display_errors', '0'); + + /** + * Object Cache Pro config + */ + Config::define( 'WP_REDIS_CONFIG', [ + 'token' => '', + ] ); + ``` + + + 1. Add Object Cache Pro configuration options after `Config::define( 'WP_REDIS_CONFIG', [` in `config/application.php` for **WordPress (Composer Managed)** sites. The full, recommended contents of the WP_REDIS_CONFIG constant are: From 31c0d68c76a3dbbd824b3fde8ced807a804214dc Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Nov 2024 14:25:18 -0700 Subject: [PATCH 04/15] add proper checking for `pantheon_get_secret` which won't exist in non-pantheon environments --- source/content/addons/object-cache/howto/wordpress.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 3354425e5d..cd99e2f237 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -222,7 +222,8 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d * Object Cache Pro config */ Config::define( 'WP_REDIS_CONFIG', [ - 'token' => pantheon_get_secret( 'ocp_token' ), + // Check for `pantheon_get_secret` then check for the OCP_LICENSE environment variable. + 'token' => function_exists( 'pantheon_get_secret' ) ? pantheon_get_secret( 'ocp_token' ) : ( isset( getenv( 'OCP_LICENSE' ) ? getenv( 'OCP_LICENSE' ) : '' ), ] ); ``` From 7e596bc471225923993cea21c71b62648d55d2c8 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Nov 2024 15:46:39 -0700 Subject: [PATCH 05/15] add additional lando note about sslverify settings --- .../content/addons/object-cache/howto/wordpress.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index cd99e2f237..48dfcf6c7a 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -390,6 +390,18 @@ Make sure to commit your code back to your environment when you have made the ap - Subsites do not get their own configuration or graphs. - If installed on a WordPress Multisite, the Flush cache button in the subsite dashboard widget flushes the cache of the entire network, not just the subsite cache. The default behavior can be modified by [adjusting the `WP_REDIS_CONFIG` settings](https://objectcache.pro/docs/configuration-options/#flushing-networks). Alternatively, you can flush a single site's cache by using the [WP-CLI command](https://objectcache.pro/docs/wp-cli/#multisite-flushing). - You must manually click the **Enable Cache** button in the Network Admin Object Cache Pro settings page while in SFTP mode to enable Object Cache Pro. Alternatively, you can use the Terminus commands above and commit the `object-cache.php` drop-in to your repository. +- When working locally with Lando, it's possible that Lando's self-signed SSL certificate will cause issues connecting to the Object Cache Pro license API resulting in a license error. To resolve this, add the following code to a mu-plugin: + + ```php + if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) { + add_filter( 'http_request_args', function ( $args ) { + $args['sslverify'] = false; + return $args; + } ); + } + ``` + + - You may wish to make this file local-only by adding it to your `.gitignore` file. This error will not cause any issues with the functioning of Object Cache Pro or the behavior of the plugin on Pantheon but it might prevent you from being able to make updates to the plugin locally. From 963b29ff56880a42febf4a3b63f2e6c9ff763cc5 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Mon, 25 Nov 2024 13:24:47 -0700 Subject: [PATCH 06/15] copy edits for composer-based install --- source/content/addons/object-cache/howto/wordpress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 48dfcf6c7a..3e68eadc81 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -150,7 +150,7 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d git add auth.json && git commit -m "Add Object Cache Pro auth token." ``` -1. Add the Object Cache Pro repository to your `composer.json` file's `repositories` section. +1. Open your `composer.json` file and locate the `repositories` section. If it doesn't exist, add it as shown below: ```json repositories: [ From bcc9463c8f5c8d6f1b70b0ff76de8119619aa295 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:13:55 -0700 Subject: [PATCH 07/15] remove instruction to git commit & add alert auth.json is only needed for local development --- .../content/addons/object-cache/howto/wordpress.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 3e68eadc81..7f57023837 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -123,7 +123,7 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d composer config --auth http-basic.objectcache.pro token $(terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');") ``` - This will pull the Object Cache Pro license token directly into the `auth.json` file. + This will pull the Object Cache Pro license token directly into the `auth.json` file. **Manually:** @@ -144,11 +144,11 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d } ``` -1. Commit the `auth.json` to your repository: - - ```bash{promptUser: user} - git add auth.json && git commit -m "Add Object Cache Pro auth token." - ``` + + + The `auth.json` file is only necessary for authenticating against the Object Cache Pro Composer repository. For this reason, we recommend adding it to your `.gitignore` so you are not committing secrets to your Git repository. However, excluding it from version control means that anyone else who may want to update Object Cache Pro locally will need to repeat the steps above to generate their own `auth.json` file. + + 1. Open your `composer.json` file and locate the `repositories` section. If it doesn't exist, add it as shown below: From da77b590e48d3886433d0805c48e656654e060bf Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:26:49 -0700 Subject: [PATCH 08/15] don't recommend copying and pasting the license --- source/content/addons/object-cache/howto/wordpress.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 7f57023837..24fed12e1f 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -123,16 +123,8 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d composer config --auth http-basic.objectcache.pro token $(terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');") ``` - This will pull the Object Cache Pro license token directly into the `auth.json` file. + This will pull the Object Cache Pro license token directly into the `auth.json` file. You can open the `auth.json` file locally to ensure that it has a structure that looks like this: - **Manually:** - - 1. Create an `auth.json` file in your directory. - - 1. Run `terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');")` to output the token to your terminal, then copy it into the `password` field in the next step. - - 1. Add the following code to the `auth.json` file. - ```json { "http-basic": { From 00a49d56e752475fb3e3f6d33d7cca597bae86ad Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:27:05 -0700 Subject: [PATCH 09/15] specify repositories section --- source/content/addons/object-cache/howto/wordpress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 24fed12e1f..732fa76cb1 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -142,7 +142,7 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d -1. Open your `composer.json` file and locate the `repositories` section. If it doesn't exist, add it as shown below: +1. Open your `composer.json` file and locate the `repositories` section. If it doesn't exist, add it in the "repositories" section as shown below: ```json repositories: [ From 0d662104bd25b5b8dfe30d74946d1282dc692917 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:27:23 -0700 Subject: [PATCH 10/15] update outdated copy --- source/content/addons/object-cache/howto/wordpress.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 732fa76cb1..dc24622577 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -185,8 +185,8 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d git add composer.* && git commit -m "Require Object Cache Pro" ``` -1. Add the license token your `config/application.php` file. Note that in the future, the license key will be provided by the platform. Currently, you are responsible for adding it to your repository. However, you can take advantage of [Pantheon Secrets](/guides/secrets) to store the token as a secret. - +1. Add the license token your `config/application.php` file. Normally, the license key is provided by the platform. However, when you are working locally, Lando (or your local development environment) does not have access to the platform environment variable. However, you can extract it from the `auth.json` created in the previous steps. + 1. Open your `config/application.php` file to add configuration values to Object Cache Pro for your site. 1. Locate the `Config::apply()` line at the bottom of the file and add the following code above that line. From c5f416e6defe40378435246e69eb229c1515814d Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:27:48 -0700 Subject: [PATCH 11/15] remove tablist and secrets recommendation --- .../addons/object-cache/howto/wordpress.md | 88 ++++++------------- 1 file changed, 28 insertions(+), 60 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index dc24622577..c86efeec59 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -191,70 +191,38 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d 1. Locate the `Config::apply()` line at the bottom of the file and add the following code above that line. - - - - - - You will need to have the Terminus Secrets Manager Plugin installed to perform any steps relating to Pantheon Secrets. For more information about how to install the Secrets Manager Plugin [refer to our documentation](/guides/secrets#installation). For more information about how Secrets work, refer to our [guide](/guides/secrets). - - - 1. Before updating the `WP_REDIS_CONFIG` constant, store the license token as a secret: - - ```bash{promptUser: user} - terminus secret:site:set ocp_token $(terminus wp . -- eval "echo getenv('OCP_LICENSE');") --scope=user,web - ``` - - This grabs the Object Cache Pro license key from Pantheon and stores it directly as a Pantheon Site Secret. You can verify that the secret has been stored by running `terminus secret:site:list ` - - 1. Use the `pantheon_get_secret` function in your `config/application.php` file: - - ```php - /** - * Object Cache Pro config - */ - Config::define( 'WP_REDIS_CONFIG', [ - // Check for `pantheon_get_secret` then check for the OCP_LICENSE environment variable. - 'token' => function_exists( 'pantheon_get_secret' ) ? pantheon_get_secret( 'ocp_token' ) : ( isset( getenv( 'OCP_LICENSE' ) ? getenv( 'OCP_LICENSE' ) : '' ), - ] ); - ``` + ```php + $token = getenv( 'OCP_LICENSE' ); // Get the license from the Pantheon environment variables. - + // If working locally, set $token based on the local auth.json file. + if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) { // Change this if you are not using Lando. + $auth_json = ABSPATH . '/auth.json'; + if ( file_exists( $auth_json ) ) { + $auth_json = json_decode( file_get_contents( $auth_json ) ); + $token = $auth_json['http-basic']['objectcache.pro']['password']; + } + } + ``` - - - - Use the `OCP_LICENSE` fetched earlier from `terminus remote:wp . -- eval "echo getenv('OCP_LICENSE');")` and copy this into your `config/application.php` file: +1. Set the Object Cache Pro settings using the license key either from the Pantheon environment or your local `auth.json`. You can put this directly under the `WP_DEBUG` rules so it looks like this: - ```php - /** - * Object Cache Pro config - */ - Config::define( 'WP_REDIS_CONFIG', [ - 'token' => '', - ] ); - ``` - - You can put this directly under the `WP_DEBUG` rules so it looks like this: + ```php + /** + * Debugging Settings + */ + Config::define('WP_DEBUG_DISPLAY', false); + Config::define('WP_DEBUG_LOG', false); + Config::define('SCRIPT_DEBUG', false); + ini_set('display_errors', '0'); + + /** + * Object Cache Pro config + */ + Config::define( 'WP_REDIS_CONFIG', [ + 'token' => $token, + ] ); + ``` - ```php - /** - * Debugging Settings - */ - Config::define('WP_DEBUG_DISPLAY', false); - Config::define('WP_DEBUG_LOG', false); - Config::define('SCRIPT_DEBUG', false); - ini_set('display_errors', '0'); - - /** - * Object Cache Pro config - */ - Config::define( 'WP_REDIS_CONFIG', [ - 'token' => '', - ] ); - ``` - - - 1. Add Object Cache Pro configuration options after `Config::define( 'WP_REDIS_CONFIG', [` in `config/application.php` for **WordPress (Composer Managed)** sites. The full, recommended contents of the WP_REDIS_CONFIG constant are: From 7e74d0b31ee6eca9a0653fccca46b3aa71ce5bc0 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:28:11 -0700 Subject: [PATCH 12/15] use $token when we talk about local config --- source/content/addons/object-cache/howto/wordpress.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index c86efeec59..61271c9784 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -227,7 +227,7 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d 1. Add Object Cache Pro configuration options after `Config::define( 'WP_REDIS_CONFIG', [` in `config/application.php` for **WordPress (Composer Managed)** sites. The full, recommended contents of the WP_REDIS_CONFIG constant are: ```php - 'token' => '', + 'token' => $token, 'host' => getenv('CACHE_HOST') ?: '127.0.0.1', 'port' => getenv('CACHE_PORT') ?: 6379, 'database' => getenv('CACHE_DB') ?: 0, @@ -305,7 +305,7 @@ Lando's [Pantheon recipe](https://docs.lando.dev/plugins/pantheon/) includes Red ```php $ocp_settings = [ - 'token' isset( getenv( 'OCP_LICENSE' ) ) ? getenv( 'OCP_LICENSE' ) : '', + 'token' => $token, // The dynamically fetched token from above. 'host' => getenv('CACHE_HOST') ?: '127.0.0.1', 'port' => getenv('CACHE_PORT') ?: 6379, 'database' => getenv('CACHE_DB') ?: 0, From 474839ad77d68b9f1853354bf326b2e2e03ee0b6 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 6 Dec 2024 15:28:27 -0700 Subject: [PATCH 13/15] link to ocp docs site --- source/content/addons/object-cache/howto/wordpress.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 61271c9784..00fd5f4155 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -251,7 +251,10 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d 'async_flush' => true, 'strict' => true, ``` -1. Make sure you `git push` your changes up to your repository before you activate the plugin. + + Refer to the [Object Cache Pro documentation](https://objectcache.pro/docs/) for detailed explanations of all the configuration settings. + +1. Make sure you add and `git push` your changes up to your repository before you activate the plugin. 1. Activate the plugin and enable Redis in the plugin. You can activate the Object Cache Pro plugin from the WordPress Admin, locally with WP-CLI, or via Terminus. From 977284240f2cd1850347e7dff93900353ee26961 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Mon, 9 Dec 2024 11:54:51 -0700 Subject: [PATCH 14/15] service name should be 'cache' --- source/content/addons/object-cache/howto/wordpress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 00fd5f4155..9c87ff5b7d 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -298,7 +298,7 @@ Lando's [Pantheon recipe](https://docs.lando.dev/plugins/pantheon/) includes Red ```yaml services: - : + cache: type: redis:6.0 ``` From f2b83f15274995a9e9fa4c46f5d61ce94b909a09 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Mon, 9 Dec 2024 12:01:13 -0700 Subject: [PATCH 15/15] note that the redis config is optional not required for OCP to function, just if you want to use a redis version that more closely matches Pantheon's environment --- source/content/addons/object-cache/howto/wordpress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/content/addons/object-cache/howto/wordpress.md b/source/content/addons/object-cache/howto/wordpress.md index 9c87ff5b7d..31ce1c1040 100644 --- a/source/content/addons/object-cache/howto/wordpress.md +++ b/source/content/addons/object-cache/howto/wordpress.md @@ -302,7 +302,7 @@ Lando's [Pantheon recipe](https://docs.lando.dev/plugins/pantheon/) includes Red type: redis:6.0 ``` - - This ensures that the Redis version in your Lando environment matches the 6.x environment on Pantheon. + - This ensures that the Redis version in your Lando environment matches the 6.x environment on Pantheon. Object Cache Pro will still work with the default version of Redis that is included in the Pantheon Lando recipe, so this step is optional. 1. Next, in your `wp-config.php` (or `config/application.php` for Bedrock-based WordPress Composer sites), find the `WP_REDIS_CONFIG` settings. Lando does not support `igbinary` serialization or `zstd` compression, so you will need to modify these settings for Lando locally. The simplest solution is to store the configuration values to a variable and then modify the variable for Lando environments. For example: