From d331131c0990beadc7fe5e5dba40f2735439b274 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 22 Mar 2023 16:24:48 +0100 Subject: [PATCH] increase timeout for php-multisite, add API_LISTEN_IP setting, edit default variables.env for Linux and add more logs for tests --- examples/php-multisite/docker-compose.yml | 5 ++++- examples/php-multisite/tests.json | 2 +- src/common/confs/api.conf | 4 +++- src/common/settings.json | 9 +++++++++ src/linux/scripts/start.sh | 8 +++++--- tests/KubernetesTest.py | 5 +++++ tests/ui/tests.sh | 1 + 7 files changed, 28 insertions(+), 6 deletions(-) diff --git a/examples/php-multisite/docker-compose.yml b/examples/php-multisite/docker-compose.yml index 2c5ec1e6..b41f7593 100644 --- a/examples/php-multisite/docker-compose.yml +++ b/examples/php-multisite/docker-compose.yml @@ -40,7 +40,7 @@ services: environment: - DOCKER_HOST=tcp://bw-docker-proxy:2375 volumes: - - ./bw-data:/data + - bw-data:/data networks: - bw-universe - bw-docker @@ -85,3 +85,6 @@ networks: bw-docker: net-app1: net-app2: + +volumes: + bw-data: diff --git a/examples/php-multisite/tests.json b/examples/php-multisite/tests.json index f33ab3e2..8181d193 100644 --- a/examples/php-multisite/tests.json +++ b/examples/php-multisite/tests.json @@ -1,7 +1,7 @@ { "name": "php-multisite", "kinds": ["docker", "autoconf", "linux"], - "timeout": 60, + "timeout": 120, "tests": [ { "type": "string", diff --git a/src/common/confs/api.conf b/src/common/confs/api.conf index b9b4cb9c..21b03526 100644 --- a/src/common/confs/api.conf +++ b/src/common/confs/api.conf @@ -2,8 +2,10 @@ server { server_name {{ API_SERVER_NAME }}; # HTTP listen - listen 0.0.0.0:{{ API_HTTP_PORT }}; + listen {{ API_LISTEN_IP }}:{{ API_HTTP_PORT }}; +{% if API_LISTEN_IP != "127.0.0.1" +%} listen 127.0.0.1:{{ API_HTTP_PORT }}; +{% endif +%} # maximum body size for API client_max_body_size 1G; diff --git a/src/common/settings.json b/src/common/settings.json index c791dc50..5c9ad0f4 100644 --- a/src/common/settings.json +++ b/src/common/settings.json @@ -144,6 +144,15 @@ "regex": "^\\d+$", "type": "text" }, + "API_LISTEN_IP": { + "context": "global", + "default": "0.0.0.0", + "help": "Listen IP address for the API.", + "id": "api-ip-listen", + "label": "API listen IP", + "regex": "^.*$", + "type": "text" + }, "API_SERVER_NAME": { "context": "global", "default": "bwapi", diff --git a/src/linux/scripts/start.sh b/src/linux/scripts/start.sh index 3a996d72..3630862f 100644 --- a/src/linux/scripts/start.sh +++ b/src/linux/scripts/start.sh @@ -33,14 +33,16 @@ function start() { # Setup and check /data folder /usr/share/bunkerweb/helpers/data.sh "ENTRYPOINT" - # Init database + # Create dummy variables.env if [ ! -f /etc/bunkerweb/variables.env ]; then - echo -e "IS_LOADING=yes\nSERVER_NAME=\nAPI_HTTP_PORT=${API_HTTP_PORT:-7000}\nAPI_SERVER_NAME=${API_SERVER_NAME:-bwapi}\nAPI_WHITELIST_IP=${API_WHITELIST_IP:-127.0.0.0/8}" > /etc/bunkerweb/variables.env + echo -ne "\# remove IS_LOADING=yes when your config is ready\nIS_LOADING=yes\nHTTP_PORT=80\nHTTPS_PORT=443\nAPI_LISTEN_IP=127.0.0.1\nSERVER_NAME=\n" > /etc/bunkerweb/variables.env + fi + + # Update database /usr/share/bunkerweb/gen/save_config.py --variables /etc/bunkerweb/variables.env --init if [ "$?" -ne 0 ] ; then log "ENTRYPOINT" "❌" "Scheduler generator failed" exit 1 - fi fi # Execute jobs diff --git a/tests/KubernetesTest.py b/tests/KubernetesTest.py index 2e76b2ec..ab2a8982 100644 --- a/tests/KubernetesTest.py +++ b/tests/KubernetesTest.py @@ -117,6 +117,11 @@ class KubernetesTest(Test): cwd="/tmp/kubernetes", shell=True, ) + run( + "kubectl describe deployment/bunkerweb-db", + cwd="/tmp/kubernetes", + shell=True, + ) run( "kubectl logs deployment/bunkerweb-db", cwd="/tmp/kubernetes", diff --git a/tests/ui/tests.sh b/tests/ui/tests.sh index 9667a2b4..0fea2232 100755 --- a/tests/ui/tests.sh +++ b/tests/ui/tests.sh @@ -38,6 +38,7 @@ while [ $i -lt 120 ] ; do i=$((i+1)) done if [ $i -ge 120 ] ; then + docker-compose logs echo "❌ Docker stack is not healthy" exit 1 fi