PoC: embed Viceroy directly into the fastly binary#1805
Draft
jedisct1 wants to merge 1 commit into
Draft
Conversation
This allows shipping Viceroy inside the fastly binary so the common path becomes pure local extraction. No more downloads. The embedded binary lives behind a `viceroy_embed` build tag. Without the tag, fastly builds and behaves exactly as before. On first run the binary is decompressed. It's embedded as ztd-compressed to avoid bloating the binary too much if viceroy is not used - Each per-platform release archive grows by 8-10 MB. We already require klauspost/compress so no new dependencies are required. Extraction failures or version mismatches fall through to the existing download flow untouched, as do --viceroy-path and FASTLY_VICEROY_USE_PATH. The pinned Viceroy version is the contents of pkg/embedded/viceroy/VICEROY_VERSION, currently 0.18.0. Bumping it is a one-line edit followed by a checksums refresh. "make build-embedded" builds a CLI executable with Viceroy embedded.
5 tasks
kpfleming
pushed a commit
that referenced
this pull request
Jul 7, 2026
) ### Change summary The container images (`Dockerfile-go`, `Dockerfile-node`, `Dockerfile-rust`) re-download Viceroy on each container start (raised in #1828 (review)), this PR adds an explicit `fastly compute install-viceroy` command that downloads and installs the Viceroy local-testing binary. #### Implementation Rather than duplicate the download logic, the existing installer was extracted out into a shared `viceroyInstaller` (`pkg/commands/compute/viceroy.go`). Both `compute serve` and the new command call it, so every version/override mechanism (the manifest's `[local_server] viceroy_version`, `FASTLY_VICEROY_USE_PATH`) applies identically during a pre-install. `ServeCommand.GetViceroy` is now a thin wrapper, so behavior is unchanged. This is intentionally simpler than #1805 (which embeds binaries into the CLI binary). All Submissions: * [x] Have you followed the guidelines in our Contributing document? * [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? ### New Feature Submissions: * [x] Does your submission pass tests? ### Changes to Core Features: * [x] Have you written new tests for your core changes, as applicable? * [x] Have you successfully run tests with your changes locally? ### User Impact A new `fastly compute install-viceroy` command lets users (and the container images) pre-install Viceroy ahead of time, so `compute serve` can start without needing to download it. No change to existing behavior - `compute serve` still installs Viceroy on demand if it isn't already present. ### Are there any considerations that need to be addressed for release? None. No breaking changes - the command is purely additive and the shared extraction keeps `compute serve`'s install path identical.
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.
Change summary
This allows shipping Viceroy inside the fastly binary so the common path becomes pure local extraction. No more downloads.
The embedded binary lives behind a
viceroy_embedbuild tag. Without the tag, fastly builds and behaves exactly as before.On first run the binary is decompressed. It's embedded as zstd-compressed to avoid bloating the binary too much if Viceroy is not used — each per-platform release archive grows by 8-10 MB. We already require
klauspost/compressso no new dependencies are required.Extraction failures or version mismatches fall through to the existing download flow untouched, as do
--viceroy-pathandFASTLY_VICEROY_USE_PATH.The pinned Viceroy version is the contents of
pkg/embedded/viceroy/VICEROY_VERSION, currently0.18.0. Bumping it is a one-line edit followed by a checksums refresh.make build-embeddedbuilds a CLI executable with Viceroy embedded.All Submissions:
New Feature Submissions:
Changes to Core Features:
User Impact
End users get a self-contained
fastlybinary (when built withviceroy_embed) that runsfastly compute serveoffline, with no network round-trip to fetch Viceroy on first use. Default builds are unaffected.Are there any considerations that need to be addressed for release?
Per-platform release archives grow by 8-10 MB when built with the
viceroy_embedtag.No breaking changes; the download path remains the fallback and existing overrides (
--viceroy-path,FASTLY_VICEROY_USE_PATH) continue to work.