From 385b7c413434840d1af36efbe95314a998fb9385 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 1 Jul 2022 14:48:22 +0200 Subject: [PATCH] docs - add docs for custom config using labels --- docs/quickstart-guide.md | 47 +++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/docs/quickstart-guide.md b/docs/quickstart-guide.md index 12752043d..08a0a20f5 100644 --- a/docs/quickstart-guide.md +++ b/docs/quickstart-guide.md @@ -1142,29 +1142,30 @@ Some integrations offer a more convenient way of applying configurations for exa When using the [Docker integration](/1.4/integrations/#docker), you have two choices for adding custom configurations : - - Using specific settings `*_CUSTOM_CONF_*` as environment variable (easiest) + - Using specific settings `*_CUSTOM_CONF_*` as environment variables (easiest) - Writing .conf files to the volume mounted on /data **Using settings** - The custom setting to use must follow the pattern `_CUSTOM_CONF__` : + The settings to use must follow the pattern `_CUSTOM_CONF__` : - `` : optional primary server name if multisite mode is enabled and the config must be applied to a specific service - `` : the type of config, accepted values are `HTTP`, `DEFAULT_SERVER_HTTP`, `SERVER_HTTP`, `MODSEC` and `MODSEC_CRS` - - `` : the name of your config without the .conf suffix + - `` : the name of config without the .conf suffix Here is a dummy example using a docker-compose file : ```yaml - mybunker: + mybunker: image: bunkerity/bunkerweb:1.4.2 environment: - | - CUSTOM_CONF_SERVER_HTTP_test= + CUSTOM_CONF_SERVER_HTTP_hello-world= location /hello { default_type 'text/plain'; content_by_lua_block { - ngx.say('world') - } + ngx.say('world') + } + } ... ``` @@ -1211,7 +1212,37 @@ Some integrations offer a more convenient way of applying configurations for exa === "Docker autoconf" - When using the [Docker autoconf integration](/1.4/integrations/#docker-autoconf), custom configurations must be written to the volume mounted on /data. + When using the [Docker autoconf integration](/1.4/integrations/#docker-autoconf), you have two choices for adding custom configurations : + + - Using specific settings `*_CUSTOM_CONF_*` as labels (easiest) + - Writing .conf files to the volume mounted on /data + + **Using labels** + + !!! info "Limitations using labels" + When using labels with the Docker autoconf integration, you can only apply custom configurations for the corresponding web service. Applying **http**, **default-server-http** and any global configurations is not possible. + + The labels to use must follow the pattern `bunkerweb.CUSTOM_CONF__` : + + - `` : the type of config, accepted values are `SERVER_HTTP`, `MODSEC` and `MODSEC_CRS` + - `` : the name of config without the .conf suffix + + Here is a dummy example using a docker-compose file : + ```yaml + myapp: + image: nginxdemos/hello:plain-text + labels: + - | + CUSTOM_CONF_SERVER_HTTP_hello-world= + location /hello { + default_type 'text/plain'; + content_by_lua_block { + ngx.say('world') + } + ... + ``` + + **Using files** The first thing to do is to create the folders : ```shell