From 1cbf26c958846dee5dd7b66229dcbd6acddfa4a4 Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Tue, 5 Dec 2023 13:55:41 +0800 Subject: [PATCH] only mount on macos --- 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 91abdcfe..da035214 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/UDS + if [ "$(uname -s)" == "Darwin" ] || ! mkfifo .pongo_test.sock 2>/dev/null; then + warn "Current directory doesn't support UDS, thus only logs are exposed onto host." + warn "To view other files under servroot, exec into the pongo container and inspect" + warn "\$KONG_PREFIX directory" + + rm -f .pongo_test.sock + DOCKER_COMPOSE_FILES="$DOCKER_COMPOSE_FILES -f ${LOCAL_PATH}/assets/docker-compose-nonlinux.yml" + else + DOCKER_COMPOSE_FILES="$DOCKER_COMPOSE_FILES -f ${LOCAL_PATH}/assets/docker-compose-linux.yml" + fi + IMAGE_BASE_NAME=kong-pongo-test # the path where the plugin source is located, as seen from Pongo (this script)