proxyfile

module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0

README

proxyfile

Generates a proxy's config from a short file. Envoy first.

A proxyfile is a short file, written in YAML or in HOCON, that describes one gateway: the services behind it, the routes to them, an optional external auth check, the browser origins it admits and, for RPC routes, the methods. You write it by hand, with a comment beside a value to say why it is there, and the RPC methods can be read from your .proto files. proxyfile render turns it into a complete Envoy configuration, written for Envoy 1.40. The same input always gives the same bytes, so you can commit the generated file and let proxyfile check fail a build when someone edits it by hand or forgets to render.

flowchart LR
    source["proxyfile, YAML or HOCON:<br/>core keys, envoy block"] --> render["proxyfile render<br/>--target envoy"]
    protos[".proto files"] -->|rpc.proto| render
    render --> generated["envoy.yaml<br/>committed"]
    generated --> check["proxyfile check<br/>in the build: renders again,<br/>refuses a drift"]
    check --> validate["envoy --mode validate<br/>in the image"]
    validate --> envoy["Envoy running"]

proxyfile does not run Envoy: an image build can load the committed file with envoy --mode validate, as this repository's scripts/validate-envoy.sh does for the examples.

Install

Download the release file for your system, check it against the published checksum, and put it on your path. The release has proxyfile-linux-amd64, proxyfile-linux-arm64, proxyfile-darwin-amd64 and proxyfile-darwin-arm64, with checksums.txt and proxyfile.schema.json beside them.

curl -fsSLO https://github.com/kitecorp/proxyfile/releases/download/v2.0.0/proxyfile-linux-amd64
curl -fsSLO https://github.com/kitecorp/proxyfile/releases/download/v2.0.0/checksums.txt
shasum -a 256 -c --ignore-missing checksums.txt
install -m 0755 proxyfile-linux-amd64 /usr/local/bin/proxyfile

In a Dockerfile, copy the program out of the image. The image holds /proxyfile and nothing else.

COPY --from=ghcr.io/kitecorp/proxyfile:2.0.0 /proxyfile /usr/local/bin/proxyfile

With Go installed (the Go version go.mod names or newer):

go install github.com/kitecorp/proxyfile/v2/cmd/proxyfile@v2.0.0

Commands

usage: proxyfile render [<file>] -o <envoy.yaml> [--target envoy] [--rpc-methods <methods.json>] [--rpc-table <table.json>]
       proxyfile check [<file>] -o <envoy.yaml> [--target envoy] [--rpc-methods <methods.json>] [--rpc-table <table.json>]
       proxyfile schema
       proxyfile version
  • render writes the Envoy configuration, and with --rpc-table the RPC table, from the proxyfile.
  • check renders in memory and fails when the files on disk differ, so a build refuses a hand edit or a missed render.
  • schema prints the JSON Schema of the format.
  • version prints proxyfile <version>.

docs/commands.md gives the flags, the file names proxyfile looks for, the exit codes and how a problem is printed.

The format

A proxyfile is written in YAML or in HOCON, with the same keys in both, and both give the same bytes. A file named Proxyfile or ending in .conf is HOCON, and one ending in .yaml or .yml is YAML. With no file named, proxyfile reads Proxyfile, proxyfile.conf, proxyfile.yaml or proxyfile.yml from the working directory. Only listen, services, origins and routes are required. docs/format.md holds a file with every key but envoy.tracing, services.<name>.address, rpc.proto and the nginx and haproxy blocks, and the rules across keys, docs/hocon.md the HOCON form, and docs/defaults.md what every gateway gets with no key. docs/portability.md says which keys every proxy can carry and which belong to Envoy alone, and From 1.x to 2.0 which keys a 1.x file moves.

Keys

Each key's page says what it does and holds a table of every key under it, written from the format description that the checker and the schema read. Each key's class follows its link: core for a key every proxy can carry, or the proxy whose block holds it (docs/portability.md).

  • listen (core): The port of the public listener, on 0.0.0.0.
  • admin (core): The port of the admin listener, on 127.0.0.1; no admin listener when not written.
  • limits (core): Limits on connections and request headers.
  • timeouts (core): How long a request, an idle request and an idle connection to a service may last.
  • services (core): The services behind the gateway, on the same host, by name.
  • auth (core): The external check every request goes through before it reaches a service.
  • remove_from_clients (core): Headers removed from every client request before routing and before any filter; a name ending in * is a prefix.
  • cors (core): The CORS settings every environment shares.
  • origins (core): The browser origins each environment admits, by environment name; or, as in 1.0, the name of an origins file, relative to this file.
  • routes (core): The routes, tried in the order written; the rpc entry marks where the RPC routes go.
  • rpc (core): The RPC methods the gateway routes; the routes' rpc entry maps them to services.
  • log (core): Which requests the request log writes.
  • envoy (envoy): The settings only the Envoy generator reads: the namespace of the gateway's metadata, its heap budget, X-Ray tracing and the Connect bridge.
  • nginx (nginx): The settings only nginx will read; this version has no nginx generator, so it takes no key.
  • haproxy (haproxy): The settings only HAProxy will read; this version has no HAProxy generator, so it takes no key.

Editors

proxyfile schema prints the JSON Schema of the format, which gives completion and checking as you type in a YAML proxyfile. docs/editors.md says how to point an editor at it, and how to highlight HOCON.

Licence

Apache-2.0. See LICENSE.

Directories

Path Synopsis
cmd
proxyfile command
Command proxyfile writes an Envoy configuration from a proxyfile.
Command proxyfile writes an Envoy configuration from a proxyfile.
internal
cli
Package cli is the proxyfile program: its commands, flags, messages and exit codes.
Package cli is the proxyfile program: its commands, flags, messages and exit codes.
envoy
Package envoy writes the Envoy configuration of a gateway: it fills the embedded fragments, splices them into one YAML tree and encodes that tree.
Package envoy writes the Envoy configuration of a gateway: it fills the embedded fragments, splices them into one YAML tree and encodes that tree.
format
Package format holds the one description of each input file and checks a file's tree against it.
Package format holds the one description of each input file and checks a file's tree against it.
input
Package input holds the reading step the readers of the input files share: reading a file as far as a tree its description accepts.
Package input holds the reading step the readers of the input files share: reading a file as far as a tree its description accepts.
origins
Package origins reads the browser origins: the CORS settings every environment shares and, for each environment, its hosts and the browser origins it admits.
Package origins reads the browser origins: the CORS settings every environment shares and, for each environment, its hosts and the browser origins it admits.
protofiles
Package protofiles reads a gateway's RPC methods from .proto files: it compiles them in memory and returns each method that carries a method option named by its full name, with that option's action and reports.
Package protofiles reads a gateway's RPC methods from .proto files: it compiles them in memory and returns each method that carries a method option named by its full name, with that option's action and reports.
quote
Package quote writes text as a JSON string, the form the RPC table and the generated Envoy file both carry.
Package quote writes text as a JSON string, the form the RPC table and the generated Envoy file both carry.
read
Package read turns a proxyfile into the model, or into the problems that stop the run.
Package read turns a proxyfile into the model, or into the problems that stop the run.
render
Package render reads every input of one run and returns every output, in memory, so a caller writes nothing when any input has a problem.
Package render reads every input of one run and returns every output, in memory, so a caller writes nothing when any input has a problem.
rpc
Package rpc reads the RPC methods, from the proxyfile's rpc.methods or from a methods file, gives each method the service the proxyfile's rpc entry maps it to, and writes the RPC table: the routes as JSON, one object per line.
Package rpc reads the RPC methods, from the proxyfile's rpc.methods or from a methods file, gives each method the service the proxyfile's rpc entry maps it to, and writes the RPC table: the routes as JSON, one object per line.
testsupport
Package testsupport holds the helpers the tests of several packages share.
Package testsupport holds the helpers the tests of several packages share.
tree
Package tree is the boundary between a file's syntax and everything that reads it.
Package tree is the boundary between a file's syntax and everything that reads it.

Jump to

Keyboard shortcuts

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