Improve entrypoint
This commit is contained in:
parent
9c2e5ca79c
commit
cd3addb6c6
1 changed files with 19 additions and 2 deletions
|
@ -1,6 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
echo "Starting server..."
|
||||||
|
.qlot/bin/clackup --system hp --server woo --address 0.0.0.0 --port 3000 src/app.lisp &
|
||||||
|
|
||||||
|
SERVER_PID=$!
|
||||||
|
|
||||||
|
echo "Waiting 10 seconds before health check..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "Waiting for server to be ready..."
|
||||||
|
for i in {1..60}; do
|
||||||
|
if curl -s -o /dev/null -w "%{http_code}" http://0.0.0.0:3000 | grep -q "200"; then
|
||||||
|
echo "Server is up."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Server not ready yet... retrying ($i)"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -n "$CLOUDFLARE_ZONE_ID" && -n "$CLOUDFLARE_API_KEY" ]]; then
|
if [[ -n "$CLOUDFLARE_ZONE_ID" && -n "$CLOUDFLARE_API_KEY" ]]; then
|
||||||
echo "Purging Cloudflare cache..."
|
echo "Purging Cloudflare cache..."
|
||||||
curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
||||||
|
@ -11,5 +29,4 @@ else
|
||||||
echo "Cloudflare credentials not provided. Skipping cache purge."
|
echo "Cloudflare credentials not provided. Skipping cache purge."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting server..."
|
wait $SERVER_PID
|
||||||
exec .qlot/bin/clackup --system hp --server woo --address 0.0.0.0 --port 3000 src/app.lisp
|
|
Loading…
Add table
Add a link
Reference in a new issue