From 29b91efed25de69369f8a6a767709778860b111d Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Tue, 5 Dec 2023 13:55:41 +0800 Subject: [PATCH] preserve behaviour on linux --- assets/docker-compose-linux-extend.yml | 6 ++++++ assets/docker-compose-nonlinux-extend.yml | 6 ++++++ assets/docker-compose.yml | 1 - pongo.sh | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 assets/docker-compose-linux-extend.yml create mode 100644 assets/docker-compose-nonlinux-extend.yml diff --git a/assets/docker-compose-linux-extend.yml b/assets/docker-compose-linux-extend.yml new file mode 100644 index 00000000..96659672 --- /dev/null +++ b/assets/docker-compose-linux-extend.yml @@ -0,0 +1,6 @@ +version: '3.5' + +services: + kong: + volumes: + - ${PONGO_WD}/servroot:/kong-prefix diff --git a/assets/docker-compose-nonlinux-extend.yml b/assets/docker-compose-nonlinux-extend.yml new file mode 100644 index 00000000..b50d7c50 --- /dev/null +++ b/assets/docker-compose-nonlinux-extend.yml @@ -0,0 +1,6 @@ +version: '3.5' + +services: + kong: + volumes: + - ${PONGO_WD}/servroot/logs:/kong-prefix/logs diff --git a/assets/docker-compose.yml b/assets/docker-compose.yml index 1adff576..afa84fad 100644 --- a/assets/docker-compose.yml +++ b/assets/docker-compose.yml @@ -170,4 +170,3 @@ services: - ${SERVICE_NETWORK_NAME}-kong.${SERVICE_NETWORK_NAME} volumes: - ${PONGO_WD}:/kong-plugin - - ${PONGO_WD}/servroot/logs:/kong-prefix/logs diff --git a/pongo.sh b/pongo.sh index 27625326..06f98665 100755 --- a/pongo.sh +++ b/pongo.sh @@ -25,6 +25,18 @@ function globals { DOCKER_FILE=${PONGO_DOCKER_FILE:-$LOCAL_PATH/assets/Dockerfile} DOCKER_COMPOSE_FILES="-f ${LOCAL_PATH}/assets/docker-compose.yml" + # macOS or WSL working on a drvfs mount doesn't support named pipes or Unix Domain Socket + if [ "$(uname -s)" == "Darwin" ] || ! (rm -f .pongo_test.sock; mkfifo .pongo_test.sock) 2>/dev/null; then + warn "Current directory doesn't support nix Domain Socket, thus only logs are" + warn "exposed onto host. To view other files under servroot, exec into the" + warn "pongo container and inspect \$KONG_PREFIX directory" + + rm -f .pongo_test.sock + DOCKER_COMPOSE_FILES="$DOCKER_COMPOSE_FILES -f ${LOCAL_PATH}/assets/docker-compose-nonlinux-extend.yml" + else + DOCKER_COMPOSE_FILES="$DOCKER_COMPOSE_FILES -f ${LOCAL_PATH}/assets/docker-compose-linux-extend.yml" + fi + IMAGE_BASE_NAME=kong-pongo-test # the path where the plugin source is located, as seen from Pongo (this script)