This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to clean, build, run and test the app
- Loading branch information
Showing
7 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
scripts_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
"$scripts_path/clean.sh" | ||
"$scripts_path/build.sh" | ||
"$scripts_path/run.sh" | ||
sleep 1 | ||
"$scripts_path/test.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
docker build -t node-healthcheck:dev .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
docker rm node-healthcheck -f 2> /dev/null | ||
docker rmi node-healthcheck:dev -f 2> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
docker run -d \ | ||
--name node-healthcheck \ | ||
-p 11012:11012 \ | ||
-e NODE_URL="https://sync-testnet.vechain.org" \ | ||
node-healthcheck:dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
retry_command() { | ||
local max_attempts=5 | ||
local delay=3 | ||
local attempt=0 | ||
|
||
until [ $attempt -ge $max_attempts ]; do | ||
"$@" | ||
local exit_code=$? | ||
if [ $exit_code -eq 0 ]; then | ||
return 0 | ||
fi | ||
|
||
attempt=$((attempt + 1)) | ||
echo "Command failed (Attempt $attempt/$max_attempts). Retrying in $delay seconds..." >&2 | ||
sleep "$delay" | ||
done | ||
|
||
echo "Command failed $max_attempts times. Giving up." >&2 | ||
} | ||
|
||
response=$(retry_command curl -s http://localhost:11012/healthcheck) | ||
is_healthy=$(echo $response | jq ".isHealthy") | ||
if [ "$is_healthy" == "true" ]; then | ||
echo "Smoke test successful." | ||
else | ||
echo "Smoke test failed." | ||
fi |