velox

package module
v3.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Velox

Velox builds a custom RoadRunner binary from the plugin list in velox.toml. It downloads the RoadRunner source for the requested ref, renders container/plugins.go, applies the requested plugin versions plus any replace and exclude directives through go mod edit, runs go mod tidy, and compiles the binary with go build.

Documentation: docs.roadrunner.dev/customization/build.

Installation

vx runs the go command to build RoadRunner, so install Go 1.27 or later. The container image includes Go.

Go
go install github.com/roadrunner-server/velox/v3/cmd/vx@latest

Migration: releases before v3 install from github.com/roadrunner-server/velox/v2025/cmd/vx.

Release archive

Each release has a velox-<version>-<os>-<arch>.tar.gz archive for linux and darwin on amd64 and arm64. The archive holds vx, the sample velox.toml, README.md, and LICENSE:

curl -fsSL https://github.com/roadrunner-server/velox/releases/download/v3.2.0/velox-3.2.0-linux-amd64.tar.gz | tar -xz
./velox-3.2.0-linux-amd64/vx --version
Docker
docker pull ghcr.io/roadrunner-server/velox:3.2.0

Images are published to ghcr.io/roadrunner-server/velox and spiralscout/velox. The image tag is the release tag without the leading v. A stable release also moves latest, the major tag (3), and the minor tag (3.2). The entrypoint is vx, and the image ships the sample config at /etc/velox.toml. The image sets GOTOOLCHAIN=auto, so go downloads a newer Go version when the RoadRunner go.mod requires it.

docker run --rm \
  -e GITHUB_TOKEN \
  -v "$PWD/velox.toml:/etc/velox.toml" \
  -v "$PWD:/output" \
  ghcr.io/roadrunner-server/velox:3.2.0 build -c /etc/velox.toml -o /output

The docker-compose.yml in this repository builds the image from source and runs build -c=/etc/velox.toml -o=/tmp/; uncomment the volume mapping there to copy the produced binary to the host.

Usage

vx build -c velox.toml -o .
  • -c, --config: path to the configuration file, default velox.toml.
  • -o, --out: output directory for the produced rr binary, default the current directory.
  • --version: velox version and build time.

Both flags are persistent, so vx -c velox.toml build -o . works as well. The build downloads the RoadRunner source into a temporary directory that is removed when the command returns.

Minimal velox.toml

[roadrunner]
ref = "master"

[github.token]
token = "${GITHUB_TOKEN}"

[log]
level = "debug"
mode = "production"

[plugins.logger]
tag = "latest"
module_name = "github.com/roadrunner-server/logger/v6"

[plugins.server]
tag = "latest"
module_name = "github.com/roadrunner-server/server/v6"

[plugins.rpc]
tag = "latest"
module_name = "github.com/roadrunner-server/rpc/v6"

[plugins.http]
tag = "latest"
module_name = "github.com/roadrunner-server/http/v6"

The velox.toml shipped in this repository is the full sample: it lists every plugin that RoadRunner master registers.

Configuration reference

[roadrunner]
  • ref: tag, branch, or 40-character commit SHA of roadrunner-server/roadrunner. Default master. A valid semver value (v3.2.0) downloads refs/tags, a 40-character hex value downloads that commit, anything else downloads refs/heads.
[github] and [github.token]
  • base_url: GitHub host, default https://github.com. Set it to a GitHub Enterprise host (https://ghe.example.com) to download the source from a private installation; the archive paths and the Authorization header are the same as on github.com. Only the host is configurable: the mirror must live at <base_url>/roadrunner-server/roadrunner.
  • token: personal access token used for the download. ${ENV_VAR} is expanded from the environment. It is sent as a bearer Authorization header and dropped on a redirect to another host.
[target_platform]
  • os: target GOOS, default the host GOOS. windows is rejected.
  • arch: target GOARCH, default the host GOARCH.

Either key may be omitted on its own; the host value fills it. Every build reuses the caller module and build caches (Go keys build cache entries by target). A cross build skips the rr --version smoke test.

[log]
  • level: debug, info, warn, or error.
  • mode: production, development, raw, or none (off is an alias). Default when the section is absent: level debug, mode development.
[debug]
  • enabled: compiles with -gcflags "all=-N -l" -tags debug and keeps the symbol table for a debugger.
  • race: compiles with -race (sets CGO_ENABLED=1). Requires a C toolchain for the target platform. The Docker image includes GCC and musl development headers for native Linux builds.
[plugins.<name>]
  • module_name: full Go module path of the plugin, including the major-version suffix; each module may be listed once.
  • tag: semver version to require, or a non-semver ref (latest, a branch, a commit) that skips the post-tidy version check.

informer and resetter are compiled in from the versions the downloaded RoadRunner requires. Listing either of them here is skipped with a warning, because a user entry would register the plugin twice.

[[replaces]]

Maps to a go.mod replace directive applied before go mod tidy.

[[replaces]]
new = "../local-fork"
old = "github.com/foo/bar"

[[replaces]]
new = "github.com/me/bar-fork@v1.2.3-patched"
old = "github.com/foo/bar@v1.2.3"
  • Both fields are single strings; embed the version inline with @.
  • A local path in new (., .., ./, ../, or absolute) must not carry an @version. An @ inside a directory name is fine: only a trailing @<semver> counts as a version.
  • Neither field may contain =.
  • old must be unique across the list.
  • A relative local path in new resolves against the working directory of vx, not against the downloaded source tree.
[[excludes]]

Maps to a go.mod exclude directive applied before go mod tidy.

[[excludes]]
module = "github.com/redis/go-redis/v9"
version = "v9.15.0"
  • version must be a canonical semver version (v9.15.0, not v9.15) whose major matches the module path (/v9 needs v9.x.y).

Plugin compatibility

  • Supported: RoadRunner v3 (the /v3 module line) with the /v6 plugins. RoadRunner v2025.x releases pair with the /v5 plugins and velox v2025.
  • All plugins in one build must share the same major version: http/v6 with logger/v6, never http/v6 with logger/v5.
  • Do not point plugins at a master branch.

Notes

  • Windows build targets are not supported in velox v3.
  • Pin plugin tags for reproducible builds. A tag that is not a semver version (latest, a branch, a commit) skips the post-tidy version check, so the resolved version depends on when the build runs.
  • Plugins are registered in module-path order, so the same plugin set renders the same container/plugins.go.
  • Each build compiles the binary in a unique temporary directory inside the output directory. The binary is renamed to rr after rr --version prints the requested ref; a cross build skips that check.
  • -trimpath is always set, and SOURCE_DATE_EPOCH is honored for the injected build timestamp.

Releases

Release Please updates a release PR on master from Conventional Commits. It updates CHANGELOG.md and .release-please-manifest.json. Merge the release PR to create the tag and GitHub release. The release workflow then builds the vx archives and the container images.

Documentation

Overview

Package velox defines configuration types and validation used by Velox builds.

Index

Constants

View Source
const (

	// RefKey, LogLevelKey, and LogModeKey are the velox.toml keys of the Roadrunner and Log maps.
	RefKey      = "ref"
	LogLevelKey = "level"
	LogModeKey  = "mode"
)

Variables

View Source
var ErrWindowsTarget = errors.New("velox v3 does not support Windows targets")

Functions

func IsLocalPath

func IsLocalPath(s string) bool

IsLocalPath reports whether s denotes a local filesystem path, using the predicate `go mod edit -replace` applies to its operand.

func ValidateRef

func ValidateRef(ref string) error

ValidateRef rejects refs carrying characters that are unsafe in the unquoted -ldflags value.

func ValidateTargetOS

func ValidateTargetOS(goos string) error

ValidateTargetOS rejects target operating systems that velox v3 does not support.

Types

type Config

type Config struct {
	Roadrunner     map[string]string  `mapstructure:"roadrunner"`
	Debug          *Debug             `mapstructure:"debug"`
	Log            map[string]string  `mapstructure:"log"`
	TargetPlatform *TargetPlatform    `mapstructure:"target_platform"`
	GitHub         *GitHub            `mapstructure:"github"`
	Plugins        map[string]*Plugin `mapstructure:"plugins"`
	Replaces       []Replace          `mapstructure:"replaces"`
	Excludes       []Exclude          `mapstructure:"excludes"`
}

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration, applies the defaults, and expands ${ENV} in the GitHub token.

type Debug

type Debug struct {
	Enabled bool `mapstructure:"enabled"`
	Race    bool `mapstructure:"race"`
}

type Exclude

type Exclude struct {
	Module  string `mapstructure:"module"`
	Version string `mapstructure:"version"`
}

Exclude mirrors `exclude module version` in go.mod.

func (Exclude) Validate

func (e Exclude) Validate() error

type GitHub

type GitHub struct {
	Token   *Token `mapstructure:"token"`
	BaseURL string `mapstructure:"base_url"`
}

type Plugin

type Plugin struct {
	Tag        string `mapstructure:"tag"`
	ModuleName string `mapstructure:"module_name"`
}

type Replace

type Replace struct {
	New string `mapstructure:"new"`
	Old string `mapstructure:"old"`
}

Replace mirrors `replace old => new` in go.mod, with the version embedded inline as "module@v1.2.3".

func (Replace) Validate

func (r Replace) Validate() error

type TargetPlatform

type TargetPlatform struct {
	OS   string `mapstructure:"os"`
	Arch string `mapstructure:"arch"`
}

type Token

type Token struct {
	Token string `mapstructure:"token"`
}

Directories

Path Synopsis
Package builder assembles a custom RoadRunner binary from the downloaded source tree and the user plugin set.
Package builder assembles a custom RoadRunner binary from the downloaded source tree and the user plugin set.
templates
Package templates renders the generated container/plugins.go that registers the RoadRunner plugins.
Package templates renders the generated container/plugins.go that registers the RoadRunner plugins.
cmd
vx command
Package main provides the vx CLI entrypoint.
Package main provides the vx CLI entrypoint.
Package github downloads and extracts the RoadRunner source tree from a GitHub tag, branch, or commit SHA.
Package github downloads and extracts the RoadRunner source tree from a GitHub tag, branch, or commit SHA.
internal
cli
Package cli wires the root cobra command and shared CLI setup.
Package cli wires the root cobra command and shared CLI setup.
cli/build
Package build implements the `vx build` subcommand that downloads RoadRunner and produces a custom binary.
Package build implements the `vx build` subcommand that downloads RoadRunner and produces a custom binary.
version
Package version exposes build-time version and timestamp helpers.
Package version exposes build-time version and timestamp helpers.
Package logger builds the *slog.Logger used by the CLI in production, development, raw, or none mode.
Package logger builds the *slog.Logger used by the CLI in production, development, raw, or none mode.
Package plugin describes a RoadRunner plugin entry and how it renders into the generated container/plugins.go.
Package plugin describes a RoadRunner plugin entry and how it renders into the generated container/plugins.go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL