From c809840c907dc1bbcc99c122d0d5e7be83fed02e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 8 Jun 2018 08:59:12 -0700 Subject: [PATCH] website: clarify custom proxy integration and custom managed proxies --- website/source/docs/connect/proxies.html.md | 43 ++++++++++++++++++- .../docs/connect/proxies/integrate.html.md | 3 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/website/source/docs/connect/proxies.html.md b/website/source/docs/connect/proxies.html.md index ed49225c2c..492b922f3b 100644 --- a/website/source/docs/connect/proxies.html.md +++ b/website/source/docs/connect/proxies.html.md @@ -124,7 +124,7 @@ service. "config": { "upstreams": [{ "destination_name": "nearest-redis", - "destination_type": "prepared_query", + "destination_type": "prepared_query", "local_bind_port": 1234 }] } @@ -147,6 +147,47 @@ with Connect. After natively integrating, the HTTP API or [DNS interface](/docs/agent/dns.html#connect-capable-service-lookups) can be used. +### Custom Managed Proxy + +[Custom proxies](/docs/connect/proxies/integrate.html) can also be +configured to run as a managed proxy. To configure custom proxies, specify +an alternate command to execute for the proxy: + +``` +{ + "service": "web", + "connect": { + "proxy": { + "exec_mode": "daemon", + "command": ["/usr/bin/my-proxy", "-flag-example"] + } + } + } +} +``` + +The `exec_mode` value specifies how the proxy is executed. The only +supported value at this time is "daemon". The command is the binary and +any arguments to execute. +The "daemon" mode expects a proxy to run as a long-running, blocking +process. It should not double-fork into the background. The custom +proxy should retrieve its configuration (such as the port to run on) +via the [custom proxy integration APIs](/docs/connect/proxies/integrate.html). + +The default proxy command can be changed at an agent-global level +in the agent configuration. An example in HCL format is shown below. + +``` +connect { + proxy_defaults { + command = ["/usr/bin/my-proxy"] + } +} +``` + +With this configuration, all services registered without an explicit +proxy command will use `my-proxy` instead of the default built-in proxy. + ## Unmanaged Proxies Unmanaged proxies are regular Consul services that are registered as a diff --git a/website/source/docs/connect/proxies/integrate.html.md b/website/source/docs/connect/proxies/integrate.html.md index 63a6cc5a61..ef509110f1 100644 --- a/website/source/docs/connect/proxies/integrate.html.md +++ b/website/source/docs/connect/proxies/integrate.html.md @@ -52,7 +52,8 @@ root certificates from the ## Managed Mode Support -If the proxy could run as a managed proxy, then it should accept the following +Any custom proxy can also run as a [custom managed proxy](/docs/connect/proxies.html#custom-managed-proxy). +If you want the proxy you're integrating to support this mode, then it should accept two environment variables that Consul populates on process startup. These are both required to make the necessary API requests for configuration.