Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 7, 2023

Fixes #828 #858

Problem

The compute serve subcommand requires Viceroy to be installed but some users have had problems with the Fastly CLI handling the downloading of the required Viceroy binary 'out-of-band'.

Examples of this are:

  • When the CLI needs to be packaged alongside an external version of Viceroy (e.g. NixOS packaging).
  • When the CLI is run inside Docker/CI and the network can be flaky (causing timeouts to be reached).

Solution

To solve this issue the user needs to be able to have the Fastly CLI use a version of the Viceroy binary that they have installed separately from the CLI (e.g. as part of a CI pipeline the user would manually install Viceroy, then install/run the Fastly CLI and inform it of where the Viceroy binary exists).

This PR introduces two new behaviours...

  1. A new --viceroy-path flag.
  2. A new FASTLY_VICEROY_USE_PATH environment variable.

--viceroy-path

A new --viceroy-path=<PATH_TO_VICEROY_BINARY> flag on the compute serve subcommand.

If set the Fastly CLI will use the version of the viceroy binary that the given path references.

If the --verbose flag is set, then the CLI will display the following INFO log output:

INFO: Using user provided install of Viceroy via --viceroy-path flag: /your/given/path/to/viceroy

FASTLY_VICEROY_USE_PATH

If the environment variable FASTLY_VICEROY_USE_PATH is set to either 1, true or TRUE then the CLI will attempt to lookup the viceroy binary from the user's $PATH.

FASTLY_VICEROY_USE_PATH=1 fastly compute serve

Screenshot 2023-03-07 at 11 17 19

If passing the --verbose flag (and the binary exists in the user's PATH), then you'll see an INFO log indicating where the viceroy binary is being sourced from.

@Integralist Integralist added the enhancement New feature or request label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetching latest Viceroy release makes running in a container unreliable

2 participants