Instance Configuration
Each Allegro deploy builds one worker bundle and records it as an edge release. When automatic deploys are on, a new release is rolled out to every organization that opted in.
Environment Variables
| Variable | Default | Description |
|---|---|---|
EDGE_AUTO_DEPLOY | false | Lets new releases, settings changes, and the nightly retry deploy workers on their own. Set true in production only. |
EDGE_BUNDLE_PATH | packages/allegro-edge/worker/dist/manifest.json | Where the built worker bundle is read from. The default matches the build output; you rarely need to set it. |
The Cloudflare OAuth client variables (EDGE_CLOUDFLARE_*) are covered in
Cloudflare OAuth for Edge.
With EDGE_AUTO_DEPLOY on, an instance pushes to the customer's real Cloudflare
account. Leave it off on local and staging instances so they never overwrite a
production worker.
What EDGE_AUTO_DEPLOY Controls
| Action | Auto deploy off | Auto deploy on |
|---|---|---|
| A new release is recorded | Recorded, not deployed | Deployed to every opted-in property |
| An organization connects Cloudflare | Nothing deployed | Deploys its Edge-enabled properties |
| A property's Edge settings change | Nothing changes in Cloudflare | Redeploys, or removes routes when Edge is turned off |
| Nightly retry of failed deploys (04:00) | Skipped | Retries each property whose last deploy failed |
| Deploy now and Roll back on a property | Work | Work |
Build Step
The root npm run build (and npm run build:ssr) finishes with
npm run edge:bundle. That runs a Wrangler dry-run upload of the worker and
writes packages/allegro-edge/worker/dist/manifest.json, which holds the
bundled modules, the worker metadata, and a content hash. The hash identifies
the release: it changes only when the worker code or its Wrangler config
changes.
The bundle is a build artifact and is not committed. Every server that runs queue workers needs the same build, because deploy jobs upload the bundle from local disk.
Release Step
The Composer deploy script runs php artisan edge:release after migrations.
The command:
- Reads the bundle at
EDGE_BUNDLE_PATH. If it's missing, it warns and exits successfully so the app deploy is not blocked. - Records the bundle hash as an edge release, once per hash.
- When the hash is new and
EDGE_AUTO_DEPLOYis on, queues a rollout to every organization.
The rollout runs on the bulk queue. Each property's deploy job carries the
release hash; if it lands on a queue worker that still has the previous bundle
(old workers are draining during an app deploy), it requeues itself until a
worker with the new bundle picks it up. A property whose worker already runs the
release with the same configuration is skipped.
Related
- Deploying the Worker for what a deploy does in Cloudflare.
- Queue Management for the
bulkqueue.