From a928afbfe37a91f8bad7364dc52ddaa88fd41527 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:28:40 +0200 Subject: [PATCH 1/8] Update bedrock.md --- .../get-started/stacks/wordpress/bedrock.md | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md index ead3691ed1..7708330657 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md +++ b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md @@ -147,8 +147,9 @@ applications: wp cache flush # Runs the WordPress database update procedure wp core update-db - # Runs all due cron events + post_deploy: | wp cron event run --due-now + ``` ## 5. Update App container depdencies @@ -194,7 +195,22 @@ routes: Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. If these strings aren't the same, the WordPress deployment will not succeed. -## 7. Update `.environment` +## 6. Add your crons + +Under your application configuration you can now add a cron. + +``` + crons: + wp-cron: + spec: '*/10 * * * *' + commands: + start: wp cron event run --due-now + shutdown_timeout: 600 + + +``` + +## 8. Update `.environment` The CLI generated a `.environment` file during the Getting started guide. Notice it has already created some environment variables for you to connect to your database service. @@ -230,7 +246,7 @@ To configure the remaining environment variables that WordPress needs to run smo export NONCE_SALT="${PLATFORM_PROJECT_ENTROPY}NONCE_SALT" ``` -## 8. Commit, Push, and Deploy! +## 9. Commit, Push, and Deploy! You can now commit all the changes made to `.upsun/config.yaml` and `.environment` and push to {{% vendor/name %}}. ```bash {location="Terminal"} From 438f1a18e0db5219e737412c2900892aa8c331c9 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:34:38 +0200 Subject: [PATCH 2/8] Update bedrock.md --- sites/upsun/src/get-started/stacks/wordpress/bedrock.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md index 7708330657..8f3e8997f9 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md +++ b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md @@ -195,7 +195,7 @@ routes: Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. If these strings aren't the same, the WordPress deployment will not succeed. -## 6. Add your crons +## 7. Add your crons Under your application configuration you can now add a cron. @@ -231,7 +231,7 @@ To configure the remaining environment variables that WordPress needs to run smo 2. Add the following at the end of the file: ```bash {location=".environment"} - export WP_HOME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary == true) | .key') + export WP_HOME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary == true) | if (.key[-1:] == "/") then (.key[0:-1]) else .key end') export WP_SITEURL="${WP_HOME}/wp" export WP_DEBUG_LOG=/var/log/app.log # Uncomment this line if you would like development versions of WordPress on non-production environments. From be6bf43d68601dc46172703fa70c45d3649c29a3 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:35:56 +0200 Subject: [PATCH 3/8] Update bedrock.md --- sites/upsun/src/get-started/stacks/wordpress/bedrock.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md index 8f3e8997f9..755b4c3ba4 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md +++ b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md @@ -131,7 +131,7 @@ application can receive requests. Such tasks include: - Running any due cron jobs To perform these tasks, we'll utilize the [deploy hook](/learn/overview/build-deploy.md#deploy-steps). Locate the -`deploy:` section (below the `build:` section). Update the `deploy:` section as follows: +`deploy:` section (below the `build:` section). Update the `deploy:` and `post_deploy:` section as follows: ```yaml {configFile="app"} applications: From 1a3caac8825f3a6197a85d0e8405500e1684e967 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:37:20 +0200 Subject: [PATCH 4/8] Update composer.md --- .../get-started/stacks/wordpress/composer.md | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/composer.md b/sites/upsun/src/get-started/stacks/wordpress/composer.md index 93230f66ab..721d56a8df 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/composer.md +++ b/sites/upsun/src/get-started/stacks/wordpress/composer.md @@ -186,7 +186,7 @@ Such tasks include: To launch these tasks during the deploy hook, locate the `deploy:` section (below the `build:` section).
-Update the `deploy:` section as follows: +Update the `deploy:` and `post_deploy:` section as follows: ```yaml {configFile="app"} applications: @@ -202,6 +202,7 @@ applications: wp cache flush # Runs the WordPress database update procedure wp core update-db + post_deploy: | # Runs all due cron events wp cron event run --due-now ``` @@ -235,7 +236,22 @@ routes: Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. If these strings aren't the same, the WordPress deployment will not succeed. -## 7. Update your MariaDB service relationship +## 7. Add your crons + +Under your application configuration you can now add a cron. + +``` + crons: + wp-cron: + spec: '*/10 * * * *' + commands: + start: wp cron event run --due-now + shutdown_timeout: 600 + + +``` + +## 8. Update your MariaDB service relationship You need to update the name used to represent the [relationship](/create-apps/app-reference/single-runtime-image.md#relationships) between your app and your MariaDB service. To do so, locate the `relationships:` top-level property. From 73fa325ffe8f79fedafbce8ef8cd4df47e6a46ff Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:38:33 +0200 Subject: [PATCH 5/8] Update composer.md --- sites/upsun/src/get-started/stacks/wordpress/composer.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sites/upsun/src/get-started/stacks/wordpress/composer.md b/sites/upsun/src/get-started/stacks/wordpress/composer.md index 721d56a8df..dcec4a967b 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/composer.md +++ b/sites/upsun/src/get-started/stacks/wordpress/composer.md @@ -241,6 +241,12 @@ If these strings aren't the same, the WordPress deployment will not succeed. Under your application configuration you can now add a cron. ``` +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... crons: wp-cron: spec: '*/10 * * * *' From bd4e102e498fc1604c6db6ff3bd4442df5654325 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:39:41 +0200 Subject: [PATCH 6/8] Update composer.md --- sites/upsun/src/get-started/stacks/wordpress/composer.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/composer.md b/sites/upsun/src/get-started/stacks/wordpress/composer.md index dcec4a967b..678fbe1442 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/composer.md +++ b/sites/upsun/src/get-started/stacks/wordpress/composer.md @@ -240,7 +240,7 @@ If these strings aren't the same, the WordPress deployment will not succeed. Under your application configuration you can now add a cron. -``` +```yaml {configFile="app"} applications: myapp: source: @@ -253,8 +253,6 @@ applications: commands: start: wp cron event run --due-now shutdown_timeout: 600 - - ``` ## 8. Update your MariaDB service relationship From b932027776f568442c96dc6694794db09c0d0774 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:40:36 +0200 Subject: [PATCH 7/8] Update bedrock.md --- .../upsun/src/get-started/stacks/wordpress/bedrock.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md index 755b4c3ba4..888d99518d 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/bedrock.md +++ b/sites/upsun/src/get-started/stacks/wordpress/bedrock.md @@ -199,15 +199,19 @@ If these strings aren't the same, the WordPress deployment will not succeed. Under your application configuration you can now add a cron. -``` +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... crons: wp-cron: spec: '*/10 * * * *' commands: start: wp cron event run --due-now shutdown_timeout: 600 - - ``` ## 8. Update `.environment` From f0f6b863373e59d798767776fbe1f898a0cbf848 Mon Sep 17 00:00:00 2001 From: jww-sh <50234564+jww-sh@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:45:43 +0200 Subject: [PATCH 8/8] Update vanilla.md --- .../get-started/stacks/wordpress/vanilla.md | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/sites/upsun/src/get-started/stacks/wordpress/vanilla.md b/sites/upsun/src/get-started/stacks/wordpress/vanilla.md index 02f1633755..6573c05e7f 100644 --- a/sites/upsun/src/get-started/stacks/wordpress/vanilla.md +++ b/sites/upsun/src/get-started/stacks/wordpress/vanilla.md @@ -139,7 +139,7 @@ If you changed the name of the directory at step 1.4 you'll need to update the ` - Running any due cron jobs To perform these tasks, we'll utilize the [deploy hook](/learn/overview/build-deploy.md#deploy-steps). Locate the - `deploy:` section (below the `build:` section). Update the `deploy:` section as follows: + `deploy:` section (below the `build:` section). Update the `deploy:` and `post_deploy:` section as follows: ```yaml {configFile="app"} applications: @@ -155,11 +155,31 @@ If you changed the name of the directory at step 1.4 you'll need to update the ` wp cache flush # Runs the WordPress database update procedure wp core update-db + post_deploy: | # Runs all due cron events wp cron event run --due-now ``` + +5. Add your crons + +Under your application configuration you can now add a cron. + +```yaml {configFile="app"} +applications: + myapp: + source: + root: "/" + type: 'php:8.3' + ... + crons: + wp-cron: + spec: '*/10 * * * *' + commands: + start: wp cron event run --due-now + shutdown_timeout: 600 +``` -5. Locate the `routes:` section, and beneath it, the `"https://{default}/":` route. Update the route as follows: +6. Locate the `routes:` section, and beneath it, the `"https://{default}/":` route. Update the route as follows: ```yaml {configFile="app"} applications: @@ -180,7 +200,7 @@ If you changed the name of the directory at step 1.4 you'll need to update the ` - '/^wp-*/' ``` -6. Optional: Add the wp-cli tool to your application build. Locate the `dependencies:` section that is commented out, +7. Optional: Add the wp-cli tool to your application build. Locate the `dependencies:` section that is commented out, and update it as follows: ```yaml {configFile="app"} @@ -195,7 +215,7 @@ If you changed the name of the directory at step 1.4 you'll need to update the ` wp-cli/wp-cli-bundle: "^2.4" ``` -7. Add and commit your changes. +8. Add and commit your changes. ```bash {location="Terminal"} git add .upsun/config.yaml @@ -223,8 +243,8 @@ To configure the remaining environment variables WordPress needs to run smoothly 2. Add the following at the end of the file: ```bash {location=".environment"} - export WP_HOME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary == true) | .key') - export WP_SITEURL="${WP_HOME}wordpress" + export WP_HOME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary == true) | if (.key[-1:] == "/") then (.key[0:-1]) else .key end') + export WP_SITEURL="${WP_HOME}/wordpress" export WP_DEBUG_LOG=/var/log/app.log if [ "$PLATFORM_ENVIRONMENT_TYPE" != "production" ] ; then export WP_ENV='development'