fix missing backslashes in autoconf custom configs and add missing full reload after custom configs update
This commit is contained in:
parent
622f2eb2ac
commit
8b54073a7e
|
@ -124,13 +124,13 @@ jobs:
|
|||
category: "/language:${{matrix.language}}"
|
||||
|
||||
# Create infrastructures
|
||||
# create-infra-docker:
|
||||
# needs: [code-security, build-bw, build-scheduler]
|
||||
# uses: ./.github/workflows/staging-create-infra.yml
|
||||
# with:
|
||||
# TYPE: docker
|
||||
# secrets:
|
||||
# CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
|
||||
create-infra-docker:
|
||||
needs: [code-security, build-bw, build-scheduler]
|
||||
uses: ./.github/workflows/staging-create-infra.yml
|
||||
with:
|
||||
TYPE: docker
|
||||
secrets:
|
||||
CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
|
||||
# create-infra-autoconf:
|
||||
# needs: [code-security, build-bw, build-scheduler, build-autoconf]
|
||||
# uses: ./.github/workflows/staging-create-infra.yml
|
||||
|
@ -170,13 +170,13 @@ jobs:
|
|||
# CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
|
||||
|
||||
# Perform tests
|
||||
# tests-docker:
|
||||
# needs: [create-infra-docker]
|
||||
# uses: ./.github/workflows/staging-tests.yml
|
||||
# with:
|
||||
# TYPE: docker
|
||||
# RUNS_ON: "['self-hosted', 'bw-docker']"
|
||||
# secrets: inherit
|
||||
tests-docker:
|
||||
needs: [create-infra-docker]
|
||||
uses: ./.github/workflows/staging-tests.yml
|
||||
with:
|
||||
TYPE: docker
|
||||
RUNS_ON: "['self-hosted', 'bw-docker']"
|
||||
secrets: inherit
|
||||
# tests-autoconf:
|
||||
# needs: [create-infra-autoconf]
|
||||
# uses: ./.github/workflows/staging-tests.yml
|
||||
|
@ -215,14 +215,14 @@ jobs:
|
|||
# PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
|
||||
|
||||
# Delete infrastructures
|
||||
# delete-infra-docker:
|
||||
# if: ${{ always() }}
|
||||
# needs: [tests-docker]
|
||||
# uses: ./.github/workflows/staging-delete-infra.yml
|
||||
# with:
|
||||
# TYPE: docker
|
||||
# secrets:
|
||||
# CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
|
||||
delete-infra-docker:
|
||||
if: ${{ always() }}
|
||||
needs: [tests-docker]
|
||||
uses: ./.github/workflows/staging-delete-infra.yml
|
||||
with:
|
||||
TYPE: docker
|
||||
secrets:
|
||||
CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
|
||||
# delete-infra-autoconf:
|
||||
# if: ${{ always() }}
|
||||
# needs: [tests-autoconf]
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_drupal_modsec_crs
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs cfg_drupal_modsec_crs -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec-crs/drupal.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs -l bunkerweb.CONFIG_SITE=www.example.com cfg_drupal_modsec_crs ./bw-data/configs/modsec-crs/drupal.conf
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_gogs_modsec_crs
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs cfg_gogs_modsec_crs -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec-crs/gogs.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs -l bunkerweb.CONFIG_SITE=www.example.com cfg_gogs_modsec_crs ./bw-data/configs/modsec-crs/gogs.conf
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_magento_server_http
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=server-http cfg_magento_server_http -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/server-http/buffering.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=server-http -l bunkerweb.CONFIG_SITE=www.example.com cfg_magento_server_http ./bw-data/configs/server-http/buffering.conf
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_me_modsec
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec -l bunkerweb.CONFIG_SITE=www.example.com cfg_me_modsec ./bw-data/configs/modsec/www.example.com/mongo-express.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec -l bunkerweb.CONFIG_SITE=www.example.com cfg_me_modsec ./bw-data/configs/modsec/mongo-express.conf
|
|
@ -11,5 +11,5 @@ docker config rm cfg_nextcloud_modsec
|
|||
docker config rm cfg_nextcloud_modsec_crs
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec cfg_nextcloud_modsec -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec/nextcloud.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs cfg_nextcloud_modsec_crs -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec-crs/nextcloud.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec -l bunkerweb.CONFIG_SITE=www.example.com cfg_nextcloud_modsec ./bw-data/configs/modsec/nextcloud.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs -l bunkerweb.CONFIG_SITE=www.example.com cfg_nextcloud_modsec_crs ./bw-data/configs/modsec-crs/nextcloud.conf
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_reverse_server_http
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=server-http cfg_reverse_server_http -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/server-http/redirects.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=server-http -l bunkerweb.CONFIG_SITE=www.example.com cfg_reverse_server_http ./bw-data/configs/server-http/redirects.conf
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
docker config rm cfg_wordpress_modsec_crs
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs cfg_wordpress_modsec_crs -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec-crs/wordpress.conf
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs -l bunkerweb.CONFIG_SITE=www.example.com cfg_wordpress_modsec_crs ./bw-data/configs/modsec-crs/wordpress.conf
|
|
@ -621,10 +621,16 @@ class Database:
|
|||
to_put = []
|
||||
endl = "\n"
|
||||
for custom_config in custom_configs:
|
||||
# config = {
|
||||
# "data": custom_config["value"].replace("\\\n", "\n").encode("utf-8")
|
||||
# if isinstance(custom_config["value"], str)
|
||||
# else custom_config["value"].replace(b"\\\n", b"\n"),
|
||||
# "method": method,
|
||||
# }
|
||||
config = {
|
||||
"data": custom_config["value"].replace("\\\n", "\n").encode("utf-8")
|
||||
"data": custom_config["value"].encode("utf-8")
|
||||
if isinstance(custom_config["value"], str)
|
||||
else custom_config["value"].replace(b"\\\n", b"\n"),
|
||||
else custom_config["value"],
|
||||
"method": method,
|
||||
}
|
||||
config["checksum"] = sha256(config["data"]).hexdigest()
|
||||
|
|
|
@ -214,12 +214,12 @@ if __name__ == "__main__":
|
|||
"Kubernetes",
|
||||
"Autoconf",
|
||||
):
|
||||
err = db.set_autoconf_load(False)
|
||||
if err:
|
||||
success = False
|
||||
logger.error(
|
||||
f"Can't set autoconf loaded metadata to false in database: {err}",
|
||||
)
|
||||
# err = db.set_autoconf_load(False)
|
||||
# if err:
|
||||
# success = False
|
||||
# logger.error(
|
||||
# f"Can't set autoconf loaded metadata to false in database: {err}",
|
||||
# )
|
||||
|
||||
while not db.is_autoconf_loaded():
|
||||
logger.warning(
|
||||
|
@ -481,10 +481,11 @@ if __name__ == "__main__":
|
|||
f"Error while reloading nginx - returncode: {proc.returncode} - error: {proc.stderr.decode('utf-8')}",
|
||||
)
|
||||
else:
|
||||
if api_caller._send_to_apis("POST", "/reload"):
|
||||
logger.info("Successfuly reloaded nginx")
|
||||
else:
|
||||
logger.error("Error while reloading nginx")
|
||||
need_reload = True
|
||||
# if api_caller._send_to_apis("POST", "/reload"):
|
||||
# logger.info("Successfuly reloaded nginx")
|
||||
# else:
|
||||
# logger.error("Error while reloading nginx")
|
||||
|
||||
# check if the plugins have changed since last time
|
||||
tmp_external_plugins = db.get_plugins(external=True)
|
||||
|
|
Loading…
Reference in New Issue