Add utils folder
This commit is contained in:
parent
ef9ec69204
commit
792097060b
3 changed files with 7 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ mkdir -p logs
|
||||||
cd frontend
|
cd frontend
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
../scripts/wait-for-server.sh
|
../scripts/utils/wait-for-server.sh
|
||||||
|
|
||||||
pids=()
|
pids=()
|
||||||
for i in $(seq 1 $process_count); do
|
for i in $(seq 1 $process_count); do
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
./scripts/utils/wait-for-server.sh
|
||||||
|
|
||||||
npm install -g openapi-typescript
|
npm install -g openapi-typescript
|
||||||
openapi-typescript http://localhost:3000/api.json --output frontend/sync-client/src/services/types.ts
|
openapi-typescript http://localhost:3000/api.json --output frontend/sync-client/src/services/types.ts
|
||||||
|
|
|
||||||
24
scripts/utils/wait-for-server.sh
Executable file
24
scripts/utils/wait-for-server.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SERVER_URL="http://localhost:3000"
|
||||||
|
MAX_RETRIES=30
|
||||||
|
RETRY_INTERVAL_IN_SECONDS=5
|
||||||
|
|
||||||
|
echo "Waiting for $SERVER_URL to become available..."
|
||||||
|
count=0
|
||||||
|
while [ $count -lt $MAX_RETRIES ]; do
|
||||||
|
if curl -s -f -o /dev/null $SERVER_URL; then
|
||||||
|
echo "$SERVER_URL is now available!"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Attempt $(($count+1))/$MAX_RETRIES: $SERVER_URL not available yet, retrying in ${RETRY_INTERVAL_IN_SECONDS}s..."
|
||||||
|
sleep $RETRY_INTERVAL_IN_SECONDS
|
||||||
|
count=$(($count+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $count -eq $MAX_RETRIES ]; then
|
||||||
|
echo "Error: $SERVER_URL did not become available after $MAX_RETRIES attempts."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Loading…
Reference in a new issue