feat: route paths to non-web processes via proxy:route
Adds proxy:route:set/remove/clear/report so users can declare path-prefix routes to non-web Procfile processes without hand-writing nginx.conf.sigil. Routes are stored on the proxy plugin as a PropertyMap of path to process:port:strip, with set semantics so each invocation produces a fully-determined state and re-application is idempotent. A proxy-supports-routes capability trigger gates the command per backend - nginx-vhosts, traefik-vhosts, caddy-vhosts, and scheduler-k3s render routes today; openresty-vhosts and haproxy-vhosts refuse until their sidecar images learn a path-prefix vocabulary (tracked in dokku/openresty-docker-proxy#137 and the haproxy sidecar). Closes #8725.
This commit is contained in:
29 files changed
+1539
-7
No files matched your search
@@ -23,6 +23,10 @@ Additional commands:`
|
||||
proxy:disable <app>, Disable proxy for app
|
||||
proxy:enable <app>, Enable proxy for app
|
||||
proxy:report [<app>] [<flag>], Displays a proxy report for one or more apps
|
||||
proxy:route:clear <app>, Removes every path-based route for an app
|
||||
proxy:route:remove <app> <path>, Removes a path-based route from an app
|
||||
proxy:route:report [<app>] [--format json], Displays the path-based routes for an app
|
||||
proxy:route:set <app> <process> <path> [--port port] [--strip-prefix], Adds or updates a path-based route to a non-web process
|
||||
proxy:set <app> <proxy-type>, Set proxy type for app`
|
||||
)
|
||||
|
||||
|
||||
@@ -70,6 +70,32 @@ func main() {
|
||||
value = args.Arg(1)
|
||||
}
|
||||
err = proxy.CommandSet(appName, property, value)
|
||||
case "route:set":
|
||||
args := flag.NewFlagSet("proxy:route:set", flag.ExitOnError)
|
||||
port := args.Int("port", proxy.DefaultRoutePort, "--port: container port of the target process")
|
||||
stripPrefix := args.Bool("strip-prefix", false, "--strip-prefix: strip the matched prefix before forwarding")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
processName := args.Arg(1)
|
||||
path := args.Arg(2)
|
||||
err = proxy.CommandRouteSet(appName, processName, path, *port, *stripPrefix)
|
||||
case "route:remove":
|
||||
args := flag.NewFlagSet("proxy:route:remove", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
path := args.Arg(1)
|
||||
err = proxy.CommandRouteRemove(appName, path)
|
||||
case "route:clear":
|
||||
args := flag.NewFlagSet("proxy:route:clear", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
err = proxy.CommandRouteClear(appName)
|
||||
case "route:report":
|
||||
args := flag.NewFlagSet("proxy:route:report", flag.ExitOnError)
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
err = proxy.CommandRouteReport(appName, *format)
|
||||
default:
|
||||
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ func main() {
|
||||
case "proxy-type":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.TriggerProxyType(appName)
|
||||
case "proxy-routes-list":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.TriggerProxyRoutesList(appName)
|
||||
case "post-app-clone-setup":
|
||||
oldAppName := flag.Arg(0)
|
||||
newAppName := flag.Arg(1)
|
||||
|
||||
Reference in new issue
Block a user