Repository navigation
Run Craft Cloud's functions as Bref does - #220
Merged
Merged
Conversation
…ttings Craft Cloud's functions use Bref's own handlers: PHP-FPM for the web, bref/laravel-bridge's QueueHandler for the SQS worker, and the console runtime with artisan. The README documents them as the contract with infrastructure, and a test runs a Craft job through QueueHandler. On Craft Cloud, turn off Craft settings that don't apply to a read-only image that Craft Cloud deploys and backs up: allowUpdates, backups, queue.runAutomatically and writeYamlAutomatically. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
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. |
Saving a field layout writes PHPDoc files into vendor/_craft, which fails on the read-only image. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Craft defaults ideHelperEnabled to APP_DEBUG. Locally the workbench's skeleton .env set it to true; CI has no .env, so the off-Cloud baseline was false there. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7 (cherry picked from commit 68c9dd1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings back what Craft Cloud's Lambda functions run, written from Bref's docs rather than ported from 3.x. Bref and bref/laravel-bridge already ship every handler, so the package adds no handler code.
BREF_RUNTIMECMD)fpmpublic/index.phpfunctionBref\LaravelBridge\Queue\QueueHandlerconsoleartisan, with the command as the eventAll functions also need
QUEUE_CONNECTION=sqsandSQS_QUEUE, as in Bref's Laravel queues docs.On Craft Cloud, the provider also turns off Craft settings that don't apply to a read-only image that Craft Cloud deploys and backs up:
allowUpdatesideHelperEnabled. Saving a field layout writes PHPDoc files intovendor/_craft.backups.command,backups.restoreCommand,backups.onUpdatequeue.runAutomatically. Otherwise control panel requests callQueue::size()against SQS and runqueue:work --oncein the web function.writeYamlAutomatically. Craft 5'sCRAFT_EPHEMERALdid this, and Craft 6 doesn't read it.They're set with
callAfterResolving(), so they win over the project'sconfig/craft/general.phpand over deprecatedCRAFT_*environment overrides.Important
Stacked on #219, which registers the bridge on Craft Cloud.
QueueHandler's$connectionbinding comes from the bridge's provider, so the worker needsCRAFT_CLOUD=1.Evidence
New test,
runs Craft's queued jobs with Bref's QueueHandler on Craft Cloud[^1]:Unresolvable dependency resolving [... string $connection] in class QueueHandleroverrides the cache, logs, sessions and Craft settings on Craft Cloudfails without the new settings and passes with them.composer cipasses: Pint, PHPStan, 6 tests.[^1]: The AWS client is stubbed with
Aws\MockHandler.QUEUE_CONNECTIONandSQS_QUEUEcome from the environment, as on Lambda.Related issues