From eefbbecb6669f54eb9b5ca2560eedbd91a937990 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 16:29:54 -0600 Subject: [PATCH 1/9] Print docker container logs. --- tests/webapp-test/run-webapp-test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index d32e0eba..745899fc 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -32,12 +32,14 @@ CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) sleep 3 wget -O test.before -m http://localhost:3000 +docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) sleep 3 wget -O test.after -m http://localhost:3000 +docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID echo "###########################################################################" From e679dbd83b08a361c85b7a44e2cb39faf9a91050 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 16:33:56 -0600 Subject: [PATCH 2/9] Reduce number of tries --- tests/webapp-test/run-webapp-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index 745899fc..24fe5a7b 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -30,14 +30,14 @@ set +e CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) sleep 3 -wget -O test.before -m http://localhost:3000 +wget -t 5 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) sleep 3 -wget -O test.after -m http://localhost:3000 +wget -t 5 -O test.after -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID From e5689655fa441a8ef513ec790170e9f641f1b2dc Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 16:38:43 -0600 Subject: [PATCH 3/9] longer timeout --- tests/webapp-test/run-webapp-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index 24fe5a7b..612abee5 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -30,14 +30,14 @@ set +e CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) sleep 3 -wget -t 5 -O test.before -m http://localhost:3000 +wget -t 60 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) sleep 3 -wget -t 5 -O test.after -m http://localhost:3000 +wget -t 60 -O test.after -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID From 84e57190ef68b101419d0be04938a369a5d64499 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 16:44:34 -0600 Subject: [PATCH 4/9] Tweak --- tests/webapp-test/run-webapp-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index 612abee5..c693a969 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -30,14 +30,14 @@ set +e CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) sleep 3 -wget -t 60 -O test.before -m http://localhost:3000 +wget -t 7 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) sleep 3 -wget -t 60 -O test.after -m http://localhost:3000 +wget -t 7 -O test.after -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID From c8fe252aa81d0f38e2c551278a522ad222e2b757 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 16:46:36 -0600 Subject: [PATCH 5/9] debug --- tests/webapp-test/run-webapp-test.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index c693a969..ef6d1f78 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash set -e + +CERC_SCRIPT_DEBUG=1 if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi + # Dump environment variables for debugging echo "Environment variables:" env @@ -28,14 +31,14 @@ CHECK="SPECIAL_01234567890_TEST_STRING" set +e -CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID -CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.after -m http://localhost:3000 From 8f74f98b9c8f251eefb463dd3288d362f247fad4 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 17:08:18 -0600 Subject: [PATCH 6/9] Fix count --- tests/webapp-test/run-webapp-test.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index ef6d1f78..e4eae2e3 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -e -CERC_SCRIPT_DEBUG=1 if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi @@ -31,14 +30,14 @@ CHECK="SPECIAL_01234567890_TEST_STRING" set +e -CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=1 cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID -CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=1 -d cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.after -m http://localhost:3000 From 08d5d8e68a17993709179afb21d3cdc16cb25430 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 17:11:08 -0600 Subject: [PATCH 7/9] More tweak --- .../cerc-nextjs-base/scripts/start-serving-app.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh index aec65f29..0858a386 100755 --- a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh +++ b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh @@ -39,18 +39,14 @@ if [ "$CERC_NEXTJS_SKIP_GENERATE" != "true" ]; then count=0 generate_done="false" - while [ $count -lt $CERC_MAX_GENERATE_TIME ]; do + while [ $count -lt $CERC_MAX_GENERATE_TIME ] && [ "$generate_done" == "false" ]; do sleep 1 grep 'rendered as static HTML' gen.out > /dev/null if [ $? -eq 0 ]; then generate_done="true" - ps -ef | grep 'node' | grep 'next' | grep 'generate' >/dev/null - if [ $? -ne 0 ]; then - break - fi - else - count=$((count + 1)) + sleep 1 fi + count=$((count + 1)) done if [ $generate_done != "true" ]; then From 4920c46fa29392a5c3a6b348688d1e42071d1a63 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 17:15:39 -0600 Subject: [PATCH 8/9] Tweak debug --- tests/webapp-test/run-webapp-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/webapp-test/run-webapp-test.sh b/tests/webapp-test/run-webapp-test.sh index e4eae2e3..5db382f8 100755 --- a/tests/webapp-test/run-webapp-test.sh +++ b/tests/webapp-test/run-webapp-test.sh @@ -30,14 +30,14 @@ CHECK="SPECIAL_01234567890_TEST_STRING" set +e -CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=1 cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.before -m http://localhost:3000 docker logs $CONTAINER_ID docker remove -f $CONTAINER_ID -CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=1 -d cerc/test-progressive-web-app:local) +CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local) sleep 3 wget -t 7 -O test.after -m http://localhost:3000 From 5368da229993283bf9267a55956fef2c5db05157 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 14 Nov 2023 17:19:33 -0600 Subject: [PATCH 9/9] Refactor --- .../cerc-nextjs-base/scripts/start-serving-app.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh index 0858a386..bf35bcdb 100755 --- a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh +++ b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/start-serving-app.sh @@ -41,12 +41,11 @@ if [ "$CERC_NEXTJS_SKIP_GENERATE" != "true" ]; then generate_done="false" while [ $count -lt $CERC_MAX_GENERATE_TIME ] && [ "$generate_done" == "false" ]; do sleep 1 + count=$((count + 1)) grep 'rendered as static HTML' gen.out > /dev/null if [ $? -eq 0 ]; then generate_done="true" - sleep 1 fi - count=$((count + 1)) done if [ $generate_done != "true" ]; then