Repository navigation
Conversation
- Move to the CraftCms\Cloud namespace - Run queued jobs with bref/laravel-bridge's QueueHandler - Run platform commands with a Guzzle-based CommandSqsHandler - Give the Valkey connection 1-second timeouts - Force stderr logging and database sessions on Cloud - Read CRAFT_CLOUD_* through one Cloud class - Test with Orchestra Testbench booting Craft - Release with release-it, matching 3.x Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7 Co-authored-by: Amp <amp@ampcode.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2c8729630
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $response = $this->post($url, $result); | ||
| } catch (GuzzleException $e) { | ||
| fwrite(STDERR, json_encode($result) . "\n"); | ||
| $this->post($url, [ |
There was a problem hiding this comment.
Prevent callback failures from rerunning completed commands
When both callback attempts fail at the transport layer, this second post() throws an uncaught GuzzleException after the Craft command has already completed. The SQS invocation is consequently reported as failed and the message can be delivered again, rerunning arbitrary commands with potentially non-idempotent effects; catch the fallback failure and log it without failing the completed record.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bad36d5, with a regression test.
| return $this->client->post($url, [ | ||
| RequestOptions::JSON => $body, |
There was a problem hiding this comment.
Preserve command output containing invalid UTF-8
When a command emits non-UTF-8 bytes, Guzzle's JSON request encoding throws instead of sending the result, so the callback receives only a generic request-failure payload and the actual command output is lost. The previous implementation deliberately encoded with JSON_INVALID_UTF8_SUBSTITUTE; apply equivalent sanitization before using the JSON request option.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bad36d5, with a regression test.
The callback post no longer throws when both attempts fail at the transport layer, so SQS won't redeliver and rerun a completed command. Output that isn't valid UTF-8 is substituted instead of failing to encode, as in 3.x. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7 Co-authored-by: Amp <amp@ampcode.com>
The workbench serves a Craft 6 site with this package installed, on SQLite, from Testbench's skeleton. `composer build` installs Craft and `composer serve` serves it. In Amp orbs, .agents/setup installs PHP 8.5 and dependencies and .amp/services.yaml runs the workbench behind a portal. Also relocks craftcms/cms and craftcms/cms-assets at 6.0.0-beta.1, now that Packagist has indexed the cms-assets tag. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7 Co-authored-by: Amp <amp@ampcode.com>
- Read CRAFT_CLOUD_REDIS_URL, which is what cloud-api sets. CRAFT_CLOUD_CACHE_SRV was never set, so Valkey was never used. This also drops the per-boot DNS lookup. - Give console commands the invocation's remaining time, less a buffer to send the result, instead of assuming a 900-second function timeout. - Drop bref/extra-php-extensions. It only ships serverless.yml layer metadata, and Cloud's builder copies the extension images itself. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7 Co-authored-by: Amp <amp@ampcode.com>
Description
This rebuilds
5.xas the baseline that the Craft 6 feature work (disk, transformer, static cache) will build on. As it stands,5.xcan't run queued jobs on Craft Cloud, never connects to Valkey, and has no way to run Craft locally for development.Cloud::isCraftCloud()andCloud::env()are now the one place that reads the function's environment. Values come from the process environment, so they stay right when config is cached.Releases switch from the unused semantic-release config to release-it, as on 3.x. Semantic-release would have numbered from
3.1.0, the newest tag in this branch's history, and collided with 3.x releases. The first release is tagged by hand as5.0.0-beta.1.Infra: Laravel's redis store uses the phpredis extension, which Bref compiles in but disables. Craft 3.x didn't need it because yii2-redis is pure PHP. Cloud's builder has to add
extension=redisto the tenant PHP config (cloud-api'scraft.php.ini); without it, the failover store skips Valkey and uses the database.