feat: inject docker labels when nginx proxy implementation is in use

This will allow users to switch to a docker label-based nginx proxy server transparently without rebuilds (after the first one), which would mimic how the caddy, haproxy, and traefik proxy implementations work.

See https://github.com/dokku/nginx-docker-proxy for an example server implementation.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-25 00:36:38 -04:00
parent 4bc3de5540
commit 3f127a7cc4
4 changed files with 134 additions and 19 deletions

View File

@@ -39,17 +39,17 @@ cmd-nginx-report-single() {
local flag_map=(
"--nginx-access-log-format: $(fn-nginx-access-log-format "$APP")"
"--nginx-access-log-path: $(fn-nginx-access-log-path "$APP")"
"--nginx-bind-address-ipv4: $(fn-plugin-property-get-default "nginx" "$APP" "bind-address-ipv4" "")"
"--nginx-bind-address-ipv6: $(fn-plugin-property-get-default "nginx" "$APP" "bind-address-ipv6" "::")"
"--nginx-client-max-body-size: $(fn-plugin-property-get-default "nginx" "$APP" "client-max-body-size" "")"
"--nginx-bind-address-ipv4: $(fn-nginx-bind-address-ipv4 "$APP")"
"--nginx-bind-address-ipv6: $(fn-nginx-bind-address-ipv6 "$APP")"
"--nginx-client-max-body-size: $(fn-nginx-client-max-body-size "$APP")"
"--nginx-disable-custom-config: $(fn-plugin-property-get-default "nginx" "$APP" "disable-custom-config" "false")"
"--nginx-error-log-path: $(fn-nginx-error-log-path "$APP")"
"--nginx-global-hsts: $(fn-plugin-property-get-default "nginx" "--global" "hsts" "true")"
"--nginx-computed-hsts: $(fn-nginx-hsts-is-enabled "$APP")"
"--nginx-hsts: $(fn-plugin-property-get-default "nginx" "$APP" "hsts" "")"
"--nginx-hsts-include-subdomains: $(fn-plugin-property-get-default "nginx" "$APP" "hsts-include-subdomains" "true")"
"--nginx-hsts-max-age: $(fn-plugin-property-get-default "nginx" "$APP" "hsts-max-age" "15724800")"
"--nginx-hsts-preload: $(fn-plugin-property-get-default "nginx" "$APP" "hsts-preload" "false")"
"--nginx-hsts-include-subdomains: $(fn-nginx-hsts-include-subdomains "$APP")"
"--nginx-hsts-max-age: $(fn-nginx-hsts-max-age "$APP")"
"--nginx-hsts-preload: $(fn-nginx-hsts-preload "$APP")"
"--nginx-computed-nginx-conf-sigil-path: $(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
"--nginx-global-nginx-conf-sigil-path: $(fn-nginx-global-nginx-conf-sigil-path)"
"--nginx-nginx-conf-sigil-path: $(fn-nginx-nginx-conf-sigil-path "$APP")"
@@ -59,10 +59,10 @@ cmd-nginx-report-single() {
"--nginx-proxy-busy-buffers-size: $(fn-nginx-proxy-busy-buffers-size "$APP")"
"--nginx-proxy-read-timeout: $(fn-nginx-proxy-read-timeout "$APP")"
"--nginx-last-visited-at: $(fn-nginx-vhosts-last-visited-at "$APP")"
"--nginx-x-forwarded-for-value: $(fn-plugin-property-get-default "nginx" "$APP" "x-forwarded-for-value" "\$remote_addr")"
"--nginx-x-forwarded-port-value: $(fn-plugin-property-get-default "nginx" "$APP" "x-forwarded-port-value" "\$server_port")"
"--nginx-x-forwarded-proto-value: $(fn-plugin-property-get-default "nginx" "$APP" "x-forwarded-proto-value" "\$scheme")"
"--nginx-x-forwarded-ssl: $(fn-plugin-property-get-default "nginx" "$APP" "x-forwarded-ssl" "")"
"--nginx-x-forwarded-for-value: $(fn-nginx-x-forwarded-for-value "$APP")"
"--nginx-x-forwarded-port-value: $(fn-nginx-x-forwarded-port-value "$APP")"
"--nginx-x-forwarded-proto-value: $(fn-nginx-x-forwarded-proto-value "$APP")"
"--nginx-x-forwarded-ssl: $(fn-nginx-x-forwarded-ssl "$APP")"
)
if [[ -z "$INFO_FLAG" ]]; then