From e0ac41ca7d83b3632bfd42cc697e3fd6eec40903 Mon Sep 17 00:00:00 2001 From: kamly <121368588@qq.com> Date: Thu, 28 Sep 2023 13:43:52 +0800 Subject: [PATCH] fix: use sed replace yq (#508) --- .../workflows/apisix-docker-example-test-standalone.yaml | 2 +- centos/docker-entrypoint.sh | 9 ++++----- debian-dev/docker-entrypoint.sh | 9 ++++----- debian/docker-entrypoint.sh | 9 ++++----- redhat/docker-entrypoint.sh | 9 ++++----- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/workflows/apisix-docker-example-test-standalone.yaml b/.github/workflows/apisix-docker-example-test-standalone.yaml index 78b0ea7c..f9823c93 100644 --- a/.github/workflows/apisix-docker-example-test-standalone.yaml +++ b/.github/workflows/apisix-docker-example-test-standalone.yaml @@ -60,7 +60,7 @@ jobs: - name: Test APISIX run: | - sleep 50 #startup time maybe a little longer as the yq binary is downloaded for use at runtime + sleep 30 result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get` if [[ $result_code -ne 200 ]];then diff --git a/centos/docker-entrypoint.sh b/centos/docker-entrypoint.sh index cf5bd32b..93565ef6 100755 --- a/centos/docker-entrypoint.sh +++ b/centos/docker-entrypoint.sh @@ -31,11 +31,10 @@ deployment: config_provider: yaml _EOC_ else - wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ - && chmod a+x /usr/local/apisix/yq - /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml - /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml - rm /usr/local/apisix/yq + # updating config.yaml for standalone mode + sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml + sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml + sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml fi if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then diff --git a/debian-dev/docker-entrypoint.sh b/debian-dev/docker-entrypoint.sh index 70ae4487..b9d54c44 100755 --- a/debian-dev/docker-entrypoint.sh +++ b/debian-dev/docker-entrypoint.sh @@ -31,11 +31,10 @@ deployment: config_provider: yaml _EOC_ else - wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ - && chmod a+x /usr/local/apisix/yq - /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml - /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml - rm /usr/local/apisix/yq + # updating config.yaml for standalone mode + sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml + sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml + sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml fi if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then diff --git a/debian/docker-entrypoint.sh b/debian/docker-entrypoint.sh index cf5bd32b..93565ef6 100755 --- a/debian/docker-entrypoint.sh +++ b/debian/docker-entrypoint.sh @@ -31,11 +31,10 @@ deployment: config_provider: yaml _EOC_ else - wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ - && chmod a+x /usr/local/apisix/yq - /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml - /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml - rm /usr/local/apisix/yq + # updating config.yaml for standalone mode + sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml + sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml + sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml fi if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then diff --git a/redhat/docker-entrypoint.sh b/redhat/docker-entrypoint.sh index cf5bd32b..93565ef6 100755 --- a/redhat/docker-entrypoint.sh +++ b/redhat/docker-entrypoint.sh @@ -31,11 +31,10 @@ deployment: config_provider: yaml _EOC_ else - wget -qO /usr/local/apisix/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ - && chmod a+x /usr/local/apisix/yq - /usr/local/apisix/yq -i '.deployment.role = "data_plane"' ${PREFIX}/conf/config.yaml - /usr/local/apisix/yq -i '.deployment.role_data_plane.config_provider = "yaml"' ${PREFIX}/conf/config.yaml - rm /usr/local/apisix/yq + # updating config.yaml for standalone mode + sed -i 's/role: traditional/role: data_plane/' ${PREFIX}/conf/config.yaml + sed -i 's/role_traditional:/role_data_plane:/' ${PREFIX}/conf/config.yaml + sed -i 's/config_provider: etcd/config_provider: yaml/' ${PREFIX}/conf/config.yaml fi if [ ! -f "${PREFIX}/conf/apisix.yaml" ]; then